NanoPi R5S

From FriendlyELEC WiKi
Jump to: navigation, search

查看中文

Contents

1 Introduction

Overview
Front
Back
Case
Case
Case
  • The NanoPi R5S is a RK3568 SoC based ARM board.

2 Hardware Spec

  • SoC: Rockchip RK3568B2
    • CPU: Quad-core ARM Cortex-A55 CPU, up to 2.0GHz
    • GPU: Mali-G52 1-Core-2EE,supports OpenGL ES 1.1, 2.0, and 3.2, Vulkan 1.0 and 1.1, OpenCL 2.0 Full Profile
    • VPU: 4KP60 H.265/H.264/VP9 video decoder, 1080P60 H.264/H.265 video encoder
    • NPU: Support 0.8T
  • RAM: 2GB LPDDR4X
  • Flash: 8GB eMMC
  • Ethernet: one Native Gigabit Ethernet, and two PCIe 2.5Gbps Ethernet
  • USB: two USB 3.0 Type-A ports
  • HDMI:
    • support HDMI1.4 and HDMI2.0 operation
    • support up to 10 bits Deep Color modes
    • support up to 1080p@120Hz and 4096x2304@60Hz
    • support 3-D video formats
  • PCIe: M.2 Key M, PCIe2.1 x1, support NVME, PCIe WiFi etc
  • microSD: support UHS-I
  • GPIO:
    • 12-pin 0.5mm FPC connector
    • up to 1x SPI, up to 3x UARTs, up to 4x PWMs, up to 8x GPIOs
  • SD/MMC/SDIO/I2S:
    • 2x8-pin 1.27mm connector
    • Compatible with SDIO3.0 protocol
    • Compatible with SD3.0, MMC ver4.51
    • 4bits data bus widths
    • 1x I2S with 2x SDO and 3x SDI
  • Debug: one Debug UART, 3 Pin 2.54mm header, 3.3V level, 1500000bps
  • LEDs: 4 x GPIO Controlled LED (SYS, WAN, LAN1, LAN2)
  • others:
    • 2 Pin 1.27/1.25mm RTC battery input connector for low power RTC IC HYM8563TS
    • MASK button for eMMC update
    • one 5V Fan connector
  • Power supply: USB-C, support PD, 5V/9V/12V input
  • PCB: 8 Layer, 62x90x1.6mm
  • Ambient Operating Temperature: 0℃ to 70℃

3 Diagram, Layout and Dimension

3.1 Layout

NanoPi R5S Layout
  • 12-pin GPIO
Pin# GPIO SPI UART PWM POWER Description
1 VCC3V3_SYS 3.3V power output
2 VCC3V3_SYS 3.3V power output
3 GPIO3_C3 SPI1_CLK_M1 UART5_RX_M1 3.3V level
4 GND
5 GPIO3_C2 SPI1_MISOI_M1 UART5_TX_M1 3.3V level
6 GPIO3_A1 SPI1_CS0_M1 3.3V level
7 GPIO3_C1 SPI1_MOSI_M1 3.3V level
8 GND
9 GPIO4_C5 UART9_TX_M1 PWM12_M1 3.3V level
10 GPIO4_C6 UART9_RX_M1 PWM13_M1 3.3V level
11 GPIO3_C4 UART7_TX_M1 PWM14_M0 3.3V level
12 GPIO3_C5 UART7_RX_M1 PWM15_IR_M0 3.3V level
  • 2x8-pin SDIO/I2S
Pin# GPIO SD/MMC/SDIO I2S POWER Description
1 VCC5V0_SYS 5V power output
2 VCC5V0_SYS 5V power output
3 GPIO3_C6 SDMMC2_D0_M0 I2S1_MCLK_M1 1.8V level
4 GPIO3_C7 SDMMC2_D1_M0 I2S1_SCLK_TX_M1 1.8V level
5 GND
6 GND
7 GPIO3_D0 SDMMC2_D2_M0 I2S1_LRCK_TX_M1 1.8V level
8 GPIO3_D3 SDMMC2_CLK_M0 I2S1_SDI1_M1 1.8V level
9 GND
10 GND
11 GPIO3_D1 SDMMC2_D3_M0 I2S1_SDO0_M1 1.8V level
12 GPIO3_D2 SDMMC2_CMD_M0 I2S1_SDI0_M1 1.8V level
13 GND
14 GND
15 GPIO3_D5 SDMMC2_PWREN_M0 I2S1_SDI3_M1 1.8V level
16 GPIO3_D4 SDMMC2_DET_M0 I2S1_SDI2_M1 1.8V level
  • Debug UART Pin Spec
3.3V level signals, 1500000bps
Pin# Assignment Description
1 GND 0V
2 UART2DBG_TX output
3 UART2DBG_RX intput
  • USB Port
Each USB 3.0 port has 1.4A overcurrent protection.
  • RTC
RTC backup current is 0.25μA TYP (VDD =3.0V, TA =25℃).
Connector P/N: Molex 53398-0271

4 Get Started

4.1 Essentials You Need

Before starting to use your NanoPi-R5S get the following items ready

  • NanoPi-R5S
  • MicroSD Card/TF Card: Class 10 or Above, minimum 8GB SDHC
  • USB C PD Charger (10W & above)
  • A host computer running Ubuntu 18.04 64-bit system

4.2 TF Cards We Tested

To make your device boot and run fast we highly recommend you use a Class10 8GB SDHC TF card or a better one. The following cards are what we used in all our test cases presented here:

  • Sandisk MicroSDHC V30 32GB Extreme Pro (Developer choice)

SanDiskExtremePro

  • SanDisk 32GB High Endurance Video MicroSDHC Card with Adapter for Dash Cam and Home Monitoring Systems (High reliability)

SanDiskHighEndurance

  • SanDisk TF 8G Class10 Micro/SD High Speed TF card:

SanDisk microSD 8G

  • SanDisk TF128G MicroSDXC TF 128G Class10 48MB/S:

SanDisk microSD 128G

  • 川宇 8G C10 High Speed class10 micro SD card:

chuanyu microSD 8G

4.3 Configure parameters for serial port

Use the following serial parameters:

Baud rate 1500000
Data bit 8
Parity check None
Stop bit 1
Flow control None

4.4 Install OS

4.4.1 Flash to TF

Visit download link to download image files and utilities.

Image Files
rk3568-sd-friendlycore-focal-5.10-arm64-YYYYMMDD.img.gz 64-bit FriendlyCore Lite image file based on Ubuntu core 20.04 64bit, kernel version 5.10.y
rk3568-sd-friendlywrt-YYYYMMDD.img.gz FriendlyWrt image file, based on OpenWrt 22.03, kernel version 5.10.y
Flash Utility:
win32diskimager.rar Windows utility. Under Linux users can use "dd"

The detailed steps are as follows:

  • Get an 8G SDHC card and backup its data if necessary;
  • Download and extract the xxx.img.gz and win32diskimager;
  • Run the win32diskimager utility under Windows as administrator. On the utility's main window select your SD card's drive, the wanted image file and click on "write" to start flashing the SD card. Under Linux run "dd" to flash the rk3568-sd-OSNAME-YYYYMMDD.img file to your SD card;
  • Take out the SD and insert it to NanoPi-R5S's microSD card slot;
  • Power on NanoPi-R5S and it will be booted from your TF card;

4.4.2 Flash Image to eMMC

4.4.2.1 Method 1: Burn the image to eMMC on the web

Boot with a TF card flashed with FriendlyWrt OS, click the menu item: "System" -> "eMMC Tools", click the button "Select file", select the image file you want to flash.

Click on "Upload and Write" to start uploading and burning, as shown in the image below:
Friendlywrt-emmctools-en.jpg
When finished, please eject the SD card, the device will reboot and startup from eMMC,click the "Go to homepage" button when the system LED is blinking and the network LED lights up again.

4.4.2.2 Method 2: Using the GUI to burn the image to the eMMC

This method requires the connection of an HDMI monitor and a USB mouse, NanoPi-R5S need to boot from SD card, use EFlasher tool to burn image to eMMC.
Visit download link to download image files and utilities.

Image Files
rk3568-eflasher-friendlycore-lite-focal-5.10-arm64-YYYYMMDD.img.gz 64-bit FriendlyCore Lite image file based on Ubuntu core 20.04 64bit, kernel version 5.10.y
rk3568-eflasher-friendlywrt-YYYYMMDD.img.gz FriendlyWrt image file, based on OpenWrt 22.03, kernel version 5.10.y
Flash Utility:
win32diskimager.rar Windows utility. Under Linux users can use "dd"

Flash Image to eMMC with eflasher and SD card:

  • Get an 8G SDHC card and backup its data if necessary;
  • Download and extract the rk3568-eflasher-OSNAME-YYYYMMDD.img.gz and win32diskimager;
  • Run the win32diskimager utility under Windows as administrator. On the utility's main window select your SD card's drive, the wanted image file EFlasher and click on "write" to start flashing the SD card. Under Linux run "dd" to flash the rk3568-eflasher-OSNAME-YYYYMMDD.img file to your SD card;
  • Take out the SD and insert it to NanoPi-R5S's microSD card slot;
  • Power on NanoPi-R5S and it will be booted from your SD card and the EFlasher utility will be automatically launched, check the installation progress through the on-board LED lights:
Status SYS LED (Red) LAN LED(Green) WAN LED(Green)
Power on Long bright Off Off
OS startup Slow blinking Off Off
Installing OS to eMMC Fast blinking Off Off
Installation is complete Slow blinking Long bright Long bright
  • After installation is done turn off the board and take out the SD card from NanoPi-R5S, power on the board and it will be booted from eMMC;

4.4.3 Burn Raw file (or third-party image) to eMMC

1) Download any firmware with the file name eflasher from the netdisk, decompress it and burn it into the TF card;
2) Reinsert the TF card once, a disk named FriendlyARM will appear on the PC (Linux: FriendlyARM directory), copy the image file ending with .img or .gz into it;
3) Edit the eflasher.conf configuration file on the TF card, change the value after autoStart= to specify the name of your image file, for example:

autoStart=openwrt-rockchip-armv8_nanopi-ext4-sysupgrade.img.gz

4) Safely eject the TF card, place the TF card on the NanoPi-R5S and power it up, it will automatically burn your image file to emmc, the on-board LEDs will tell you the progress of the installation, refer to the previous section;

4.5 The Boot order between eMMC and SD card

By default, the system will be booted from the TF card first, but this is not the case under all conditions. This section will explain all situations in detail;

Refer to rockchip official document [1], there are two types of loader program:
1) U-Boot TPL/SPL (i.e. upsream U-Boot, also called mainline U-Boot)
2) Rockchip MiniLoader

Things to note:
1) FriendlyELEC's image uses Rockchip MiniLoader
2) The third-party image usually uses U-Boot TPL/SPL

The following situations will always start from eMMC:
If the system in the eMMC, or the system in the TF card uses the first Loader type U-Boot TPL/SPL, it will always boot from the eMMC;
If you want to boot from the TF card, there are the following methods:
Method 1: Clear the Loader on the eMMC, the clearing method is as follows, after starting from the eMMC, enter the following command on the command line to clear the Loader on the eMMC:

dd if=/dev/zero of=/dev/mmcblk0 bs=8M count=1

Method 2: Insert the TF card, Press Maskrom Key (or short-circuit the Maskrom contacts) and then power on (need to keep the short-circuit for about 3 seconds), it will start from the TF card

The summary is as follows:

eMMC current system TF card current system Boot priority
No system Any image TF card
FriendlyELEC's image FriendlyELEC's image TF card
FriendlyELEC's image Image with Mainline U-boot eMMC
Image with Mainline U-boot FriendlyELEC's image eMMC
Image with Mainline U-boot Image with Mainline U-boot eMMC

5 Work with FriendlyWrt

5.1 Introduction to FriendlyWrt

FriendlyWrt is a customized system made by FriendlyElec based on an OpenWrt distribution. It is open source and well suitable for developing IoT applications, NAS applications, smart home gateways etc.

5.2 First boot

For the first boot, the system needs to do the following initialization work:
1)Extended root file system
2)Initial setup(will execute /root/setup.sh)
So you need to wait for a while (about 2~3 minutes) to boot up for the first time, and then set FriendlyWrt, you can enter the ttyd terminal on the openwrt webpage, when the prompt is displayed as root@FriendlyWrt, it means the system has been initialized.

root@FriendlyWrt

5.3 Account & Password

The default password is password (empty password in some versions). Please set or change a safer password for web login and ssh login. It is recommended to complete this setting before connecting NanoPi-R5S to the Internet.

5.4 Network Connection

Use a network cable to connect NanoPi-R5S's WAN to a master router and the board will get an IP address via DHCP. Login into the router and check NanoPi-R5S's IP address.

5.5 Login FriendlyWrt

Connect the PC to the LAN port of NanoPi-R5S. If your PC without a built-in ethernet port, connect the LAN port of the wireless AP to the LAN port of NanoPi-R5S, and then connect your PC to the wireless AP via WiFi , Enter the following URL on your PC's browser to access the admin page:

The above is the LAN port address of NanoPi-R5S. The IP address of the WAN port will be dynamically obtained from your main router through DHCP.

5.6 Recommended security settings

The following settings are highly recommended to complete before connecting NanoPi-R5S to the Internet。

  • Set a secure password
  • Only allow access to ssh from lan, change the port
  • Only allow local devices to access luci

Edit /etc/config/uhttpd,Change the original 0.0.0.0 and [::] addresses to the local lan address, for example:

	# HTTP listen addresses, multiple allowed
	list listen_http	192.168.2.1:80
	list listen_http	[fd00:ab:cd::1]:80
 
	# HTTPS listen addresses, multiple allowed
	list listen_https	192.168.2.1:443
	list listen_https	[fd00:ab:cd::1]:443

Restart the service:

/etc/init.d/uhttpd restart
  • Check the firewall settings

By default, FriendlyWrt will set the WAN incoming traffic to ACCEPT, which is convenient for testing but reduces security, you can execute the following command to restore to the default settings of openwrt, the management page can only be accessed by devices connected to the lan port:

uci set firewall.@zone[1].input='REJECT'
uci set firewall.@zone[1].output='ACCEPT'
uci set firewall.@zone[1].forward='REJECT'
uci commit firewall
fw3 reload

5.7 Safe shutdown operation

Enter the ttyd terminal, enter the poweroff command and hit enter, wait until the led light is off, and then unplug the power supply.

5.8 Install Software Packages

5.8.1 Update Package List

Before install software packages update the package list:

$ opkg update

5.8.2 List Available Packages

$ opkg list

5.8.3 List Installed Packages

$ opkg list-installed

5.8.4 Install Packages

$ opkg install <package names>

5.8.5 Remove Packages

$ opkg remove <package names>

5.9 Disable IPv6

. /root/setup.sh
disable_ipv6
reboot

5.10 Some common issues of FriendlyWrt

  • Unable to dial up
    • Go to "Network" -> "Firewall" and set "Inbound Data", "Outbound Data" and "Forwarding" in "WAN Zone" to "Accept";
    • If you still cannot access the Internet, you can try to turn off IPV6;
  • Unable to power on
    • Try to replace the power adapter and cable. It is recommended to use a power supply with specifications above 5V/2A;
    • Note that some fast chargers with Type-C interface will have a delay, it may take a few seconds to start providing power;
  • When doing secondary routing, the computer cannot connect to the Internet
    • If your main network is IPv4, and NanoPi-R5S works in IPv6, the computer may not be able to connect to the Internet. It is recommended to turn off IPv6 (the method is described later in this WiKi), or switch the main route to IPv6;
  • If you have questions or have better suggestions, please send an email to techsupport@friendlyarm.com;

5.11 Use USB2LCD to view IP and temperature

Plug the USB2LCD module to the USB interface ofNanoPi-R5S and power on, the IP address and CPU temperature will be displayed on the LCD:
Xxx-usb2lcd-01.png

5.12 Work with USB WiFi Device

5.12.1 Check USB WiFi Device with Command Line Utility

(1) Click on "services>ttyd" to start the command line utility

(2) Make sure no USB devices are connected to your board and run the following command to check if any USB devices are connected or not

lsusb

(3) Connect a USB WiFi device to the board and run the command again

lsusb

You will see a new device is detected. In our test the device's ID was 0BDA:C811

(4) Type your device's ID (in our case it was "0BDA:C811" or "VID_0BDA&PID_C811") in a search engine and you may find a device that matches the ID. In our case the device we got was Realtek 8811CU.

5.12.2 Configure a USB WiFi Device as AP

(1) Connect a USB WiFi device to the NanoPi-R5S. We recommend you to use the following devices:
R2swrt+usbwifi-20210831.jpg
Note: devices that match these VID&PIDs would most likely work.
(2) Click on "System>Reboot" and reboot your NanoPi-R5S

(3) Click on "Network>Wireless" to enter the WiFi configuration page

(4) Click on "Edit" to edit the configuration

(5) On the "Interface Configuration" page you can set the WiFi mode and SSID, and then go to "Wireless Security" to change the password. By default the password is "password". After you make your changes click on "Save" to save

(6) After you change the settings you can use a smartphone or PC to search for WiFi

5.12.3 Common USB WiFi issues

1) It is recommended to plug in the usb wifi in the off state, then power it on, FriendlyWrt will automatically generate the configuration file /etc/config/wireless, if not, see if there is wlan0 by ifconfig -a, if there is no wlan0, usually there is no driver.
2) If ifconfig -a sees wlan0, but the hotspot is not working properly, try changing the channel and country code, an inappropriate country code can also cause the WiFi to not work.
3) Some USB WiFis (e.g. MTK MT7662) work in CD-ROM mode by default and need to be switched by usb_modeswitch, you can try to add usb_modeswitch configuration to the following directory: /etc/usb_modeswitch.d.

5.12.4 Change the default WiFi hotspot configuration

FriendlyWrt sets the country, hotspot name and other parameters for USB WiFi by default, with the aim of being as plug-and-play as possible, but this does not guarantee that all modules will be compatible with this setting, you can change these behaviors by modifying the following file:

/lib/wifi/mac80211.sh

5.13 Work with Docker Applications

5.13.1 Work with Docker: Install JellyFin

mkdir -p /jellyfin/config
mkdir -p /jellyfin/videos
docker run --restart=always -d -p 8096:8096 -v /jellyfin/config:/config -v /jellyfin/videos:/videos jellyfin/jellyfin:10.1.0-arm64 -name myjellyfin

After installation, visit port 8096 and here is what you would find:
FriendlyWrt+JerryFin

5.13.2 Work with Docker: Install Personal Nextcloud

mkdir /nextcloud -p
docker run -d -p 8888:80  --name nextcloud  -v /nextcloud/:/var/www/html/ --restart=always --privileged=true  arm64v8/nextcloud

After installtion, visit port 8888.

5.14 Mount smbfs

mount -t cifs //192.168.1.10/shared /movie -o username=xxx,password=yyy,file_mode=0644

5.15 Use sdk to compile the package

5.15.1 Install the compilation environment

Download and run the following script on 64-bit Ubuntu (version 18.04+): How to setup the Compiling Environment on Ubuntu bionic

5.15.2 Download and decompress sdk from the network disk

The sdk is located in the toolchain directory of the network disk:

tar xvf ~/dvd/RK3568/toolchain/friendlywrt-kernel-5.x.y/openwrt-sdk-22.03.0-rc1-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64.tar.xz
# If the path is too long, it will cause some package compilation errors, so change the directory name here
mv openwrt-sdk-22.03.0-rc1-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64 sdk
cd sdk
./scripts/feeds update -a
./scripts/feeds install -a

5.15.3 Compile the package

download the source code of the example (a total of 3 examples are example1, example2, example3), and copy to the package directory:

git clone https://github.com/mwarning/openwrt-examples.git
cp -rf openwrt-examples/example* package/
rm -rf openwrt-examples/

Then enter the configuration menu through the following command:

make menuconfig

In the menu, select the following packages we want to compile (actually selected by default):

"Utilities" => "example1"
"Utilities" => "example3"
"Network" => "VPN" => "example2"

execute the following commands to compile the three software packages:

make package/example1/compile V=99
make package/example2/compile V=99
make package/example3/compile V=99

After the compilation is successful, you can find the ipk file in the bin directory, as shown below:

$ find ./bin -name example*.ipk
./bin/packages/aarch64_cortex-a53/base/example2_0.1-1_aarch64_cortex-a53.ipk
./bin/packages/aarch64_cortex-a53/base/example3_0.1-1_aarch64_cortex-a53.ipk
./bin/packages/aarch64_cortex-a53/base/example1_0.1-1_aarch64_cortex-a53.ipk

5.15.4 Install the ipk to NanoPi

You can use the scp command to upload the ipk file to NanoPi:

cd ./bin/packages/aarch64_cortex-a53/base/
scp example*.ipk root@192.168.2.1:/root/

Then use the opkg command to install them:

cd /root/
opkg install example2_0.1-1_aarch64_cortex-a53.ipk
opkg install example3_0.1-1_aarch64_cortex-a53.ipk
opkg install example1_0.1-1_aarch64_cortex-a53.ipk

5.16 Compile u-boot,kernel or friendlywrt

6 Work with FriendlyCore

6.1 FriendlyCore User Account

  • Non-root User:
   User Name: pi
   Password: pi
  • Root:
   User Name: root
   Password: fa

6.2 Update Software Packages

$ sudo apt-get update

6.3 Setup Network Configurations

By default "eth0" is assigned an IP address obtained via dhcp. If you want to change the setting you need to change the following file:

vi /etc/network/interfaces.d/eth0

For example if you want to assign a static IP to it you can run the following commands:

auto eth0
iface eth0 inet static
    address 192.168.1.231
    netmask 255.255.255.0
    gateway 192.168.1.1

You also need to modify the following file to add the DNS configuration:

vi /etc/systemd/resolved.conf

例如设置为192.168.1.1:

[Resolve]
DNS=192.168.1.1

Restart the systemd-resolved service with the following command:

sudo systemctl restart systemd-resolved.service
sudo systemctl enable systemd-resolved.service

To change the setting of "eth1" you can add a new file similar to eth0's configuration file under the /etc/network/interfaces.d/ directory.

6.4 Install the kernel-header package

sudo dpkg -i /opt/linux-headers-*.deb



7 Config status LEDs=

Put the following into the autorun script to associate the status leds with the ethernet interface, and you can configure it to behave in other ways by referring to these content:

echo netdev > /sys/class/leds/wan_led/trigger
echo eth0 > /sys/class/leds/wan_led/device_name
echo 1 > /sys/class/leds/wan_led/link
 
echo netdev > /sys/class/leds/lan1_led/trigger
echo eth1 > /sys/class/leds/lan1_led/device_name
echo 1 > /sys/class/leds/lan1_led/link
 
echo netdev > /sys/class/leds/lan2_led/trigger
echo eth2 > /sys/class/leds/lan2_led/device_name
echo 1 > /sys/class/leds/lan2_led/link

8 Compile FriendlyWrt

8.1 Download Code

mkdir friendlywrt-rk3568
cd friendlywrt-rk3568
repo init -u https://github.com/friendlyarm/friendlywrt_manifests -b master-v22.03 \
        -m rk3568.xml --repo-url=https://github.com/friendlyarm/repo  --no-clone-bundle
repo sync -c  --no-clone-bundle

8.2 1-key Compile

./build.sh nanopi_r5s.mk

All the components (including u-boot, kernel, and friendlywrt) are compiled and the sd card image will be generated, then execute the following command to generate the image file for installing the system into the emmc:

./build.sh emmc-img

9 Make Your Own OS Image

10 Link to Rockchip Resources

11 Schematic, PCB CAD File

  • Schematic: []
  • PCB CAD File:[]


12 Update Logs

12.1 2022-05-16

Initial Release