Assimetrika
  • Manifesto
  • Artigos
    • NanoPI R5S: First Approach
  1. You are here:  
  2. Home
  3. Artigos
  4. IoT/SOC

Working with Nano PI R5S: The first approach

Details
Written by: Jorge Rosa
Category: IoT/SOC
Published: 04 April 2023
Hits: 3493

I've been working with Nano PI for some time now and continue to find a pretty awesome System On Chip (SOC) with fair performance. I started with the NanoPI R4S on which I created a number of solutions, like a router, a gateway, a VPN server, Git Server and File server. For the moment, it serves as a file server in my network.

Nano PI products are supplied by FriendlyElec. They are the company that develops and maintains these SOCs. They actively update information and documentation for each product on their Wiki site. The information they provide is quite comprehensive and useful, and has been a good help. They have based their operating system on some mature GNU/Linux distributions such as OpenWRT and Debian based (FriendlyCore). Armbian also an option, and you can find a GNU/Linux distribution with support on their site.
The schematics of each Nano PI are publicly available on their wiki page.

A few moths ago I came across a new product, the NanoPI R5S (and Wiki). From my search at that time, there were already some reviews of this product from Stupid Projects and CNX Software. Their reviews aroused my curiosity and some other ideas, especially because of some intrinsic characteristics of it, namely:

  • CPU: Rockchip RK3568B2, Quad-core ARM Cortex-A55
  • RAM: 4GB LPDDR4X
  • Flash: 16GB eMMC 5.1 Flash
  • Ethernet: 1x Native RTL8211F-CG chip Gigabit Ethernet, and 2x PCIe RTL8125BG chip 2.5G Ethernet
  • PCIe: M.2 M-Key, PCIe2.0 x1, support NVME, PCIe WiFi etc <= This is the most interesting part!!!

Two of the first things I took into account were; (1) the CPU performance was described as one of the best in their range and, (2) it was the first product at the time to have two additional network interfaces at 2.5Gbit. While I find these features very interesting, they wouldn't be enough to make me lose my mind...

What really caught my eye was the M2 PCIex interface. Mainly because, until now, I have always built and used file servers on low-profile small computer systems with support for external USB drives as I do have now, but never had the opportunity to have one with internal storage, in this case with support for an M2-M key for NVME discs. Usually these SOCs are too expensive to acquire, which is not the case here. After some searching I found someone (I lost the link and do not remember the site) who suggested to use a JMicro JMB585 M2-Key interface to 5x SATA instead of an NVME disk to support up to 5 internal SATA disks.

My curiosity got the better of me and led me to validate the practical application of such a solution. If I'm going to do these tests, I'll also have to get an expansion card for the test board to be built, it's not a good idea to have the components not fixed to the bench or in something solid and stable.
In case of success and good expectations, I might think about upgrading my actual network storage.

So I have bought the following products:

  • two Nano Pi R5S (yes, I lost my mind!) from FriendlyElec. One with Metal Case and another Bare board, both with 4GB MEM/16GB eMMC. Their after sales support is very good and they were quick to help me resolve a problem with customs.
  • the M2-Key M SATA Interface from Banggood
  • an extension card with a ribon of 25cm from AliExpress

Delivery of these products took between 2 and 5 weeks as they were obviously coming from China. It was worth the wait and the components arrived without any problems.

NanoPI R5S
Nano PI R5S Board upper side

 

Jmicro
JMicro JMB585

 

Nano PI R5S Board lower side

 

JMicro JMB585 mounted on NanoPI R5S

These components needed to be secured so that I could connect USB and/or Ethernet cables in a safe and practical way. So I came up with the idea of building a development base board using a small piece of pressed wood, bolts, screws and some leftover acrylic.

Pressed Wood board already cutted

 

Acrylic cutting for the M2 MKey extention card

 

Finished support for M2 MKey extention card and fixed bolts for Nano PI R5S

 

Final Result

With this development baseboard implemented and the components secured, I started to install the O.S. on the Nano PI R5S. I followed the instructions to install the OS to the eMMC memory from Wiki page [2] section 4.5.2.2 (Option 2: Install OS via TF card). Instead of using Win32DiskImager to burn the SHDC card, I used the Balena Etcher software with the image from Google Drive:
[Google Drive]:\RK3568-FriendlyElec\01_Official Images\02_SD-to-eMMC images\rk3568-eflasher-friendlycore-focal-5.10-arm64-20230314.img.gz

After installing the OS on the eMMC, the eth0 network adapter was changed to suit my network with the IP 192.168.1.9 and the basic tests of this solution were initiated. One of these tests was to check the SATA interface with a SATA disc attached

root@FriendlyElec:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether be:70:4c:b9:ce:25 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.9/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2001:818:df61:6900:bc70:4cff:feb9:ce25/64 scope global dynamic mngtmpaddr
       valid_lft 86400sec preferred_lft 3600sec
    inet6 fe80::bc70:4cff:feb9:ce25/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether c2:70:4c:b9:ce:25 brd ff:ff:ff:ff:ff:ff
4: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 2e:8c:5b:81:5a:63 brd ff:ff:ff:ff:ff:ff
root@FriendlyElec:~# lspci
0000:00:00.0 PCI bridge: Fuzhou Rockchip Electronics Co., Ltd Device 3566 (rev 01)
0000:01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. Device 8125 (rev 05)
0001:10:00.0 PCI bridge: Fuzhou Rockchip Electronics Co., Ltd Device 3566 (rev 01)
0001:11:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. Device 8125 (rev 05)
0002:20:00.0 PCI bridge: Fuzhou Rockchip Electronics Co., Ltd Device 3566 (rev 01)
0002:21:00.0 SATA controller: JMicron Technology Corp. Device 0585

 

After this test I had to try to use a disk drive. So I picked up a 500GB SATA disk form a broken laptop and connected it to the SATA Interface. I had to move this solution near to the ATX power suply of my bench :P in order to have power for the disk :P.

 

root@FriendlyElec:~# fdisk -l

( … a list of several /dev/ramxx disks and the eMMC storage /dev/mmcblk2 … )

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST9500325AS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbed34be6

Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1  *       63 976768064 976768002 465.8G  7 HPFS/NTFS/exFAT

 

At least the disc is visible to the OS. Now I deleted this volume and created an EXT4 one. Finally, I proceeded with the formatting.

root@FriendlyElec:~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): 

( … applied the proper commands to delete the old partition an create a new one … )

Command (m for help): p
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST9500325AS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbed34be6

Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1        2048 976773167 976771120 465.8G 83 Linux

Command (m for help): w1
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@FriendlyElec:~# mkfs.ext4 /dev/sda1
mke2fs 1.44.5 (15-Dec-2018)
Creating filesystem with 122096390 4k blocks and 30531584 inodes
Filesystem UUID: cc318e3b-50b1-469d-bfd2-088c474f887a
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done

root@FriendlyElec:~# ls /dev/disk/by-uuid/ -la
total 0
drwxr-xr-x 2 root root 100 Mar 29 07:59 .
drwxr-xr-x 8 root root 160 Aug  4  2017 ..
lrwxrwxrwx 1 root root  15 Feb 14  2019 ae1524a4                             -> ../../mmcblk2p9
lrwxrwxrwx 1 root root  10 Mar 29 07:59 cc318e3b                             -> ../../sda1
lrwxrwxrwx 1 root root  15 Feb 14  2019 db58686c                             -> ../../mmcblk2p8

 

Well, I managed to set up a dumb and simple samba server with the raw base security to see how easy and simple it can be set up and how fast files can be transferred. First I had to update the Software Package Manager and install the Samba software, as it is not included in the distribution image.

root@FriendlyElec:~# apt update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [34.8 kB]
Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [56.6 kB]
( … more updates … )
Get:29 http://deb.debian.org/debian buster-backports/non-free arm64 Packages [24.4 kB]
Get:30 http://deb.debian.org/debian buster-backports/non-free Translation-en [39.5 kB]
Fetched 24.7 MB in 12s (2118 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
208 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@FriendlyElec:~# apt-get install samba smbclient samba-vfs-modules samba-testsuite samba-dsdb-modules samba-libs samba-common samba-common-bin registry-tools libsmbclient libldb2 ldb-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
libsmbclient is already the newest version (2:4.9.5+dfsg-5+deb10u3).
libsmbclient set to manually installed.
samba-libs is already the newest version (2:4.9.5+dfsg-5+deb10u3).
samba-libs set to manually installed.
The following packages were automatically installed and are no longer required:
  liba52-0.7.4 libaom0 libdca0 libdrm-freedreno1 libdrm-tegra0 libmysofa0 libvidstab1.1
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  libgpgme11 python-crypto python-dnspython python-ldb python-samba python-tdb tdb-tools
Suggested packages:
  python-crypto-doc bind9 bind9utils ctdb smbldap-tools ufw winbind heimdal-clients subunit cifs-utils
Recommended packages:
  python-gpg attr logrotate libcephfs2 libgfapi0
The following NEW packages will be installed:
  ldb-tools libgpgme11 python-crypto python-dnspython python-ldb python-samba python-tdb registry-tools samba
  samba-common samba-common-bin samba-dsdb-modules samba-testsuite samba-vfs-modules smbclient tdb-tools
0 upgraded, 16 newly installed, 0 to remove and 208 not upgraded.
Need to get 7621 kB of archives.
After this operation, 50.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://deb.debian.org/debian buster/main arm64 python-dnspython all 1.16.0-1+deb10u1 [90.2 kB]
Get:2 http://deb.debian.org/debian buster/main arm64 python-crypto arm64 2.6.1-9+b1 [256 kB]
Get:3 http://deb.debian.org/debian buster/main arm64 python-ldb arm64 2:1.5.1+really1.4.6-3+deb10u1 [37.4 kB]
( … Instalation follow on with a lot of info being printed … )
Processing triggers for systemd (241-7~deb10u8) ...
Processing triggers for libc-bin (2.28-10+deb10u1) ...
ldconfig: file /usr/lib/aarch64-linux-gnu/libmali-bifrost-g52-g2p0-x11.so is truncated

ldconfig: file /usr/lib/aarch64-linux-gnu/libmali.so is truncated

ldconfig: file /usr/lib/aarch64-linux-gnu/libmali.so.1 is truncated

ldconfig: file /usr/lib/aarch64-linux-gnu/libmali.so.1.9.0 is truncated

 

Now that I had the Samba software installed, I needed to configure a disk mount point and present it to the network. The directory /mnt/500G_test1 was created for this purpose and the disk /dev/sda1 was mounted to it. I won't be using the sdaxx device directly, I'll be using its UUID instead, so that if the disk is connected to any other SATA interface, the UUID will be redirected to the correct sdaxx. So the following line was added to the fstab file:

UUID=cc318e3b                             /mnt/500G_test1 ext4 defaults 0 0

 

The group SambaUsers and the user Sambista have been created and assigned accordingly:

root@FriendlyElec:~# groupadd SambaUsers
root@FriendlyElec:~# cat /etc /group | grep SambaUsers
SambaUsers:x:1001:
root@FriendlyElec:~# useradd Sambista -g 1001 -G 1001
root@FriendlyElec:~# cat /etc /group | grep SambaUsers
SambaUsers:x:1001: Sambista
root@FriendlyElec:~# cat /etc /passwd | grep  Sambista
Sambista:x:1001:1001::/home/jrosa:/bin/sh
root@FriendlyElec:~# passwd Sambista
New password:
Retype new password:
passwd: password updated successfully
root@FriendlyElec:~# smbpasswd -a Sambista
New SMB password:
Retype new SMB password:
Added user Sambista.

 

Next, I mounted the volume and assigned the correct permissions:

root@FriendlyElec:~# mount /mnt/500G_test1/
root@FriendlyElec:~# cd /mnt/
root@FriendlyElec:/mnt# chown root.SambaUsers -R 500G_test1/
root@FriendlyElec:/mnt# chmod -R 774 500G_test1/
root@FriendlyElec:/mnt#

 

Before enabling the Samba server, I added the following lines into the smb.conf file:

[500G_test1]
        comment = Directorio teste
        browseable = yes
        read only = No
        inherit acls = yes
        path = /mnt/500G_test1
        valid users = @SambaUsers
        veto files = /lost+found

 

Finally, I was able to activate the Samba server:

 

root@FriendlyElec:/mnt# systemctl start smbd nmbd
root@FriendlyElec:/mnt# systemctl enable smbd nmbd
root@FriendlyElec:/mnt# systemctl status smbd nmbd
o  smbd.service - Samba SMB Daemon
   Loaded: loaded (/lib/systemd/system/ smbd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2023-03-29 09:55:20 UTC; 1h 15min ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
 Main PID: 1892 (smbd)
   Status: "smbd: ready to serve connections..."
    Tasks: 4 (limit: 4654)
   Memory: 14.3M
   CGroup: /system.slice/ smbd.service
           ├─1892 /usr/sbin/ smbd --foreground --no-process-group
           ├─1894 /usr/sbin/ smbd --foreground --no-process-group
           ├─1895 /usr/sbin/ smbd --foreground --no-process-group
           └─1897 /usr/sbin/ smbd --foreground --no-process-group

o  nmbd.service - Samba NMB Daemon
   Loaded: loaded (/lib/systemd/system/ nmbd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2023-03-29 09:55:21 UTC; 1h 15min ago
     Docs: man:nmbd(8)
           man:samba(7)
           man:smb.conf(5)
 Main PID: 1945 (nmbd)
   Status: "nmbd: ready to serve connections..."

Tasks: 1 (limit: 4654)
   Memory: 2.1M
   CGroup: /system.slice/ nmbd.service
           └─1945 /usr/sbin/ nmbd --foreground --no-process-group

 

Now that the \\192.168.1.9\500G_test1 share is available and visible on the network, I’m ready to make the data transfer test. No matter which network card I use from the Nano PI R5S under my network, the maximum data transfer is 1GBit due to the 24Port HP Procurve 2724 Gbit switch on my office private segment. So my expectation is to have a limit of 110MB of data network transfer.

This test is quite simple, I have identified a Windows Folder in my desktop computer with several files where its volume was about of 31GBytes and managed to copy this Folder to the Nano PI R5S Shared Disk. The results are shown in the pictures below:

This basic test alone has made my day. The data transfer ranged from 65MBytes to 96MBytes and finished in 7min and 12seconds. Not bad at all if the purpose is for a small NAS system.
For comparison, my current Network data storage (with Samba) has a slower data transfer, about 33MBytes at its top speed. So this last test shows a better speed, much higher than what I’ve got now. I should bear in mind that my current Network Storage has been working productively for almost 11years and the network shares are actually external USB disk drives. So there is certainly a bottlenecks somewhere, even if it is due to technological limitations.

It is, also, clear that the Nano PI R5S solution outperforms my current Network Storage in terms of speed. In terms of overall performance, I have avoided drawing any further conclusions. Mainly because I still need to develop this solution to the same extent as I have developed my current Network storage in terms of expandability, stability and security.

I have been thinking about the number of solutions that can be applied to the NanoPI R5S as well as possibly being my next network storage solution. I'll continue to evaluate this SOC with the SATA interfaces and additional SATA disks over the next few months and give you a follow up as soon as I can.
One thing is for sure, I have to give this solution an housing to keep it protected and ready to go. Mainly because I’m always inventing new things and the bench space is always needed ...

 

See you soon!

Copyright © 2023 Jorge Rosa. All Rights Reserved.
Powered by Joomla! - Joomla! is Free Software released under the GNU General Public License.