NanoPI M4


Recommended Posts

Donate and support the project!

On 9/13/2019 at 4:19 AM, pavelectric said:

Good afternoon. I have a version with DDR3 4Gb. OS - FriendlyCore + Mate desktop. YouTube full screen 1080 no problem at all. Armbian doesn't work like that ...

For some reason I'm not having the same experience. Tried different images, only one that doesn't lag in youtube is FriendlyDesktop, but once I run apt upgrade to the latest version, it doesn't handle it anymore.

 

With friendlycore + mate, I installed chrome and looked chrome://gpu, I don't see hardware accelerated. Do you know what else I need to do?

 

Sorry I know this doesn't concern armbian, but was kind of wondering if anyone know what else needs to be done to be able to play youtube at least for 1080p.

Edited by cowbe0x004
Link to post
Share on other sites

RE:Accelerated graphics not working. I've found that updating Friendly OS using the Linux tools loses both the setting and the acceleration. Simply putting the setting back on doesn't fix it. If you stick to the Friendly releases, it's fine. Apart from when they mangle a release and have to fix it in a hurry when the Beta testers (us) complain. :P

Link to post
Share on other sites

I think that is the idea, but I don't have that hat. Armbian usually transfers very well. I have the SATA Hat. I'm running Friendly OS right now which doesn't transfer 100% and I'm booting from EMMC and using SSD for data e.g. Thunderbird. The boot time from EMMC vs SSD SATA is negligible and running apps seems the same. 

Link to post
Share on other sites
13 hours ago, decryption said:

Can anyone confirm if the NanoPi M4 can boot from an NVMe SSD if I purchase the optional hat?

Yes it can. But only with Armbian as far as I know.
I made a video on how to install it onto NVMe. 

I now also have the NVMe hat for the M4. I love the thing. 
I've installed armbian bionic desktop with @JMCC his media script. Works great. 
Greetings.
 

Link to post
Share on other sites

Can confirm Sabrent 256GB Rocket NVMe PCIe M.2 2280 works in armbian with NVMe hat.  Have included test of the read speed which is an impressive 734mbs as for write speed could not do. Exactly same conditions as nicod video above.

Main website

Amazon link

 

158714691_sabrentnvmetest.jpg.35e4e56e8313f9b23773930d19d21d28.jpg

 

Not sure if anyone else is having problems with the 12v fan with the NVMe hat but this doesn't work in armbian, so assume something needs to be added to armbian to activate it at p-mos switch. If it does could be i got a faulty fan, NVMe board or it activates at a higher temperature then i can get it atm in the metal case. 

M4_NVME_SSD_BLOCK.thumb.jpg.d18039e25b8ceee40beedac5d8d42c5e.jpg

Thanks nicod for video btw saved me some time.

 

Link to post
Share on other sites
On 10/5/2019 at 8:05 PM, cowbe0x004 said:

The nvme adapter does not work with xpg sx6000 lite nvme and sk hynix sata drives. Looks like the adapter or the kernel is picky on which drive it can recognize.

 

I lied, xpg sx6000 works just fine with armbian.

 

Does anyone know how to boot out of the nvme drive? I still have to leave the sdcard plugged in after running armbian-config to boot from nvme.

Link to post
Share on other sites
17 minutes ago, cowbe0x004 said:

Does anyone know how to boot out of the nvme drive? I still have to leave the sdcard plugged in after running armbian-config to boot from nvme.

Since U-Boot needs to reside somewhere, and since NanoPi-M4 doesn't seem to have any SPI-NOR, it can only boot from either eMMC module, if you have one, or the SDCard, then RootFS can be located on nvme.

Link to post
Share on other sites
On 10/9/2019 at 2:49 PM, shaun27 said:

Not sure if anyone else is having problems with the 12v fan with the NVMe hat but this doesn't work in armbian, so assume something needs to be added to armbian to activate it at p-mos switch. If it does could be i got a faulty fan, NVMe board or it activates at a higher temperature then i can get it atm in the metal case. 

 

I haven't used the NVMe hat as driver for the fan in Armbian. I'm using the 3V gpio pin for it. Makes way too much noise when it turns on with the NVMe hat(in FriendlyDesktop). 

Does it also make so much noise for you? 

I also removed the cover under the fan and that reduced the noise level a lot. Certainly when putting 5V or higher thru the fan. The fins in the metal cover make a whisle noise.
It stays cool enough at 3V for normal use. Without it, it gets too hot quickly. 
I'd like to hear your experience. 
 

Link to post
Share on other sites
10 hours ago, NicoD said:

I haven't used the NVMe hat as driver for the fan in Armbian. I'm using the 3V gpio pin for it. Makes way too much noise when it turns on with the NVMe hat(in FriendlyDesktop). 

Does it also make so much noise for you? 

I also removed the cover under the fan and that reduced the noise level a lot. Certainly when putting 5V or higher thru the fan. The fins in the metal cover make a whisle noise.
It stays cool enough at 3V for normal use. Without it, it gets too hot quickly. 
I'd like to hear your experience. 
 

The NVMe hat 12v fan socket doesn't work at all for armbian, most likely missing a drive or something. I got it to around 50c and the fan didn't even kick in. I have directly connected the fan to the 5v gpio port for the time being works fine not loud at all but downside to this is that you have to fully disconnect the device to power the fan down. Their was some information regarding controlling the port pwn0 link did try it but it completely bricked the account i exported to so. Have not tried friendlyelec desktop as i prefer armbian's clean image.

 

As for cooling i have no problems even with fan off in the metal case as i have used copper shims and thermal paste sits at 30c idle and 40c something under load. I will say its a pain to say the least to do that in the metal case without the copper shim going misaligned. I did try their thermal pad but tbh temps were going up to 50c once the metal case was warmed up. The metal case is alot more effective though then the normal heat-sink they supplied.

Link to post
Share on other sites

I like to further add regarding Sabrent 256GB Rocket NVMe i have tested this write speed and read speed same time.

Read 390mb give or take few mb and around 380 write.

 

So i would assume this is the upper limit on the pci2.1 on the m4 of around 780 something considering the NVMe is rated 1050mb write 3100 read. Still alot faster then the ssd i tested through usb3.

Link to post
Share on other sites
Spoiler



#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>

const char PWM0GENERATOR[]="/sys/class/pwm/pwmchip1/export";
const char PWM0[]="/sys/class/pwm/pwmchip1/pwm0";
const char CPUTMP[]="/sys/class/thermal/thermal_zone0/temp";
const char PERIOD[]="period";
const char POLARITY[]="polarity"; 
const char DUTY_CYCLE[]="duty_cycle";
const char ENABLE[]="enable";

char buf[256];
int currentFanLevel = 0;

int isFanDeviceAvailable()
{
	snprintf(buf, sizeof buf, "%s/%s", PWM0,ENABLE);
	if( access( buf, F_OK ) != -1 ) {
		return 1;
	} 
	else {
		return 0;
	}
}

void WriteDataToFile(const char* fname, const char* data, int length){
	int fd = open(fname, O_WRONLY);
	if (fd == -1) {
		fprintf(stderr, "Unable to open %s\n%s\n", fname, strerror(errno));
        //perror("Unable to open %s",PWM1);
        exit(1);
    }

    if (write(fd, data, length) != length) {
		fprintf(stderr, "Error writing to %s\n%s\n", fname, strerror(errno));
        //perror("Error writing to %s",PWM1);
        exit(1);
    }
    close(fd);
}

void ReadDataFromFile(const char* fname, char *data, int size){
	int fd = open(fname, O_RDONLY);
	if (fd == -1) {
		fprintf(stderr, "Unable to open %s\n%s\n", fname, strerror(errno));
        exit(1);
    }
	read(fd, data, size);
	close(fd);
}

void EnablePWM()
{
	if (!isFanDeviceAvailable()){
		WriteDataToFile((char *)PWM0GENERATOR,"0",1);
	}
}

int isFanRunning()
{
	char enabled;
	snprintf(buf, sizeof(buf), "%s/%s", PWM0,ENABLE);
	ReadDataFromFile(buf, &enabled,1);
	return (enabled=='1');
}

int GetCpuTemp(){
	ReadDataFromFile(CPUTMP, buf,sizeof(buf));
	int num = atoi(buf);
	return num/1000;
}

void SetFanLow(){
	if (currentFanLevel != 1)
	{
		snprintf(buf, sizeof(buf), "%s/%s", PWM0,DUTY_CYCLE);
		WriteDataToFile(buf,"3000000",7);
		currentFanLevel = 1;
	}
}

void SetFanMed(){
	if (currentFanLevel != 2)
	{
		snprintf(buf, sizeof(buf), "%s/%s", PWM0,DUTY_CYCLE);
		WriteDataToFile(buf,"6000000",7);
		currentFanLevel = 2;
	}
}

void SetFanHigh(){
	if (currentFanLevel != 3)
	{
		snprintf(buf, sizeof(buf), "%s/%s", PWM0,DUTY_CYCLE);
		WriteDataToFile(buf,"9000000",7);
		currentFanLevel = 3;
	}
}

void SetFanOn(){
	snprintf(buf, sizeof(buf), "%s/%s", PWM0,ENABLE);
	WriteDataToFile(buf,"1",1);
}

void SetFanOff(){
	snprintf(buf, sizeof(buf), "%s/%s", PWM0,ENABLE);
	WriteDataToFile(buf,"0",1);
	currentFanLevel = 0;
}

void InitPwm()
{
	snprintf(buf, sizeof(buf), "%s/%s", PWM0,PERIOD);
	WriteDataToFile(buf,"10000000",8);
	snprintf(buf, sizeof(buf), "%s/%s", PWM0,POLARITY);
	WriteDataToFile(buf,"normal",6);
}

void Loop(){
	int tmp;
	while (1==1){
		tmp = GetCpuTemp();
		if (tmp < 60)
			SetFanOff();
		else{
			SetFanOn();
			if (tmp < 70){
				SetFanLow();
			}
			else if ( tmp < 75){
				SetFanMed();
			}
			else if (tmp <80){
				SetFanHigh();
			}
		}
		sleep(60);
	}
}

int main(int argc, char **argv)
{
	EnablePWM();
	if (isFanDeviceAvailable()){
		if (isFanRunning())
		{
			SetFanOff();
		}
		else
		{
			InitPwm();
			Loop();
		}
	}
	return (EXIT_SUCCESS);
}


 

 

It seems, that there is no driver for fan in armbian. So I wrote a little program in C to control fan on the hat. This nice program adjust the fan speed on cpu temperature accordingly. It starts the fan as 60 °C with 30% power. At 70 °C up to 60% and at 80 °C to 90%. You can adjust it within the code easily.
Compile it with "gcc fancontrol.c -o fancontrol". I configured the program as service. If you want it too, do the following steps:

Create a file fancontrol.service with the following content:

[Unit]
Description=Fan control

[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/usr/bin
ExecStart=/usr/bin/fancontrol

[Install]
WantedBy=multi-user.target

do the following steps

sudo cp fancontrol /usr/bin
sudo cp fancontrol.service /etc/systemd/system
sudo systemctl enable fancontrol
sudo systemctl start fancontrol

 and that's it.
It works perfekt for me.
Have fun.

Edited by TRS-80
put one long code block in spoiler
Link to post
Share on other sites

Tried this program on M4V2 with NVMe (bionic 4.4. kernel)  - service is running but no effect even if cat /sys/class/thermal/thermal_zone0/temp goes over 65000 in Generic monitor.

Has anybody got  running fan on such config? Program uses PWM0 (except for errors) but NVMe card has "fan, modulated by PWM1" in description. I wonder, if replacement could help? :)

Fan works perfectly on Frendlyarm bionic image.

 

arvo@nanopim4v2:~$ sudo systemctl status fancontrol
● fancontrol.service - Fan control
   Loaded: loaded (/etc/systemd/system/fancontrol.service; enabled; vendor prese
   Active: active (running) since Wed 2020-02-12 18:52:54 UTC; 24min ago
 Main PID: 806 (fancontrol)
    Tasks: 1 (limit: 4560)
   CGroup: /system.slice/fancontrol.service
           └─806 /usr/bin/fancontrol

Feb 12 18:52:54 nanopim4v2 systemd[1]: Started Fan control.

Link to post
Share on other sites
On 9/30/2019 at 9:51 PM, NicoD said:

Yes it can. But only with Armbian as far as I know.
I made a video on how to install it onto NVMe. 

now also have the NVMe hat for the M4. I love the thing. 
I've installed armbian bionic desktop with @JMCC his media script. Works great. 
Greetings.
 

just shared in another post on this forum my NVME iozone results for my Nanopi M4v1 with 1TB XPG SX8200 Pro.

800000+kBytes/sec both read and write.

specially for @NicoD some pictures. I power with 4a adapter. Self designed and 3d printed cabrio case, that does not fit well now with nvme board.

IMG_20200326_212840.jpg

IMG_20200328_220120.jpg

IMG_20200328_220230.jpg

IMG_20200328_220641.jpg

Link to post
Share on other sites

My results with a NanoPi M4v2 + 8A custom power supply + Samsung NVMe 250 GB EVO 960 PRO:

 

$ dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 2.72603 s, 394 MB/s

 

Kernel 4.4.213-rk3399

 

Slow isn't it :P ? I wonder what can be done to improve this.

 

Link to post
Share on other sites
On 3/29/2020 at 1:37 PM, TCB13 said:

My results with a NanoPi M4v2 + 8A custom power supply + Samsung nvme 256gb evo 960 pro:

 

$ dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 2.72603 s, 394 MB/s

 

Kernel 4.4.213-rk3399

 

Slow isn't it :P ? I wonder what can be done to improve this.

 

Very nice.  For comparison, i ran this on my Nano Pi M4v1 with SATA hat and Sandisk SSD Plus.

$ dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 4.25152 s, 253 MB/s

 

Link to post
Share on other sites
On 3/30/2020 at 2:39 PM, TCB13 said:

I was expecting something between 500-700 MB/s from my M4v2.

Try bigger files. This test does files of 64k. Try files of 100MB 100times.

dd if=/dev/zero of=test bs=100MB count=100 conv=fdatasync

I use the gnome-disks utility to benchmark. It shows the performance with big files, but also the latency what is important for small files. That way you get numbers that can be understood.

Link to post
Share on other sites
8 hours ago, NicoD said:

Try bigger files. This test does files of 64k. Try files of 100MB 100times.


dd if=/dev/zero of=test bs=100MB count=100 conv=fdatasync

I use the gnome-disks utility to benchmark. It shows the performance with big files, but also the latency what is important for small files. That way you get numbers that can be understood.

 

hm.. not much better:

 

 dd if=/dev/zero of=test bs=100MB count=100 conv=fdatasync
100+0 records in
100+0 records out
10000000000 bytes (10 GB, 9.3 GiB) copied, 31.697 s, 315 MB/s

My previous command gives perfectly good results on my desktop.

Link to post
Share on other sites

received my nvme board and ssd this week, here is my iozone results.

FriendlyArm Nanopi M4v1 4GB board NVME board Armbian Buster Desktop Kernel 5.4.28 Adata XPG SX8200 Pro 1TB Tom's hardware favorite

iozone -e -I -a -s 100M -r 4k -r 16k -r 512k -r 1024k -r 16384k -i 0 -i 1 -i 2

                                                                                                 random    random                                 
                  kB   reclen       write     rewrite        read      reread        read       write
          102400          4     97170    133733   155927   156368     61290   133851                                                          
          102400        16    254791   325694   337906   339478   134043   323214                                                          
          102400      512    669920   744732   662990   674603   558387   670433                                                          
          102400    1024    658770   710258   677015   705205   627108   776480                                                          
          102400   16384   820732   824027   727671   731739   722866   821623

Power consumption is up from 5.5-6.5watts for 2 and with 1024 and 16384 for 3 watts up to 9.5watts.

Not bad for a lame SBC. I use with Postgres, Timescaledb and Grafana in Docker containers.

Link to post
Share on other sites

@williamv unfortunately I can't try the new kernel right now. But for for future reference:

 

        Command line used: iozone -e -I -a -s 100M -r 4k -r 16k -r 512k -r 1024k -r 16384k -i 0 -i 1 -i 2
        Output is in kBytes/sec
 
                                                              random    random     bkwd    record    stride

              kB  reclen    write  rewrite   133470   128882    43201    75881                                                          freread
          102400      16   159788   222536   251343   252133   141357   215236
          102400     512   530729   557813   497080   500936   469576   566763
          102400    1024   572502   593950   518543   515461   502492   586127
          102400   16384   635756   666508   591797   636189   613437   652484
 

NanoPi M4v2 + 8A custom power supply + Samsung NVMe 250 GB EVO 960 PRO (Samsung Electronics NVMe SSD Controller SM961/PM961). Kernel 4.4.213-rk3399.

Link to post
Share on other sites
On 10/12/2019 at 7:59 AM, shaun27 said:

I have directly connected the fan to the 5v gpio port for the time being works fine not loud at all but downside to this is that you have to fully disconnect the device to power the fan down.

true for the 5v gpio. i put a small 5/3.3v fan on the 3.3v gpio. that does powerdown with the os, without cord disconnect. see earlier picture. silent and enough cooling for my usage.

ali charmoon fan

Link to post
Share on other sites

@Igor Is there any reason why all RK3399 products seem to have a focal as supported, except for the M4? M4 still has buster and Bionic desktop. While M4V2 has Buster and Focal desktop. Rock pi Focal and Buster Desktop. OPi4 both Focal mainline.  Every RK3399 seems to be different. 
Just wondering why. Cheers.

Link to post
Share on other sites
1 hour ago, NicoD said:

@Igor Is there any reason why all RK3399 products seem to have a focal as supported, except for the M4? M4 still has buster and Bionic desktop. While M4V2 has Buster and Focal desktop. Rock pi Focal and Buster Desktop. OPi4 both Focal mainline.  Every RK3399 seems to be different. 
Just wondering why. Cheers.

Scroll to the VERY bottom of The NanoPi M4 software choices page. Focal 5.4 version of Armbian is there for Nano Pi M4.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...