title
| title |
|---|
| Setting up a COTS UE based on the UP Squared Pro board and Quectel RM520N-GL module |
This protocol enables to setup a 5G UE for use with NR SA up to 100MHz band n77/78 OAI based gNBs. It is provided for the information of the reader without any warranty.
Supported Devices
This protocol is intended for use with the following devices:
- As a host board: An UP Squared Pro with Intel® Pentium® N4200, 8GB of memory and 64 GB of on-board storage.
- As 5G COTS module: A Quectel RM520N-GL with firmware revision RM520NGLAAR03A03M4G.
We provide in section TODO a way to check the firmware revision with an AT command. - A SIM card with nano form-factor and properly registered in the core network you intend to use.
Operating system
Install a standard basic Ubuntu Server 24.04 LTS on the system.
Add a network connection during system installation or afterward in order to later install a few required packages.
End users of the UE need sudo right.
After installing the system, modify the default system setting of network rmem to enable throughput above 900Mbps with 5G:
echo "net.core.rmem_max = 62500000" | sudo tee -a /etc/sysctl.d/10-net-core-rmem.conf
echo "net.core.rmem_default = 62500000" | sudo tee -a /etc/sysctl.d/10-net-core-rmem.conf
sudo sysctl -w net.core.rmem_max=62500000
sudo sysctl -w net.core.rmem_default=62500000
Configuring the Quectel module
serial communication
Install your preferred serial communication program. For example, minicom:
sudo apt update
sudo apt install minicom
minicom is a basic serial communication tool.
It can attach serial device <dev> with command:
sudo minicom -D <dev>
One can exit minicom by pressing Ctrl+A and then Q.
Serial communication with the Quectel module is done through /dev/ttyUSB2. Check whether this device exist.
If it doesn't exist, it may be that the kernel did not recognize the device and associate the proper driver
as explained on the Quectel Forum.
Then run the following commands to expose /dev/ttyUSB2:
sudo modprobe option
echo "2c7c 0316" | sudo tee /sys/bus/usb-serial/drivers/option1/new_id
This need to be done upon each restart of the module or of the system.
Then you can access /dev/ttyUSB2 with your serial communication tool:
minicom -D /dev/ttyUSB2
Once serial communication is working properly, you can configure the Quectel module.
Set the usbnet mode to MBIM:
at+qcfg="usbnet",2
You may want to check the usbnet before or after changing it with command:
at+qcfg="usbnet"
Restart the module to apply the change:
at+cfun=1,1
Quectel module settings
Before continuing, you may want to check the firmware revision of the Quectel module:
at+gmr
We recommend version RM520NGLAAR03A03M4G or latter. RXX is the version major and AXX is the version minor. If you believe the firmware version of your module is not fit for your use case, then contact Quectel's support to get the firmware image and tools to update your module.
If the Quectel module was previously used, you may want to restore its factory settings.
Make sure you really want to restore the factory default settings before proceeding:
at&f
Now execute the following AT commands using your serial communication tool to properly configure the Quectel module.
Start with enabling all the radio features:
at+qmbncfg="autosel",0
at+qmbncfg="select","ROW_Commercial"
Restart the module to apply this change:
at+cfun=1,1
Make sure to enable 5G radio mode. Run the command:
at+qnwprefcfg="nr5g_disable_mode"
If it returns 0, then it is alright. Otherwise, set to 0:
at+qnwprefcfg="nr5g_disable_mode",0
Then set the 5G mode and band preference. Here, we set 5G SA mode with bands 77 and 78. You may replace at your convenience but we didn't test other cases. Refer to the Quectel AT commands manual for the full syntax of the commands:
at+qnwprefcfg="mode_pref",NR5G
at+qnwprefcfg="nr5g_band",77:78
The Quectel module has 3 preset PDP context in factory settings.
We want to set the first PDP context to PDP type ipv4 mode with APN "oai" and clear the two others.
Consider adapting the PDP type and APN to your network:
at+cgdcont=1,"IP","oai"
at+cgdcont=2
at+cgdcont=3
Finally, reboot the Quectel module one more time to make sure that all the command did apply:
at+cfun=1,1
Further useful AT commands are listed in this document and in the AT command manual available from Quectel documentation.
Connecting the UE
We provide a few scripts to start and stop the UE.
These scripts rely on the mbimcli tool that is shipped with Ubuntu server 24.04.
Always use the disconnection script before attempting any new connection.
Here is the script for connecting.
It relies on script mbim-set-ip.sh which is available here.
Consider adapting the IP type and APN string in the mbimcli --connect command to your network:
#!/bin/bash
DEVICE="/dev/cdc-wdm0"
echo "[*] Ensuring radio is off..."
sudo mbimcli -p -d "$DEVICE" --set-radio-state=off
sleep 1
echo "[*] Turn radio on..."
sudo mbimcli -p -d "$DEVICE" --set-radio-state=on
sleep 2
echo "[*] Attaching network..."
sudo mbimcli -p -d "$DEVICE" --attach-packet-service || echo "Attach failed."
echo "[*] Attempting connect on session 0..."
sudo mbimcli -p -d "$DEVICE" --connect=session-id=0,ip-type=ipv4,access-string=oai || echo "Session 0 connect failed."
echo "[*] Configure networking..."
sudo ./mbim-set-ip.sh "$DEVICE" wwan0 0
And here is the script for disconnecting:
#!/bin/bash
DEVICE="/dev/cdc-wdm0"
echo "[*] Checking connection state..."
sudo mbimcli -d "$DEVICE" -p --query-connection-state
echo "[*] Attempting disconnect on session 0..."
sudo mbimcli -d "$DEVICE" -p --disconnect=0 || echo "Session 0 disconnect failed."
sleep 2
echo "[*] Forcing radio state OFF..."
sudo mbimcli -d "$DEVICE" -p --set-radio-state=off || echo "Radio state change failed."
sleep 2
echo "[*] Verifying state..."
sudo mbimcli -d "$DEVICE" -p --query-radio-state
sudo mbimcli -d "$DEVICE" -p --query-connection-state
# Optional: Reset modem if still connected
STATE=$(sudo mbimcli -d "$DEVICE" -p --query-connection-state | grep "connected" || true)
if [[ -n "$STATE" ]]; then
echo "[!] Modem still connected, resetting..."
sudo mbimcli -d "$DEVICE" -p --device-reset
fi
echo "[✓] Disconnected."
Further useful MBIM commands are listed in this document.