QMI Interface with Cellular IoT HAT

  1. Unplug the USB cable from Cellular IoT HAT.
  2. Open a new terminal and run the update and upgrade command.
sudo apt update && sudo apt upgrade -y
  1. Next, install the Raspberry Pi kernel headers needed for the QMI Interface.
sudo apt-get install raspberrypi-kernel-headers

📘

Info

If you are using Raspberry Pi 4, skip steps 4-7.

  1. Check installed kernel headers packet version. In our case, it is 4.14.79. Note the version number.
ls /usr/src
[email protected]:~$ ls /usr/src
linux-headers-4.14.19+  linux-headers-4.14.79-v7+
  1. Navigate to the repository for Raspberry Pi firmware updates and locate the header version above on the page. In this case we want to find release 4.14.79.

Copy the kernel commit-id by pressing the copy to clipboard button.

  1. Update the firmware of the Raspberry Pi using the commit number found in the repository relating to the kernel version.
sudo rpi-update 985bc5353e4f5fe5a11c8b6c4c646dc7165bbc21
  1. Reboot your Raspberry Pi to activate the new firmware.

  2. After rebooting, download the QMI installer file.

wget https://raw.githubusercontent.com/sixfab/Sixfab_RPi_3G-4G-LTE_Base_Shield/master/tutorials/QMI_tutorial/qmi_install.sh
  1. Change the permission of the installation file.
sudo chmod +x qmi_install.sh
  1. Run the installation file. Make sure the module is disconnected before running the installer script.
sudo ./qmi_install.sh
  1. At the end of installation enter any key to reboot your Raspberry Pi. Attach the USB cable of the HAT.

  2. Navigate to the Quectel files that were installed in the previous step.

cd files/quectel-CM
  1. Now run the following command to connect to the Internet.
sudo ./quectel-CM -s internet

📘

Command usage

./quectel-CM [-s [apn [user password auth]]] [-p pincode] [-f logfilename] -s [apn [user password auth]]

Set apn/user/password/auth get from your network provider -p pincode Verify sim card pin if sim card is locked -f log filename Save log message of this program to file.

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

  1. Now you can check your IP using.

  1. Furthermore, you may check by pinging ping -I wwan0 -c 5 8.8.8.8

Auto Connect on reboot

If you want your Raspberry Pi to automatically connect to the Internet via the QMI interface then there is one more step you will need to follow.

  1. Get the installation script.
wget https://raw.githubusercontent.com/sixfab/Sixfab_RPi_3G-4G-LTE_Base_Shield/master/tutorials/QMI_tutorial/install_auto_connect.sh
  1. Make the installation file an executable.
sudo chmod +x install_auto_connect.sh
  1. Now install the script.
sudo ./install_auto_connect.sh
  1. It will then ask for APN. Type in your APN and then press ENTER.
sudo ./install_auto_connect.sh
What is the APN?
_
  1. Once you press enter it will create and activate the service.

  2. The name of the service is qmi_reconnect. To check if the service is active you can type.

sudo systemctl status qmi_reconnect.service
  1. If it is working fine then you will be able to see active(running) in green.

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

To re-enable the service to start up at boot, you can type:

sudo systemctl enable qmi_reconnect.service

Uninstall

If you are using auto-connect/reconnect service, stop the service and disable it.

sudo systemctl stop qmi_reconnect.service
sudo systemctl disable qmi_reconnect.service

Then delete the files.

sudo rm -r ~/files
sudo rm /usr/src/qmi_reconnect.sh
sudo rm /etc/systemd/system/qmi_reconnect.service

🚧

Please submit your technical issues and feedback to the community forum.

Updated 2 months ago


QMI Interface with Cellular IoT HAT


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.