Template: RM500U-CN 5G HAT Spec

From Waveshare Wiki
Jump to: navigation, search

Working With Windows

Install Drivers

  • After connecting the RM500U-CN 5G HAT to the computer through a double-ended usb3.0 data cable, there will be a series of devices without drivers installed on other devices:

RM500U-driver-manager.png

  • Download the driver to your computer and unzip the compressed package.
  • Enter the RM500U_Driver directory.
  • Click setup.exe to install the driver. After the installation is complete, the device manager will generate the following devices:

RM500U-driver-finish.png

Common AT Commands

EM25X, EM06E and RM50X series 4G/5G module support AT command control, some basic AT commands are shown in the table below:

RM500U AT LOG.png
Command Description Return Value
AT AT test command OK
ATE ATE1 sets echo
ATE0 turns off echo
OK
AT+CGMI Query module manufacture OK
AT+CGMM Query module model OK
AT+CGSN Query product serial number OK
AT+CSUB Query module version and chip OK
AT+CGMR Query the firmware version serial number OK
AT+IPR? Set the module hardware serial port baud rate +IPREX:
OK
AT+CFUN=1,1 Reset module OK
AT+QUIMSLOT? Query SIM card selection:
Return 1, select SIM card 1;
Return 2, select SIM card 2
+QUIMSLOT: 1/2
OK
AT+CPIN? Query the status of the SIM card and return READY, indicating that the SIM card can be recognized normally +CPIN: READY
AT+COPS? Query the current operator, the operator information will be returned after normal networking +COPS:
OK
AT+C5GREG? Query 5G network registration status +C5GREG:
OK
AT+QENG="servingcell" Query UE system information
AT+CNMP Network mode selection command:
"mode_pref":Automatic
"nr5g_band" : 5G NR
"lte_band":LTE only
"gw_band":WCDMA only
... ....
OK


SIM Card Selection

Dual SIM Card Switching

The 5G HAT has two SIM card slots onboard, a dual SIM card, and single standby, which can be switched and enabled by AT command.

  • SIM card 1 is selected by default, You can use the following command to query and confirm:
AT+QUIMSLOT?
  • To switch SIM card 2, please use the following command:
AT+QUIMSLOT=2
  • Switch back to SIM card 1, please use the following command:
AT+QUIMSLOT=1
  • Check whether the corresponding card slot recognizes the SIM card:
AT+CPIN?
RM500U-CN and RM500Q-GL support Dual SIMs, but RM500Q-AE and RM502Q-AE modules do not support dual SIM cards.

RNDIS Dial-up Internet Access

  • Download and install the driver.
  • Open the RM50X AT port and send the following commands to dial up the Internet:
AT+CPIN?
AT+QCFG="usbnet",3
AT+QNETDEVCTL=2,3,1
AT+CFUN=1,1
  • And then you can find that there are some unrecognized devices in the Device Manager on the computer, such as RNDIS (with an exclamation mark).
  • Right-click the 'RNDIS', search "Update Divers" and select "Let me pick from a list of available drivers on my computer", then select "Network adapters" from the device list.
  • Select "Microsoft" in the manufacturer list of the Network adapters window, and then select "Remote NDIS Compatible Device" in the list on the right, which is the remote NDIS compatible device.
  • Click 'Next' and wait for the installation to finish, the RNDIS Kitl device will be installed successfully.
  • If it cannot connect to the network, please set it to obtain the IP automatically.

RNDIS Dial-up08.png

Network Speed Test

RM50XQ Network Speed Test
  • Install speed testing software, such as Internet speed manager and other speed testing software, you can choose to download the speed test at www.speedtest.cn/pc/download.

About the speed testing

As there will be many inconsistencies between actual and laboratory conditions that will result in 5G speeds that are not ideally stable at 100MBPS, there are the following.

  • Base station distance, the closer to the 5G base station the better the signal and the faster the speed.
  • Base station load, the fewer people using it the faster it will be, and the slower it will be during peak commuting periods.
  • Number of base stations: due to the spectrum, an equal amount of 4G coverage requires double the number of 5G base stations.
  • Operator: you need to confirm your 5G card, and whether the speed is limited, you can regularly ask the operator to reset your network.
  • Indoor is worse than outdoor: building penetration attenuation, and indoor bypass attenuation.

PS: The current number of base stations still does not have good coverage, and the speed measurement is not quite the same in different locations.

Working with Raspberry Pi

RM500U is based on the Zhanrui platform, and the dial-up Internet access in the Raspbian system of the Raspberry Pi is unstable; it is recommended to use Openwrt, Ubuntu and other mainstream Linux systems.

Ubuntu System Use

 sudo apt-get install screenfetch
 screen fetch
 uname -r

800px-RM500U ubuntu uname.png

The USB device descriptor needs to be loaded for the first use

In order to identify a module, the module's VID and PID needs to be added to the file [kernel].

  • Check the VID and PID of RM500U.
 lsusb

RM500U ubuntu lsusb.png

  • Install gcc and make tools
 sudo apt-get install gcc
 sudo apt-get install make
  • Add VID and PID:

Method 1:

sudo su
sudo modprobe option
sudo sh -c 'echo "2c7c 0900" > /sys/bus/usb-serial/drivers/option1/new_id'
sudo su
sudo echo 2c7c 0900 > /sys/bus/usb-serial/drivers/generic/new_id

Method 2:

wget https://files.waveshare.com/upload/9/9e/RM500U_FOR_RPI_Ubuntu22.04.zip
unzip RM500U_FOR_RPI_Ubuntu22.04.zip
sudo chmod 777 -R RM500U_FOR_RPI_Ubuntu22.04
cd RM500U_FOR_RPI_Ubuntu22.04
sudo ./install.sh

RNDIS Dial-up

  • Open minicom:
 sudo apt-get install minicom
 sudo minicom -D /dev/ttyUSB2
  • Send the following commands in minicom for ECM dialing:
 AT+CPIN?
 AT+QENG="serving cell"
 AT+QCFG="usbnet",1
 AT+QNETDEVCTL=2,3,1
 AT+CFUN=1,1

RM500U RNDIS DIAL.png

  • After configuring the ECM mode, CTRL+A -> X -> Yes to exit minicom.
  • Use the following commands to get IP and set DNS:
 sudo dhclient -v enxe2f1fbfdd5e7
 sudo apt-get install udhcpc
 sudo udhcpc -i enxe2f1fbfdd5e7
 sudo route add -net 0.0.0.0 enxe2f1fbfdd5e7
  • After dialing, the Raspberry Pi can see that enxe2f1fbfdd5e7 has obtained the IP through the following command (different systems are different, so the actual obtained IP shall prevail):
 ifconfig

RM500U ubuntu ifconfig.png

  • Test enxe2f1fbfdd5e7 network status:
  ping -I enxe2f1fbfdd5e7 www.baidu.com

RM500U ubuntu ping.png

Working with Raspbian System

wget https://files.waveshare.com/upload/d/d3/RM500U_for_RPI.zip
unzip RM500U_for_RPI.zip
sudo chmod 777 -R RM500U_for_RPI
cd RM500U_for_RPI
sudo ./install.sh

If it is a Raspibian version of the Raspberry Pi after 2022-04-04, use the following command:

sudo apt-get install unzip
wget https://files.waveshare.com/upload/d/d3/RM500U_for_RPI.zip
unzip RM500U_FOR_RPI.zip
sudo chmod 777 -R RM500U_FOR_RPI
cd RM500U_FOR_RPI
sudo ./install.sh

If you don't know the date of the Raspberry Pi system version, you can use the following command to get it:

  cat /etc/rpi-issue
Please do not delete or modify the "option", "default.script", "install.sh" directory files, otherwise it will affect the loading of the device descriptor!
  • After successfully adding the PID and restarting the Raspberry Pi, enter the following command in the command line interface, and five device descriptors USB0-UBS4 will appear:
ls /dev/ttyUSB*

RM500U ubuntu ttyUSB.png

RNDIS Dial-up Internet

  • Open minicom.
sudo apt-get install minicom
sudo minicom -D /dev/ttyUSB2
  • Send the following command RNDIS dial in minicom:
AT+QCFG="nat",1
AT+CPIN?
AT+QENG="servingcell"
AT+QCFG="usbnet",3
AT+QNETDEVCTL=2,3,1
AT+CFUN=1,1

RM500U RNDIS DIAL.png

Raspberry Pi Serial Port Enable

Since the Raspberry Pi serial port is used for terminal debugging by default, if you need to use the serial port, you need to modify the Raspberry Pi settings. Execute the following command to enter the Raspberry Pi configuration:

sudo raspi-config

Select Interfacing Options ->Serial ->NO ->YES to disable serial debugging.
Serial port.png
Open the /boot/config.txt file, and find the following configuration statement to enable the serial port, if not, add it at the end of the file:

enable_uart=1

Restart to take effect:

1. Insert the module into the Raspberry Pi, and turn the S_TX and S_RX of the DIP switch to ON:
Minicom-serial.png
2. Install minicom, minicom is a serial debugging tool for the Linux platform:

sudo apt-get install minicom

3. Open ttyS0 through minicom——ttyS0 is the serial port of Raspberry Pi 3B/3B+/4B, the default baud rate is 115200;

sudo minicom -D /dev/ttyS0

4. For Raspberry Pi 2B/zero, the user serial device number is ttyAMA0; you can use the following command line to confirm, serial0 is the selected serial device number, as shown below:
RM500U-CN 5G HAT 9.png

OpenWrt

Introduction

Soft routing is using desktops or servers and other equipment with software. It mainly depends on the settings of the software to achieve the functions of the router. The hard routing is a unique hardware device, including a processor, power supply, and embedded software to provide router functionality.
OpenWrt is a very popular soft routing system. It is a highly modular and highly automated embedded Linux system with powerful network components and scalability. It is often used in industrial control equipment, routers, and other equipment.
In addition to the functions of general home routers, OpenWrt soft routing can also achieve port forwarding, intranet penetration, 4G networking, FTP server, and more powerful functions.

Burn the image

Download the RPI OpenWrt system, unzip the system in the Imgs directory, and use the burning tool to burn the system to the SD card.

Login and initial settings

  • After the OpenWrt system is turned on, the Raspberry Pi is equivalent to a router. Therefore, use a network cable to connect the Raspberry Pi to the computer according to the use of the router (you can also use the mobile phone to search for WIFI, the default name is "OpenWrt").
  • You can set the language to auto first.
SIM820x OpenWrt(EN) (1).png
  • Enter 192.168.1.1 on the web page, the default user name: root, and the default password: password, enter the OpenWrt web management interface.
SIM820x OpenWrt(EN) (2).png
  • Set WIFI password: Network —> Wireless —> interface configuration —> Wireless security.
SIM820X OpenWrt01.png
  • Create the new interface: Network -> Interface -> Create interface.
  • Modify the IPv4 address of the LAN port to a different IP that is not the same as the LAN port IP of other routers in your home. (Many routers default the LAN port IP to 192.168.1.1. If you do not modify the IP of the OpenWrt, it will easily lead to conflicts and failure to connect to the Internet).

If necessary, it is also recommended to disable the IPv6 allocation length. After the modification is completed, click "Save & Apply", and re-use 192.168.10.1 to access the OpenWrt console.

SIM820x OpenWrt(EN) (3).png
  • In addition, it is recommended to adjust the Firewall setting to connect the OpenWrt terminal and Web management interface through the local area.

Network —> Firewall, change all "reject" to "accept", and click "Save & Apply" after modification, as shown in the picture below:

SIM820x OpenWrt(EN) (4).png
  • And then select System -> Administration, modify the allowed interface for SSH access to "unspecified" (that is, any interface can be accessed by ssh), check the Gateway port, and click "Save & Apply" after the modification is completed.
SIM820X OpenWrt02.png

At this point, you can connect to the OpenWrt web management interface or terminal through the IP address of the LAN port or wan port.

Configure networking

  • Insert the SIM card into the slot of the communication module -> All 5G antennas are connected, after connecting to the Raspberry Pi 4B via USB -> Power on;
  • Change the mobile communication module to RNDIS mode (USB network sharing mode), which can be changed in Openwrt by sending the following command via minicom:
sh -c 'echo "2c7c 0900" > /sys/bus/usb-serial/drivers/option1/new_id'
sudo minicom -D /dev/ttyUSB2    
AT+QENG="servingcell"
AT+QCFG="usbnet",3
AT+QNETDEVCTL=2,3,1
To switch ECM mode, use this command:
AT+QCFG="usbnet",1
  • Add new interface: Network -> Interfaces -> Add New Interface.

OpenWrt SIM8202G 1.png

  • Create new interface: name of new interface - SIM8202G; protocol of new interface - DHCP client; include the following interfaces - ethernet adapter: "usb0"; submit.

OpenWrt SIM8202G 2.png

  • Configuration interface: Firewall settings - wan; save & apply.

OpenWrt SIM8202G 3.png

  • Wireless configuration: Network -> Wireless -> Modify -> Interface Configuration -> Basic Settings -> Check SIM8202G (Defined by yourself) and lan in Network; Save & Apply.

OpenWrt SIM8202G 4.pngOpenWrt SIM8202G 5.png

Working with Jetson Nano

Hardware Connection

Connect the RM500U-CN with a double-ended usb3.0 data cable, and connect an external 5V power supply to the Type-C power supply port of the RM500U-CN 5G HAT, as shown in the figure:
RM500U-jetson.png

Load USB Device Descriptor

In order to identify the module, the module's VID and PID information needs to be added to the file [kernel].

  • View VID and PID of RM500U:
lsusb

Usb-load.png
Added VID sum PID

sudo apt-get install unzip
wget https://files.waveshare.com/upload/9/93/RM500U_CN_For_Jetson_nano.zip
unzip RM500U_CN_For_Jetson_nano.zip
sudo chmod 777 -R RM500U_CN_For_Jetson_nano
cd RM500U_CN_For_Jetson_nano
sudo ./install.sh
sudo reboot
Please do not delete or modify the four directory files of option directory, default.script and install.sh, otherwise it will affect the loading of device descriptors!

After successfully adding the PID and restarting Jetson nano, enter the following command in the command line interface to display five device symbols USB0-USB4.

ls /dev/ttyUSB*

Jetson-nano-vid.png

RNDIS

  • Enable minicom.
sudo apt-get install minicom
sudo minicom -D /dev/ttyUSB2
  • Send the following command ECM in minicom.
AT+CPIN?
AT+QCFG="usbnet",3
AT+QNETDEVCTL=2,3,1
AT+CFUN=1,1

Rndis-dial.png
After the module restarts and the NET light is on, use the following command to check the network status (optional).

AT+QENG="servingcell"

Get the IP and set the DNS with the following commands:

sudo dhclient -v usb1
sudo apt-get install udhcpc
sudo udhcpc -i usb1
sudo route add -net 0.0.0.0 usb1

After dialing, you can see that usb1 gets the IP through the following command:

ip route

Ip-route.png
Test usb1 networking status.

 ping -I usb1 www.baidu.com

Ip-route2.png