4001 R3S 4G EN

来自Mcuzone Wiki
(重定向自4001 R3S 4G (EN)

切换语言为中文

Keywords

FriendlyElec NanoPi R3S、RK3566、4G LTE、FriendlyWrt、OpenWrt、Ubuntu

I. Introduction

The 4G module for the R3S is a 4G LTE kit designed specifically for the FriendlyElec NanoPi R3S development board. It is based on our CM4 4G mini (Qualcomm 4G LTE) module, around which we have designed a 4G carrier board for the R3S along with a matching 3D-printed base to compose the set. The 3D printed base is designed to replace the R3S enclosure base and incorporates an integrated 4G antenna. The 4G module is supported out-of-the-box by the official Friendly firmware, with automatic detection and no need for additional driver installation.

The 4G module is a USB device that connects to the USB port of the R3S. For customers who have purchased an integrated kit that includes both a 4G module and an R3S from our company, we can assist with modifications if required. The modification involves transforming the USB cable of the 4G module to be fully internal, eliminating the need for a USB adapter board. However, after this modification, the USB port on the R3S will no longer be able to connect to any other USB devices.

4001_Friendly_NanoPi_R3S_47.jpg

4001_Friendly_NanoPi_R3S_48.jpg

4001_Friendly_NanoPi_R3S_130.jpg

II. Work with FriendlyWrt

The R3S development board comes in two versions: one without eMMC (which requires the system to be booted from a TF card), and another with eMMC (which allows the system to be booted either from the eMMC or from a TF card). All demonstrations in this document use the version that boots the system from a TF card. Different boot methods require corresponding different firmware packages. Please ensure that you match the correct firmware package to your boot method.

The version of the FriendlyElec system we tested: rk3566-sd-friendlywrt-23.05-20240826.img.gz

The 4G module is used as a WAN port in the FriendlyWrt system. Connect the R3S's LAN port to the PC's network port using an Ethernet cable. Open a web browser on the PC and navigate to 192.168.2.1 to log in to the FriendlyWrt system backend page (the default username is root and the password is password).

2.1 Test 4G module

Navigate to Services - Terminal", log in to the terminal with the default username: root and password: password:

4001_Friendly_NanoPi_R3S_108.jpg

4001_Friendly_NanoPi_R3S_109.jpg

Execute ip addr, and the result is as follows:

4001_Friendly_NanoPi_R3S_36.jpg

You can see usb0, which is our CM4 Qualcomm 4G LTE module. This indicates that the system has recognized the 4G module, but it has not yet obtained an IP address.

To use the 4G module for internet access, you need to add a 4G interface. The steps are as follows:

Navigate to "Network - Interfaces", and click on "Add new interface...":

4001_Friendly_NanoPi_R3S_110.jpg

Configure as shown in the figure below (the "Name" can be customized), select "usb0" for the "Device", and then click "Create interface":

4001_Friendly_NanoPi_R3S_111.jpg

Click on "Firewall Settings", in the "Create / Assign firewall-zone" section, select "wan", and then click "Save":

4001_Friendly_NanoPi_R3S_112.jpg

It automatically returns to the "Interfaces" page, then click "Save and Apply":

4001_Friendly_NanoPi_R3S_113.jpg

Wait for a moment, and we can see that the 4G module has obtained an IP address:

4001_Friendly_NanoPi_R3S_114.jpg

Back in the terminal, execute ifconfig usb0 to check the network parameters of the 4G module:

4001_Friendly_NanoPi_R3S_42.jpg

A successful ping to the domain indicates that the 4G module is now able to browse the internet normally:

4001_Friendly_NanoPi_R3S_43.jpg

4G Module internet speed test:

4001_Friendly_NanoPi_R3S_02.jpg

Note: Network speed testing is affected by the network environment and the testing method. The speed provided here is for reference only, please refer to the actual speed for accurate information.

2.2 R3S with an external USB network adapter

The R3S comes equipped with two Ethernet ports. If a third Ethernet port is required, it can be added through the USB 3.0 port; however, this will disable the 4G functionality. We have tested that the R3S supports USB wired network adapters with the RTL8153 chipset, which can be used as a second LAN port. The procedure is as follows:

Do not connect the USB wired network adapter first, let the system boot up normally and log in to the backend page.

Insert the USB Ethernet adapter, wait for a moment, and then run ifconfig -a in the terminal. Once eth2 appears in the output, it is ready:

4001_Friendly_NanoPi_R3S_115.jpg

Then navigate to "Network - Interfaces - Devices", and click "Configure..." behind "br-lan":

4001_Friendly_NanoPi_R3S_116.jpg

Click the arrow next to "Bridge ports", select both eth1 and eth2, and then click "Save":

4001_Friendly_NanoPi_R3S_117.jpg

After saving, return to the previous page and click "Save and Apply":

4001_Friendly_NanoPi_R3S_118.jpg

This sets the newly added USB Ethernet adapter as a LAN port, while the original built-in LAN port can still be used normally.

2.3 R3S with an external USB WiFi

The R3S has only one USB port, which can be used to connect an external USB WiFi adapter; however, in this case, the 4G functionality will not be available. For example, using an external RTL8812 USB wireless adapter:

4001_Friendly_NanoPi_R3S_119.jpg

4001_Friendly_NanoPi_R3S_120.jpg

4001_Friendly_NanoPi_R3S_121.jpg

4001_Friendly_NanoPi_R3S_122.jpg

Note: Connecting to the internet via a wireless network adapter can be unstable, and there might be an issue with not being able to find the AP.

2.4 Other operations in FriendlyWrt

2.4.1 Adblock

4001_Friendly_NanoPi_R3S_123.jpg

2.4.2 Statistics

Such as temperature control statistics, processor statistics, etc.:

4001_Friendly_NanoPi_R3S_124.jpg

4001_Friendly_NanoPi_R3S_125.jpg

III. Work with Ubuntu OS

The R3S development board comes in two versions: one without eMMC (which requires the system to be booted from a TF card), and another with eMMC (which allows the system to be booted either from the eMMC or from a TF card). All demonstrations in this document use the version that boots the system from a TF card. Different boot methods require corresponding different firmware packages. Please ensure that you match the correct firmware package to your boot method.

3.1 Test the 4G module

Flash the Ubuntu system (command-line version, without a GUI) to the TF card.

The version of the FriendlyElec system we tested: rk3566-sd-ubuntu-noble-core-6.1-arm64-20241114.img.gz

Connect the LAN port of the R3S to the upstream router using an Ethernet cable, then connect the PC to the same upstream router. Insert the SIM card and the TF card with the pre-installed system into the R3S. After the system boots, check the IP address of the R3S through the router's backend. In this document, the address obtained by the system is: 192.168.8.35.

Download and install the terminal software MobaXterm on your PC. The download link for MobaXterm is:

https://mobaxterm.mobatek.net/download-home-edition.html

Then use MobaXterm to connect to the system via SSH (username: root, password: fa):

4001_Friendly_NanoPi_R3S_27.jpg

4001_Friendly_NanoPi_R3S_28.jpg

Excecute ifconfig -a to view the following network parameters:

4001_Friendly_NanoPi_R3S_29.jpg

eth0 is the WAN port of the R3S, and since it is not connected to a network cable, it does not have an IP address.

eth1 is the LAN port of the R3S, connected to the upstream router, and it has correctly obtained an IP address.

usb0 is the 4G module, which has correctly obtained an IP address.

Execute route to view the routing table. Since usb0 is listed first, it indicates that the internet connection is currently through the 4G module:

4001_Friendly_NanoPi_R3S_30.jpg

At this point, when we ping the IP address and the domain name, both are successful, indicating that the 4G module is working properly:

4001_Friendly_NanoPi_R3S_31.jpg

3.2 Modification of Network Priority

The Ubuntu system on the R3S, prioritizes connecting to the internet through the 4G network by default,.

If you want to prioritize the wired network for internet access, you can execute the following command:

sudo ip route del default && sudo route add -net default netmask 0.0.0.0 gw 192.168.8.1

Explanation of these two commands (separated by '&&'):

sudo ip route del default: Remove the default route from the routing table.

sudo route add -net default netmask 0.0.0.0 gw 192.168.8.1: Add the gateway of the wired network as a new default route (ensure to use the actual gateway address).

After completing the execution, execute the route command to view the routing table. The current default route is the gateway of the wired network (eth1 is listed first):

4001_Friendly_NanoPi_R3S_32.jpg

This way, the network will default to using the wired connection. If you need to switch back to defaulting to the 4G network, please execute the following command:

sudo ip route del default && sudo route add -net default netmask 0.0.0.0 gw 192.168.225.1

Or, you can restart the system.

Note that 192.168.225.1 is the default gateway for the 4G module; please refer to the actual configuration.

Note: After a reboot, the routing table resets. To ensure the network continues to use the wired or wireless connection as the default route post-restart, you'll need to execute sudo ip route del default && sudo route add -net default netmask 0.0.0.0 gw 192.168.8.1 again.

3.3 AT command operation

Please install usbutils first:

apt install usbutils

Use lsusb to view USB devices, the red-boxed entry indicates the 4G module:

4001_Friendly_NanoPi_R3S_33.jpg

Note down the ID value of the 4G module: 05c6 90b6.

Use the following command to enable the ttyUSB serial port of the 4G module, where the value after echo is the ID value recorded earlier:

modprobe option

sh -c 'echo 05c6 90b6 > /sys/bus/usb-serial/drivers/option1/new_id'

After executing the above two commands, execute the following:

ls /dev

At this point, you should be able to see three devices under the dev directory: ttyUSB0, ttyUSB1, ttyUSB2.

4001_Friendly_NanoPi_R3S_34.jpg

Install the serial port software minicom:

apt install minicom

Open the AT command serial port using minicom:

minicom -D /dev/ttyUSB0

(Note: Which serial port to use should be determined by the ability to enter and execute AT commands without garbled or erratic output after accessing that serial port.)

If you need to view echo responses, type the command: ate1, then press Enter. You can continue to type other commands, and after pressing Enter, you will see the results.

4001_Friendly_NanoPi_R3S_35.jpg

Common AT commands:

1) Check if the SIM card is detected:

at+cpin?

Return ready to indicate the card has been recognized, if return error, you need to check the hardware.

2) Check antenna signal quality:

at+csq

eturn values between 26 and 31 indicate a good signal, with 31 representing a full signal strength; return values between 20 and 25 indicate a barely acceptable signal; return values below 20 indicate a poor signal or that the antenna might not be connected.

3) Check network registration status:

at+cops?

Normally, it should return the network supporter's code: 7, where 7 represents 4G.

Note: The above command at+csq should not include a question mark, while the other two commands require a question mark.

4) View the SIM card's IMEI code:

at+cgsn

5) Reset 4G module (Sometimes, if you reinsert the SIM card, hot swapping may not work; in such cases, you can use this reset command to reset the module.):

at+reset

6) Disable radio frequency:

at+cfun=0

Enable radio frequency:

at+cfun=1

The two commands mentioned above can be used in pairs to allow the module to re-register with the network without restarting the 4G module.

3.4 Modify the IP address of the 4G module

If the default 4G IP address assigned at the factory conflicts with the IP address being used by the user, or if there is a need to modify the IP address, you can change the 4G module's IP to directly obtain a public IP. Please execute the AT command:

Set the 4G module's IP to directly obtain a public IP. Please execute the AT command:

Set the IP to public: AT+GTIPPASS=1

Set the IP to private: AT+GTIPPASS=0

Check whether the current IP is a public or private IP:AT+GTIPPASS?

After modifying the IP, a power cycle reboot is required for the changes to take effect.

IV. Summary

We only introduce the usage and operations for 4G module based on NanoPi R3S, without covering the operations and software system specific to the NanoPi R3S development board itself. For information about the NanoPi R3S boards, please visit the FriendlyElec official website:

https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R3S/zh

Contact Us

0001_x.jpg 0002_fb.jpg 0004_ytb.jpg 0003_bb.jpg 0005_qq.jpg QQ:8204136

Email: mcuzone@vip.qq.com

Tel: +86(0)13957118045

If there are any omissions, errors, or infringements on this page, please contact us through the above methods. Thank you!

Copyright 2004-2025 Wildchip

T