Cellular modules that are based on the Qualcomm chipsets support the QMI interface. The libqmi can be used to establish QMI interface for mini PCIe modules such as Quectel EC25, EG25-G, EC21, UC20-G and Telit LE910C1, LE910C4 with the Raspberry Pi 3G/4G & LTE Base HAT.
This is a minimal brief tutorial to establish the connection, Reference sites are listed at the end of the tutorial.
Please note that the below tutorial assumes that you have already completed your hardware setup, if not please follow getting started.
Before we start, check the compatibility of the module.
lsusb -t
should return driver information such as qmi-wwan(opensource) or GobiNet(provided by Qualcomm) as shown below. Both drivers work fine with the libqmi.
|__ Port 4: Dev 6, If 4, Class=Vendor Specific Class, Driver=qmi_wwan, 480M
Before running the PPP/QMI make sure the module is configured to the right settings.
For Quectel Modules:
AT+QCFG="usbnet" should return 0, otherwise,send AT+QCFG="usbnet",0 then reboot the module after 10 seconds AT+CFUN=1,1
For Telit Modules:
AT#USBCFG? should return 0, otherwise,send AT#USBCFG=0 then reboot the module after 10 seconds ,AT#REBOOT
For sending AT commands, you may check the Sending AT Commands tutorial.
First, install the required packages.
sudo apt update && sudo apt install libqmi-utils udhcpc
libqmi-utils installs two main utilities (qmi-cli tool and qmi-network helper script), they are used for interactions with the modem (for more details check man qmi-cli)
Now make sure the module is ready, it can be done with the following command:
sudo qmicli -d /dev/cdc-wdm0 --dms-get-operating-mode
This should return 'online'. If not, then try:
sudo qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode='online'
Now configure the network interface for the raw-ip protocol.
sudo ip link set wwan0 down
echo 'Y' | sudo tee /sys/class/net/wwan0/qmi/raw_ip
sudo ip link set wwan0 up
One can confirm the data format using
sudo qmicli -d /dev/cdc-wdm0 --wda-get-data-format
Once the wwan0 is up, connect the mobile network.
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-cid
Lastly, configure the IP address and the default route with udhcpc.
sudo udhcpc -q -f -i wwan0
Now check the assigned IP address and test the connection.
Troubleshooting
We recommend going through the section on troubleshooting as it covers more common issues with establishing and maintaining a network connection. Please check out the troubleshooting guide.