QMI Interface Internet Connection Setup Using Sixfab Shield/HAT
To get rid of the legacy cruft, newer ways to present USB-connected LTE modems like QMI and MBIM have been developed. Quectel modules offer QMI(Qualcomm MSM Interface) which is established as a real network interface, such as ethernet(typically shows as wwan0). There is an open source Linux in-kernel driver supporting this interface called qmi_wwan.
The QMI is also counted among the non-AT protocols which are communicated over dev/cdc-wdm0 port. In order to establish a connection, proper qmi/gobinet proxy should be installed, which again depending on the chipset of the module/modem and the kernel of Linux, can get a bit complicated.
🚨 Important notes
This tutorial is no longer compatible for Raspberry Pi OS Bookworm and newer ones. Those who have old versions can follow. Now you can follow the libqmi tutorial instead.
Warning: In this tutorial, the QMI interface was established using the connect manager program(quectel-CM tool) provided by Quectel. This tutorial will not work for modules from other OEMs, it is only for Quectel. Also, this tutorial was created with reference to the Quectel Linux User's Guide.
Software Setup
⚙️ Module Configuration
Before running the PPP/QMI make sure the module is configured to the right settings. AT+QCFG="usbnet" should return 0, otherwise,send AT+QCFG="usbnet",0 then reboot the module after 10 seconds AT+CFUN=1,1
Set apn/user/password/auth get -p pincode from your network provider, verify sim card pin if sim card is locked -f log filename, save log message of this program to the file.
quectel-CM will send QMI message to the module via QMI channel to setup data connection. Please refer to the following message to use quectel-CM:
Example 1: ./quectel-CM Example 2: ./quectel-CM -s 3gnet Example 3: ./quectel-CM -s 3gnet carl 1234 0 -p 1234 -f gobinet_log.txt
Now check the assigned IP address and test the connection
It will then ask for APN. Type in your APN and then press ENTER.
pi@raspberrypi:~ $ sudo ./install_auto_connect.sh
What is the APN?
<YOUR_APN>
--2020-12-03 12:07:39-- https://raw.githubusercontent.com/sixfab/Sixfab_RPi_3G-4G-LTE_Base_Shield/master/tutorials/QMI_tutorial/reconnect_service
Resolving raw.githubusercontent.com
...
Saving to: 'qmi_reconnect.service'
qmi_reconnect.service 100%[=========================================================>]
264 --.-KB/s in 0s
2020-12-03 12:07:39 (2.63 MB/s) - 'qmi_reconnect.service' saved [264/264]
...
Saving to: 'qmi_reconnect.sh'
qmi_reconnect.sh 100%[=========================================================>]
224 --.-KB/s in 0s
2020-12-03 12:07:40 (1.32 MB/s) - 'qmi_reconnect.sh' saved [224/224]
Created symlink /etc/systemd/system/multi-user.target.wants/qmi_reconnect.service → /etc/systemd/system/qmi_reconnect.service.
DONE
The name of the service is qmi_reconnect. To check if the service is active you can type the following. If it is working fine then you will be able to see active(running) in green.
pi@raspberrypi:~ $ sudo systemctl status qmi_reconnect.service
● qmi_reconnect.service - QMI Auto Connection
Loaded: loaded (/etc/systemd/system/qmi_reconnect.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-01-29 12:15:25 GMT; 2min 4s ago
Main PID: 2730 (sh)
Tasks: 4 (limit: 3861)
CGroup: /system.slice/qmi_reconnect.service
├─ 2730 /bin/sh /usr/src/qmi_reconnect.sh
├─13529 sudo ./quectel-CM -s super
└─13530 ./quectel-CM -s super
Managing the Auto-connect/Reconnect service
To check if the service is active you can type.
sudo systemctl status qmi_reconnect.service
To stop your reconnect service, type:
sudo systemctl stop qmi_reconnect.service
To start the reconnect service when it is stopped, type:
sudo systemctl start qmi_reconnect.service
To stop and then start the service again, type:
sudo systemctl restart qmi_reconnect.service
By default, reconnect service is configured to start automatically when the server boots. If this is not what you want, you can disable this behavior by typing:
sudo systemctl disable qmi_reconnect.service
Uninstall
If you are using auto-connect/reconnect service, stop the service and disable it.
We recommend going through the section on troubleshooting as it covers the more common issues with establishing and maintaining a network connection. Please check the troubleshooting of your shield/HAT.