Open main menu

DAVE Developer's Wiki β

DESK-MX6UL-L-TN-0001: Using a 4G IoT modem

Revision as of 10:44, 5 July 2022 by U0007 (talk | contribs) (Useful list of qmi commands)

Info Box


WorkInProgress.gif


200px-Emblem-important.svg.png

This application note has been validated using the kit version in the History table.

Contents

HistoryEdit

Version Date Development Kit version
1.0.0 Jul 2022 DESK-MX6UL-L 1.0.1

IntroductionEdit

Nowadays IoT services are based on the native connectivity peripherals available on the Edge equipment. Sometimes a 4G modem (if not already integrated into the main board) has to be added for increasing the connectivity capabilities of the Edge itself.

Connecting the IoT modemEdit

Many 4G modems are available in the popular miniPCIe format. Unfortunately, the miniPCIe connector is not an easy connector expansion available in an embedded Edge platform. The most used USB bus, instead, is almost always present and can be easily used for expanding the capabilities of the Edge.

For this purposes, here below an adapter board can be used for getting a miniPCIe modem connectable to a standard USB Type-A port:

 

With this adapter any mniPCIe modem (with USB interface) can be easily connected to the SBC Lynx DAVE Embedded System's IoT Edge platform.

In the following example, the Telit ME910C1-WW LTE UE Cat M1/NB1 has been used.

 
SBC Lynx with Telit ME910C1-WW modem connected to the USB port

ConfigurationEdit

For using the Telit ME910C1-WW 4G modem, the standard Qualcomm MSM Interface, aka QMI, software interface has be installed in the root file system. The libqmi (glib-based library for talking to WWAN modems and devices which speak the Qualcomm MSM Interface (QMI) protocol) is then installed in the root file system using the dnf package manager (see this Application Note for more information)

dnf install libqmi

Once installed, the qmi commands are present in the rfs:

root@desk-mx6ul-lynx:~# qmi
qmi-firmware-update  qmi-network          qmicli
root@desk-mx6ul-lynx:~#

Obviously, the Linux kernel has to be configured adding the proper driver for the QMI WWAN interface. The following CONFIG should be enabled for the kernel to properly recognize the USB modem:

CONFIG_USB_NET_QMI_WWAN=y 
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_QCAUX=y
CONFIG_USB_SERIAL_QUALCOMM=y

If the modem is connected at the boot, the kernel lists the USB peripherals connected and installs the proper drivers; this can be seen via the command:

root@desk-mx6ul-lynx:~# lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ci_hdrc/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 480M
    |__ Port 1: Dev 2, If 1, Class=Vendor Specific Class, Driver=, 480M
    |__ Port 1: Dev 2, If 2, Class=Vendor Specific Class, Driver=, 480M
    |__ Port 1: Dev 2, If 3, Class=Vendor Specific Class, Driver=qmi_wwan, 480M
root@desk-mx6ul-lynx:~#

QMI commands testingEdit

  • model
root@desk-mx6ul-lynx:~# qmicli --device=/dev/cdc-wdm0 --device-open-proxy --dms-get-model
[/dev/cdc-wdm0] Device model retrieved:
        Model: 'ME910C1-WW'
root@desk-mx6ul-lynx:~
  • WAN interface
root@desk-mx6ul-lynx:~# qmicli --device=/dev/cdc-wdm0 --device-open-proxy --get-wwan-iface
wwan0
root@desk-mx6ul-lynx:~
  • get the siognal strenght
root@desk-mx6ul-lynx:~# qmicli -d /dev/cdc-wdm0 --nas-get-signal-strength
[/dev/cdc-wdm0] Successfully got signal strength
Current:
        Network 'gsm': '-95 dBm'
RSSI:
        Network 'gsm': '-95 dBm'
ECIO:
        Network 'gsm': '-31.5 dBm'
IO: '-106 dBm'
SINR (8): '9.0 dB'
root@desk-mx6ul-lynx:~
  • get the siognal strenght
root@desk-mx6ul-lynx:~# qmicli -d /dev/cdc-wdm0 --nas-get-signal-strength
[/dev/cdc-wdm0] Successfully got signal strength
Current:
        Network 'gsm': '-95 dBm'
RSSI:
        Network 'gsm': '-95 dBm'
ECIO:
        Network 'gsm': '-31.5 dBm'
IO: '-106 dBm'
SINR (8): '9.0 dB'
root@desk-mx6ul-lynx:~

WWAN connectionEdit

The Kernel driver interface has to be configured for using the RAW IP data format, so the following commands have to be issued:

ip link set dev wwan0 down
echo Y > /sys/class/net/wwan0/qmi/raw_ip
ip link set dev wwan0 up

The network operator available can be listed using:

root@desk-mx6ul-lynx:~# qmicli -d /dev/cdc-wdm0 --nas-network-scan
[/dev/cdc-wdm0] Successfully scanned networks
Network [0]:
        MCC: '222'
        MNC: '1'
        Status: 'current-serving, roaming, forbidden, not-preferred'
        Description: 'TIM'
Network [1]:
        MCC: '222'
        MNC: '10'
        Status: 'available, roaming, not-forbidden, not-preferred'
        Description: 'voda IT'
Network [0]:
        MCC: '222'
        MNC: '1'
        RAT: 'gsm'
Network [1]:
        MCC: '222'
        MNC: '10'
        RAT: 'lte'
Network [0]:
        MCC: '222'
        MNC: '1'
        MCC with PCS digit: 'no'
Network [1]:
        MCC: '222'
        MNC: '10'
        MCC with PCS digit: 'no'
get-idssk-mx6ul-lynx:~#

The 4G network operator is identified by the following format:

root@desk-mx6ul-lynx:~# qmicli -d /dev/cdc-wdm0 --nas-get-home-network
[/dev/cdc-wdm0] Successfully got home network:
        Home network:
                MCC: '222'
                MNC: '10'
                Description: 'voda IT'
root@desk-mx6ul-lynx:~#

A connection to the ISP can be made using, again, the qmcli application:


 

root@desk-mx6ul-lynx:~# qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn=internet.ho-mobile.it,ip-type=4" --client-no-release-cid
...
...


 

Once the connection has been established, the IP address can be assigned using the dhcp client, for example:

udhcpc -q -f -i wwan0

Useful list of qmi commandsEdit

  • Get modem model: qmicli -d /dev/cdc-wdm0 --device-open-proxy --dms-get-model
  • Get modem Manufacturer: qmicli -d /dev/cdc-wdm0 --device-open-proxy --dms-get-manufacturer
  • Get firmware version: qmicli -d /dev/cdc-wdm0 --device-open-proxy --dms-get-revision
  • Get modemd IMEI: qmicli -d /dev/cdc-wdm0 --device-open-proxy --dms-get-ids
  • Get SIM card status: qmicli -d /dev/cdc-wdm0 --device-open-proxy --uim-get-card-status
  • Get wwan kernel interface: qmicli -d /dev/cdc-wdm0 --device-open-proxy --get-wwan-iface
  • Get IP mode data format (expected): qmicli -d /dev/cdc-wdm0 --get-expected-data-format
  • Get the operator network name: qmicli -d /dev/cdc-wdm0 --nas-get-home-network
  • Scan the available network operators: qmicli -d /dev/cdc-wdm0 --nas-network-scan
  • Get the signal strenght: qmicli -d /dev/cdc-wdm0 --nas-get-signal-strength