Template: RM50X Raspberry Pi User Manual

From Waveshare Wiki
Jump to: navigation, search

Working with Raspberry Pi

Hardware Connection

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

Raspberry Pi Pi 4B Pi 3B/3B+ CM4-IO-BASE
USB adapter USB3.0 adapter USB2.0 adapter USB3.0 adapter
Connection M.2-To-4G-5G-HAT-CM4.jpg M.2-To-4G-5G-HAT-Pi3B.jpg M.2-To-4G-5G-HAT-CM4.jpg
Note
It is recommended to connect an external 5V power supply at the arrow.

If it is used for PI4B, there is a matching case, and the installation diagram is as follows:

The use of Raspberry Pi OS

This configuration is only needed for the first time.

Please download the newest Raspberry Pi OS, All the settings are based on Kernel 5.5, if you use the old version, please update first. Make sure your Kernel version is up-to-date, or else you may face issues with the driver.

5G ECM Mode Dial-up

Step 1. Uninstall Modem Manager and Network Manager

Open a terminal and run the following commands to uninstall Modem Manager and Network Manager:

sudo apt purge modemmanager -y
sudo apt purge network-manager -y

Step 2. Test 5G Module

  • Driver Testing:
    Make sure the option USB-serial driver is properly loaded to the module interfaces. Check it with the usb-devices command.
pi@raspberrypi:~ $ usb-devices
T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=5000 MxCh= 0
D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
P:  Vendor=2c7c ProdID=0800 Rev=04.14
S:  Manufacturer=Quectel
S:  Product=RM502Q-AE
S:  SerialNumber=377628d2
C:  #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=896mA
I:  If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
  • Execute ls /dev/ttyUSB*, check if ttyUSB0~ttyUSB4 are recognized correctly.
  • Testing with AT command:
sudo apt-get install minicom
sudo minicom -D /dev/ttyUSB2
Welcome to minicom 2.7.1

OPTIONS: I18n 
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyUSB2

Press CTRL-A Z for help on special keys

AT
OK

Step 3. Networking Setup with AT Commands

AT+QCFG="usbnet",1
AT+CGDCONT=1,"IPV4V6","YOUR_APN" 
AT+CFUN=1,1

Wait for the modem to boot again. It may take 30 seconds. Once the modem reboots, the minicom will be activated again.

After the reboot, open a new Linux terminal and check for usbX in the network interface using ifconfig or ipaddr commands.

RM500U RNDIS DIAL.png

  • After rebooting the module, the NET indicator is on, and you can use the following commands to check the network. (Optional)
AT+QENG="servingcell"
  • Use the following commands to get the IP and set up the DNS:
sudo dhclient -v usb0
sudo apt-get install udhcpc
sudo udhcpc -i usb0
sudo route add -net 0.0.0.0 usb0

Step 4. Test 5G Network

After dialing, the Raspberry Pi can see usb0 get the ip by the following command, enter the command ifconfig usb0 or ifconfig.

  • Now check the assigned IP address and test the connection.
ifconfig usb0
pi@raspberrypi:~ $ ifconfig usb0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.225.60  netmask 255.255.255.0  broadcast 192.168.225.255
        inet6 fe80::8543:f6a0:e678:2e20  prefixlen 64  scopeid 0x20
        ether 4a:aa:f8:62:36:bb  txqueuelen 1000  (Ethernet)
        RX packets 73  bytes 5047 (4.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 100  bytes 15116 (14.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RM500U-net-card.png

 ping waveshare.com -I usb0 
pi@raspberrypi:~ $ ping waveshare.com -I usb0
PING waveshare.com (104.26.11.134) from 192.168.10.27 usb0: 56(84) bytes of data.
64 bytes from 104.26.11.134 (104.26.11.134): icmp_seq=1 ttl=52 time=87 ms
64 bytes from 104.26.11.134 (104.26.11.134): icmp_seq=2 ttl=52 time=82 ms
64 bytes from 104.26.11.134 (104.26.11.134): icmp_seq=3 ttl=52 time=92 ms
64 bytes from 104.26.11.134 (104.26.11.134): icmp_seq=4 ttl=52 time=73 ms
64 bytes from 104.26.11.134 (104.26.11.134): icmp_seq=5 ttl=52 time=75 ms

Troubleshooting

Check if the module detects SIM:

AT+CPIN? # Should return READY

Check if the module is registered to the network:

AT+CEREG? # Should return 0,1 or 0,5

Check if the APN is correct and has an IP: AT+CGCONTRDP?

AT+CGCONTRDP # Should return APN details and IP address.

5G Network Speed Test

In the Linux system, you can install speedtest_cli to test:

## Raspberry Pi OS
sudo apt install speedtest-cli
speedtest      # or use speedtest_cli

or

## OpenWRT
opkg update   
opkg install python3
opkg install python3-pip
pip install speedtest_cli 
speedtest      # or use speedtest_cli