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

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box


WorkInProgress.gif


200px-Emblem-important.svg.png

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


History
Issue Date Notes
2022/07/06 DESK-MX6UL-L 1.0.1


Introduction[edit | edit source]

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 modem[edit | edit source]

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:

MiniPCIe-USB-Adapter.png

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

Configuration[edit | edit source]

For using the Telit ME910C1-WW 4G modem, the standard Qualcomm MSM Interface, aka QMI, software interface has to be installed in the root file system.

USB-connected LTE modems present newer interfaces like QMI and MBIM. QMI is a Qualcomm proprietary protocol, while MBIM protocol specification is the result of multi-vendor standardization efforts. They present the modem as a real network interface (typically wwan0 or similar) and an additional device (e.g. /dev/cdc-wdm0) for command access.

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:~# ls -la /dev/cdc-wdm0
crw------- 1 root root 180, 176 Jul  5 15:54 /dev/cdc-wdm0
root@desk-mx6ul-lynx:~#

and the related wwan0 network interface is created:

root@desk-mx6ul-lynx:~# ifconfig wwan0
wwan0     Link encap:Ethernet  HWaddr 9a:a3:50:59:88:51
          inet6 addr: fe80::98a3:50ff:fe59:8851/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:9038 (8.8 KiB)

root@desk-mx6ul-lynx:~#

QMI commands testing[edit | edit source]

  • get 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 signal 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 connection[edit | edit source]

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:


WorkInProgress.gif

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 --device-open-proxy
...
...


WorkInProgress.gif

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 commands[edit | edit source]

  • 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