Modules with a Qualcomm chipset have a QMI interface. qmicli from libqmi starts the data connection through the in-kernel qmi_wwan driver, and udhcpc gives the interface its IP address.
Requirements
Finish the quickstart of the board first: Get started with Base HAT, Get started with 4G/LTE Cellular Modem Kit or Get started with Jetson Nano Cellular Modem Kit.
Hardware
- Base HAT, 4G/LTE Cellular Modem Kit or Jetson Nano Cellular Modem KitAssembled as in the quickstart of the Base HAT, the 4G/LTE kit or the Jetson Nano kit, with the USB cable connected.
- A module with a QMI interfaceFor example Quectel EC25, EG25-G, EC21 or UC20-G, or Telit LE910C1 or LE910C4.
SIM
- SIM card with data serviceIts APN, and a username and password if the operator uses them. The Sixfab SIM and the KORE Super SIM (formerly Twilio Super SIM) use the APN
super, without username or password.
Software
- Serial terminalTo send AT commands: see Send AT commands.
Stop ModemManager
-
Stop and disable ModemManager
On Raspberry Pi OS Bookworm and later, ModemManager is installed by default and can take over the module. Stop and disable it, or remove it with
sudo apt purge modemmanager -y:sudo systemctl stop ModemManager.service sudo systemctl disable ModemManager.service
Check driver and module mode
-
Check driver
lsusb -tOne interface of the module uses the
qmi_wwandriver. This page needsqmi_wwan; libqmi does not work with Qualcomm’s GobiNet driver.|__ Port 4: Dev 6, If 4, Class=Vendor Specific Class, Driver=qmi_wwan, 480MIf the module has no network driver, see the driver guide of the module manufacturer, linked in the Base HAT troubleshooting.
-
Check that module is in QMI mode
Send the AT commands of your module, as in Send AT commands:
-
Check USB network mode
AT+QCFG="usbnet"QMI mode answers
+QCFG: "usbnet",0. -
Set QMI mode and restart module
If the answer is not
0, set QMI mode:AT+QCFG="usbnet",0Wait about 10 seconds, then restart the module:
AT+CFUN=1,1
-
Check USB configuration
AT#USBCFG?QMI (RmNet) mode answers
#USBCFG: 0. -
Set QMI mode
If the answer is not
0, set QMI mode:AT#USBCFG=0The module restarts by itself. If it does not, restart it with
AT#REBOOT.
-
Install libqmi
-
Install libqmi-utils and udhcpc
sudo apt update && sudo apt install libqmi-utils udhcpclibqmi-utilsinstallsqmicli, which talks to the module (man qmicli), and theqmi-networkhelper script;udhcpcsets the IP address. The commands below use the control device/dev/cdc-wdm0and the interfacewwan0; with more than one modem,sudo qmicli -d /dev/cdc-wdm0 --get-wwan-ifaceprints the interface of a control device.
Start data connection
-
Check that module is online
sudo qmicli -d /dev/cdc-wdm0 --dms-get-operating-modeThe answer includes
Mode: 'online'. If it does not, set it:sudo qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode='online' -
Set interface to raw IP
sudo ip link set wwan0 down echo 'Y' | sudo tee /sys/class/net/wwan0/qmi/raw_ip sudo ip link set wwan0 upTo check the data format of the module:
sudo qmicli -d /dev/cdc-wdm0 --wda-get-data-format -
Connect to network
Replace the APN, username and password with those of your SIM and operator; without a username and password, delete those two parameters:
sudo qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='YOUR_APN',username='YOUR_USERNAME',password='YOUR_PASSWORD',ip-type=4" --client-no-release-cidWith the Sixfab SIM or the KORE Super SIM:
sudo qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='super',ip-type=4" --client-no-release-cidThe answer says
Network startedand gives the packet data handle and the client ID (CID) that--client-no-release-cidkeeps open. Note both: they stop the connection. -
Get IP address and default route
sudo udhcpc -q -f -i wwan0The answer ends with the lease, for example
udhcpc: lease of 100.67.114.164 obtained, lease time 7200. With-q, udhcpc exits once it has the lease.
Verify
-
Check interface address
ip addr show wwan0Result:wwan0has the address of the lease. -
Ping through cellular interface
ping -I wwan0 -c 5 sixfab.com$ ping -I wwan0 -c 5 sixfab.com PING sixfab.com (172.67.75.126) from 100.67.114.164 wwan0: 56(84) bytes of data. 64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=1 ttl=29 time=247 ms 64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=2 ttl=29 time=205 ms 64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=3 ttl=29 time=207 ms 64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=4 ttl=29 time=204 ms 64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=5 ttl=29 time=216 ms --- sixfab.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 8ms rtt min/avg/max/mdev = 204.050/215.839/247.004/16.201 msFive replies and
0% packet lossmean the connection works; addresses and times differ by network.
Details
Stop connection
Use the packet data handle and the CID from the start command:
sudo qmicli -p -d /dev/cdc-wdm0 --wds-stop-network=PACKET_DATA_HANDLE --client-cid=CID
Troubleshooting
The module is not in QMI mode, or qmi_wwan is not loaded: see Check driver and module mode.
Check the SIM (AT+CPIN?), the registration (AT+CREG?) and the APN, username and password.
Check that /sys/class/net/wwan0/qmi/raw_ip is Y, and that ModemManager is stopped.
Power, SIM, antenna and USB checks are in the Base HAT troubleshooting.
Next steps
- Send AT commands to cellular module Find the AT port and send commands with Minicom or ATCom.
- Connect cellular module to internet in ECM mode The module as a USB Ethernet interface, without extra software.
- Connect Quectel module with quectel-CM Quectel’s connection manager for QMI mode.
- libqmi The project documentation and the qmicli manual.
- Techship: data connection over QMI with qmicli A step-by-step guide to the same method with the in-kernel qmi_wwan driver.