🛠 Passerelle cellulaire 4G/5G : module M.2 B-Key, SIM et failover
Objectives
Turn the ROCK 3B into a standalone cellular gateway — the M.2 B-Key 3042 socket (USB/PCIe/SATA interfaces) and the embedded SIM port eliminate the need for a carrier board: a 4G LTE (or 5G) module + a SIM card are sufficient. Radxa documents interface usage in the official "interface usage" documentation, and support has confirmed Quectel modules (e.g., EM05) on the forum. Typical use case: failover of a wired connection on an isolated site, with the two GbE ports as backup.
Hardware
- Radxa ROCK 3B running Radxa OS, PD 12 V / 2 A power supply (radio peaks under load)
- M.2 B-Key 3042 LTE cat4+ module, Quectel type (EC25/EM05 or equivalent), antennas, data nano-SIM
- >
Complete code
# 1. Le module est vu en USB (mode QMI/MBIM/ECM selon le module) :
sudo lsusb ; sudo dmesg | grep -i -e qmi -e gsm -e cdc
ls /dev/ttyUSB* # ports AT (ttyUSB2 souvent)
# 2. Dialogue AT : statut réseau et enregistrement
sudo apt install minicom
sudo minicom -D /dev/ttyUSB2 # AT+CPIN? -> READY ; AT+CSQ -> qualité signal
# AT+CGDCAP=1,"apn" puis AT+CGACT=1,1 selon module
# 3. Connexion données :
sudo apt install network-manager-modemmanager
mcli -t -f DEVICE,STATE device # wwan0 / cdc-wdm0 attendu
mcli connection add type gsm ifname cdc-wdm0 con-name 4g apn "apn.orange"
mcli connection up 4g ; ping -c3 -I wwan0 1.1.1.1
# 4. Failover simple (métriques) : Ethernet prioritaire, cellulaire de secours
sudo nmcli connection modify "Ethernet-eth0" connection.autoconnect-priority 100
sudo nmcli connection modify "4g" connection.autoconnect-priority 50
Expected verification
AT+CPIN? returns READY (SIM detected), AT+CSQ shows a quality > 10; mcli connection up 4g brings up wwan0/cdc-wdm0 with an IP address; ping -I wwan0 reaches the Internet. When Ethernet is unplugged, traffic switches to the cellular link (lowest metric).
Common errors
- Forgetting to connect antennas before powering on: the module searches indefinitely, AT+CSQ = 99.
- Wrong AT port: the order of ttyUSB* devices changes depending on the module — test with
ATon each one. - Missing or incorrect APN: network registration succeeds but no data is transferred; check the operator's APN.
- Restricted data SIM (voice only) or SIM PIN not disabled: AT+CPIN? indicates SIM PIN.
- Installing a 5G module while using the 5 V GPIO power supply: radio peaks require PD 12 V/2 A (or 25 W PoE).
- The B-Key interfaces are USB/PCIe/SATA: a purely PCIe module may require specific firmware/kernel modules — prefer a USB-QMI module documented for Linux ARM.
Other tutorials for this board
- Faire clignoter une LED via le GPIO avec libgpiod
- Lire un bouton poussoir en Python avec python3-libgpiod
- Premier réseau : Ethernet double gigabit, Wi-Fi optionnel et SSH
- Installer et booter le système sur un SSD NVMe (M.2 M-Key)
- Interroger un capteur I2C sur le connecteur 40 broches
- Surveiller température et fréquence CPU, piloter le ventilateur PWM
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash