- 5g modems
- Authors
- See also
- Pages related to mmcli
- Build modemmanager
- Common options
- Configuring minicom to interface with the modem via usb
- Creating a new sms message & storing it
- Dms options
- Does your modem require a driver or driver update that is not available in the linux kernel version you are using?
- Functional description
- Gps location retrieval
- Gps location status
- Help options
- Modem control
- Modem filter
- Networkmanager
- Port probing
- Post-installation issues
- Sms options
- Test at commands
- Test on se30
- Un-documented at commands
- Using the qmi protocol
- Узнайте больше о Huawei
5g modems
5G NR (New Radio) is a new radio access technology (RAT) developed by 3GPP for the 5G (fifth generation) mobile network.
5G NR uses two frequency ranges:
- FR1
- FR2
Frequency Range 1, Utilizes a lot of what 4G was using.
Frequency Range 2, Shorter Range but Higher Bandwidth. Millimeter waves (mmWave).
Initial 5G NR launches will depend on existing 4G LTE infrastructure in non-standalone (NSA) mode, before maturation of the standalone (SA) mode with the 5G core network.
Additionally, the spectrum can be dynamically shared between 4G LTE and 5G NR.
Many 5G cards are in the M.2 form factor and a size of 3052 (30mm wide by 52mm long).
5G connectivity depends on several factors, so before wasting a bunch of time trying to connect to 5G, make sure that all the following criterias are met.
Authors
Written by Martyn Russell and Aleksander Morgado
See also
ModemManager
(8),
NetworkManager
(8)
AT (http://en.wikipedia.org/wiki/AT_commands).
3GPP (http://en.wikipedia.org/wiki/3GPP).
MCCMNC (http://en.wikipedia.org/wiki/Mobile_Network_Code).
USSD (http://en.wikipedia.org/wiki/Unstructured_Supplementary_Service_Data).
CDMA (http://en.wikipedia.org/wiki/Code_division_multiple_access).
OTA (http://en.wikipedia.org/wiki/Over-the-air_programming).
GPS (http://en.wikipedia.org/wiki/Global_Positioning_System)
NMEA (http://en.wikipedia.org/wiki/NMEA_0183)
Build modemmanager
$ cd ModemManager
$ NOCONFIGURE=1 ./autogen.sh
$ ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
$ make
$ sudo make install
If you see the configure error:
configure: error: Couldn't find libqmi-glib >= 1.28.6. Install it, or otherwise configure using --without-qmi to disable QMI support.
Check the serach path:
$ pkg-config --variable pc_path pkg-config
/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
Find the
qmi-glib.pc
in these paths ten investigate its content:
$ cat /usr/lib/x86_64-linux-gnu/pkgconfig/qmi-glib.pc
prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib/x86_64-linux-gnu
includedir=${prefix}/include
qmi_qrtr_supported=0
qmi_mbim_qmux_supported=1
Name: qmi-glib
Description: Library to communicate with QMI-powered modems
Version: 1.28.4
Requires: glib-2.0 gobject-2.0 gio-2.0
Cflags: -I${includedir}/libqmi-glib
Libs: -L${libdir} -lqmi-glib
Libs.Private: -lmbim-glib -lgio-2.0 -lgobject-2.0 -lglib-2.0
Remove the incorrect .pc file then configure ModemManage again.
Remember to configure the shared library path on Ubuntu:
- Create a file /etc/ld.so.conf.d/modem-manager.conf
Withe the content:
/usr/lib
$ sudo ldconfig
Enable debug mode in ModemManager service,
/lib/systemd/system/ModemManager.service
...
ExecStart=/usr/sbin/ModemManager --debug
...
Reboot the system :
- Enale and retstart the MomdemManager service
$ sudo systemctl enable ModemManager.service
$ sudo systemctl restart ModemManager.service
$ journalctl -u ModemManager -b
Common options
All options below take a
PATHINDEX
argument. If no action is
provided, the default information about the modem, bearer, etc. is
shown instead.
The
PATH
and
INDEX
are created automatically when the
modem is plugged in. They can be found using
mmcli -L
. This
produces something like (for modems only):
- Found 1 modems:
/org/freedesktop/ModemManager1/Modem/4
In this case, the
INDEX4
and the
PATH
is the entire string above.
However, for the bearers, SIMs and SMS cases, the
PATH
is
slightly different. The
Modem
is replaced with the object name
in use, like
Bearer
. For example:
- /org/freedesktop/ModemManager1/Bearer/4
- -m, –modem=[PATH|INDEX]
- Specify a modem.
- -b, –bearer=[PATH|INDEX]
- Specify a bearer.
- -i, –sim=[PATH|INDEX]
- Specify a SIM card.
- -s, –sms=[PATH|INDEX]
- Specify an SMS.
Configuring minicom to interface with the modem via usb
Once the device is connected via USB, you will see output similar to the following using dmesg.
[ 1071.120084] cdc_acm 1-1.3:1.1: ttyACM0: USB ACM device
[ 1071.120916] usbcore: registered new interface driver cdc_acm
[ 1071.120917] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
In this case, the modem got detected as /dev/ttyACM0.
To configure minicom to access modem,
- change the serial device from /dev/tty0 to /dev/ttyACM0
- change the Baud rate at which the modem can support
To test whether we have configured minicom successfully to communicate with modem, type “
AT
” in the minicom. You should get a “
OK
” response as follows.
Welcome to minicom 2.6.1
OPTIONS: I18n
Compiled on Feb 11 2022, 18:12:55.
Port /dev/ttyACM0
Press CTRL-A Z for help on special keys
ATOK
Creating a new sms message & storing it
Using the “sm” (SIM), you can do this using:
$ mmcli -m 0 --messaging-create-sms="text='Hello world',number=' 1234567890'" Successfully created new SMS: /org/freedesktop/ModemManager1/SMS/21 (unknown) $ sudo mmcli -s 21 --store-in-storage="sm" successfully stored the SMS $ sudo mmcli -s 21 SMS '/org/freedesktop/ModemManager1/SMS/21' ----------------------------------- Content | number: ' 1234567890' | text: 'Hello world' ----------------------------------- Properties | PDU type: 'submit' | state: 'stored' | smsc: 'unknown' | validity: '0' | class: '0' | storage: 'sm' | delivery report: 'not requested' | message reference: '0' $ sudo mmcli -m 0 --messaging-status /org/freedesktop/ModemManager1/Modem/0 ---------------------------- Messaging | supported storages: 'sm, me' | default storage: 'me'
Dms options
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --dms-get-manufacturer
[/dev/wwan0p2MBIM] Device manufacturer retrieved:
Manufacturer: 'Qualcomm'
$ sudo qmicli --device=/dev/wwan0p2MBIM --device-open-proxy --dms-get-manufacturer
[/dev/wwan0p2MBIM] Device manufacturer retrieved:
Manufacturer: 'Qualcomm'
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --dms-get-model
[/dev/wwan0p2MBIM] Device model retrieved:
Model: 'Qualcomm Snapdragon X55 5G'
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --dms-get-revision
[/dev/wwan0p2MBIM] Device revision retrieved:
Revision: 'T99W175.F0.0.0.5.5.GC.004
066 1 [Sep 11 2020 11:00:00]'
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --dms-get-hardware-revision
[/dev/wwan0p2MBIM] Hardware revision retrieved:
Revision: 'V065'
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --dms-get-software-version
[/dev/wwan0p2MBIM] Software version: T99W175.F0.0.0.5.5
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --dms-get-power-state
[/dev/wwan0p2MBIM] Device power state retrieved:
Power state: 'external-source'
Battery level: '0 %'
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --dms-get-operating-mode
[/dev/wwan0p2MBIM] Operating mode retrieved:
Mode: 'online'
HW restricted: 'no'
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --nas-get-technology-preference
[/dev/wwan0p2MBIM] Successfully got technology preference
Active: 'auto', duration: 'permanent'
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --dms-get-band-capabilities
[/dev/wwan0p2MBIM] Device band capabilities retrieved:
Bands: 'wcdma-2100, wcdma-pcs-1900, wcdma-dcs-1800, wcdma-1700-us, wcdma-850-us, wcdma-800, wcdma-900, wcdma-1700-japan, wcdma-850-japan'
LTE bands: '1, 2, 3, 4, 5, 7, 8, 12, 13, 14, 17, 18, 19, 20, 25, 26, 28, 29, 30, 32, 34, 38, 39, 40, 41, 42'
LTE bands (extended): '1, 2, 3, 4, 5, 7, 8, 12, 13, 14, 17, 18, 19, 20, 25, 26, 28, 29, 30, 32, 34, 38, 39, 40, 41, 42, 46, 48, 66, 71'
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --nas-get-system-selection-preference
[/dev/wwan0p2MBIM] Successfully got system selection preference
Emergency mode: 'no'
Mode preference: '5gnr'
Disabled modes: '(null)'
Band preference: 'wcdma-2100, wcdma-pcs-1900, wcdma-1700-us, wcdma-850-us, wcdma-800, wcdma-900, wcdma-1700-japan, wcdma-850-japan'
LTE band preference: '1, 2, 3, 4, 5, 7, 8, 12, 13, 14, 17, 18, 19, 20, 25, 26, 28, 29, 30, 32, 34, 38, 39, 40, 41, 42'
LTE band preference (extended): '1, 2, 3, 4, 5, 7, 8, 12, 13, 14, 17, 18, 19, 20, 25, 26, 28, 29, 30, 32, 34, 38, 39, 40, 41, 42, 46, 48, 66, 71'
TD-SCDMA band preference: 'a, b, c, d, e, f'
Roaming preference: 'any'
Network selection preference: 'automatic'
Service domain preference: 'ps-only'
GSM/WCDMA acquisition order preference: 'automatic'
Usage preference: 'data-centric'
Voice domain preference: 'ps-preferred'
Registration restriction: 'unrestricted'
Acquisition order preference: 'umts, lte'
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --nas-get-cell-location-info
error: couldn't get cell location info: QMI protocol error (13): 'NoNetworkFound'
$ sudo qmicli --device=/dev/wwan0p2MBIM -p --device-open-proxy --nas-get-operator-name
error: couldn't get operator name data: QMI protocol error (74): 'InformationUnavailable'
Does your modem require a driver or driver update that is not available in the linux kernel version you are using?
Look at the kernel messages from the
dmesg
command for messages that might indicate a modem is not supported or lack of a known driver supporting that device.
$ lspci | grep Wireless
2d:00.0 Wireless controller [0d40]: Foxconn International, Inc. Device e0ab
$ sudo find /sys | grep drivers | grep 0000:2d:00
/sys/bus/pci/drivers/mhi-pci-generic/0000:2d:00.0
$ ls -l /sys/class/net/mhi_mbim0/device/driver
lrwxrwxrwx 1 root root 0 Jan 1 2020 /sys/class/net/mhi_mbim0/device/driver -> ../../../../../../bus/mhi/drivers/mhi_net
$ lsmod | grep mhi
mhi_wwan_ctrl 20480 0
mhi_net 20480 0
wwan 16384 3 mhi_wwan_ctrl
mhi_pci_generic 24576 0
mhi 73728 3 mhi_wwan_ctrl,mhi_net,mhi_pci_generic
$ sudo LD_LIBRARY_PATH=/usr/local/lib mmcli --modem 0 | grep -i -E ports|driver
| drivers: mhi_net, mhi-pci-generic
| ports: mhi_mbim0 (net), wwan0p2MBIM (mbim)
Here, we see that the modem in the system is supported by the ‘
mhi_net
‘ driver and the ‘
mhi-pci-generic
‘ driver.
It speaks ‘
mbim
‘ control protocols, and it uses the ‘
mhi_mbim0
‘ network device for data.
ModemManager[1668]: [wwan0] port contents loaded:
ModemManager[1668]: [wwan0] bus: pci
ModemManager[1668]: [wwan0] device: /sys/devices/pci0000:00/0000:00:1c.0/0000:2d:00.0
ModemManager[1668]: [wwan0] driver: mhi-pci-generic
ModemManager[1668]: [wwan0] vendor: 105b
ModemManager[1668]: [wwan0] product: e0ab
ModemManager[1668]: [base-manager] adding port wwan0 at sysfs path: /sys/devices/pci0000:00/0000:00:1c.0/0000:2d:00.0/mhi0/wwan/wwan0
ModemManager[1668]: [filter] (wwan/wwan0) port allowed: device is whitelisted by plugin (vid)
ModemManager[1668]: [base-manager] additional port wwan0 in device /sys/devices/pci0000:00/0000:00:1c.0/0000:2d:00.0
ModemManager[1668]: [plugin-manager] task 0: port grabbed: wwan0
ModemManager[1668]: [plugin-manager] task 0,wwan0: new support task for port
ModemManager[1668]: [plugin-manager] task 0,wwan0: deferred until min wait time elapsed
ModemManager[1668]: [wwan0p1QCDM] port contents loaded:
ModemManager[1668]: [wwan0p1QCDM] bus: pci
ModemManager[1668]: [wwan0p1QCDM] device: /sys/devices/pci0000:00/0000:00:1c.0/0000:2d:00.0
ModemManager[1668]: [wwan0p1QCDM] driver: mhi-pci-generic
ModemManager[1668]: [wwan0p1QCDM] vendor: 105b
ModemManager[1668]: [wwan0p1QCDM] product: e0ab
ModemManager[1668]: [base-manager] adding port wwan0p1QCDM at sysfs path: /sys/devices/pci0000:00/0000:00:1c.0/0000:2d:00.0/mhi0/wwan/wwan0/wwan0p1QCDM
ModemManager[1668]: [filter] (wwan/wwan0p1QCDM) port allowed: device is whitelisted by plugin (vid)
ModemManager[1668]: [base-manager] additional port wwan0p1QCDM in device /sys/devices/pci0000:00/0000:00:1c.0/0000:2d:00.0
ModemManager[1668]: [plugin-manager] task 0: port grabbed: wwan0p1QCDM
ModemManager[1668]: [plugin-manager] task 0,wwan0p1QCDM: new support task for port
ModemManager[1668]: [plugin-manager] task 0,wwan0p1QCDM: deferred until min wait time elapsed
ModemManager[1668]: [wwan0p2MBIM] port contents loaded:
ModemManager[1668]: [wwan0p2MBIM] bus: pci
ModemManager[1668]: [wwan0p2MBIM] device: /sys/devices/pci0000:00/0000:00:1c.0/0000:2d:00.0
ModemManager[1668]: [wwan0p2MBIM] driver: mhi-pci-generic
ModemManager[1668]: [wwan0p2MBIM] vendor: 105b
ModemManager[1668]: [wwan0p2MBIM] product: e0ab
ModemManager[1668]: [base-manager] adding port wwan0p2MBIM at sysfs path: /sys/devices/pci0000:00/0000:00:1c.0/0000:2d:00.0/mhi0/wwan/wwan0/wwan0p2MBIM
ModemManager[1668]: [filter] (wwan/wwan0p2MBIM) port allowed: device is whitelisted by plugin (vid)
ModemManager[1668]: [base-manager] additional port wwan0p2MBIM in device /sys/devices/pci0000:00/0000:00:1c.0/0000:2d:00.0
ModemManager[1668]: [plugin-manager] task 0: port grabbed: wwan0p2MBIM
ModemManager[1668]: [plugin-manager] task 0,wwan0p2MBIM: new support task for port
ModemManager[1668]: [plugin-manager] task 0,wwan0p2MBIM: deferred until min wait time elapsed
ModemManager[1668]: [plugin-manager] task 0: min wait time elapsed
...
ModemManager[1668]: [plugin-manager] task 0,wwan0p2MBIM: checking with plugin 'foxconn'
ModemManager[1668]: [plugin/foxconn] probes required for port wwan0p2MBIM: 'at, qcdm, qmi, mbim'
ModemManager[1668]: [wwan0p2MBIM/probe] no AT/QCDM/QMI probing in possible MBIM port
ModemManager[1668]: [wwan0p2MBIM/probe] port is not AT-capable
ModemManager[1668]: [wwan0p2MBIM/probe] port is not QCDM-capable
ModemManager[1668]: [wwan0p2MBIM/probe] port is not QMI-capable
ModemManager[1668]: [wwan0p2MBIM/probe] launching port probing: 'mbim'
...
ModemManager[1668]: [plugin-manager] task 0,wwan0p1QCDM: checking with plugin 'foxconn'
ModemManager[1668]: [plugin/foxconn] probes required for port wwan0p1QCDM: 'at, qcdm, qmi, mbim'
ModemManager[1668]: [wwan0p1QCDM/probe] no AT/QMI/MBIM probing in possible QCDM port
ModemManager[1668]: [wwan0p1QCDM/probe] port is not AT-capable
ModemManager[1668]: [wwan0p1QCDM/probe] port is not QMI-capable
ModemManager[1668]: [wwan0p1QCDM/probe] port is not MBIM-capable
ModemManager[1668]: [wwan0p1QCDM/probe] launching port probing: 'qcdm'
...
ModemManager[1668]: [plugin-manager] task 0,wwan0: checking with plugin 'foxconn'
ModemManager[1668]: [plugin/foxconn] probes required for port wwan0: 'at, qcdm, qmi, mbim'
ModemManager[1668]: [wwan0/probe] launching port probing: 'at, qcdm, qmi, mbim'
...
ModemManager[1668]: [plugin-manager] task 0,mhi_mbim0: checking with plugin 'foxconn'
ModemManager[1668]: [plugin/foxconn] probing of port mhi_mbim0 deferred until result suggested
ModemManager[1668]: [plugin-manager] task 1: min wait time elapsed
...
ModemManager[1668]: [plugin-manager] task 0: still 4 running probes (4 active): wwan0p2MBIM, wwan0p1QCDM, wwan0, mhi_mbim0
...
ModemManager[1668]: [wwan0p2MBIM/probe] probing MBIM...
ModemManager[1668]: [wwan0p1QCDM/probe] probing QCDM...
ModemManager[1668]: [wwan0p1QCDM/qcdm] opening serial port...
ModemManager[1668]: [wwan0p1QCDM/qcdm] failed to configure serial device
ModemManager[1668]: [wwan0p1QCDM/qcdm] failed to open serial device
ModemManager[1668]: [plugin-manager] task 0,wwan0p1QCDM: error when checking support with plugin 'foxconn': (wwan/wwan0p1QCDM) Failed to open QCDM port: Failed to open QCDM port: -2
ModemManager[1668]: [plugin-manager] task 0,wwan0p1QCDM: checking with plugin 'generic'
ModemManager[1668]: [plugin/generic] probes required for port wwan0p1QCDM: 'at, qcdm, qmi, mbim'
ModemManager[1668]: [wwan0p1QCDM/probe] no AT/QMI/MBIM probing in possible QCDM port
ModemManager[1668]: [wwan0p1QCDM/probe] port is not AT-capable
ModemManager[1668]: [wwan0p1QCDM/probe] port is not QMI-capable
ModemManager[1668]: [wwan0p1QCDM/probe] port is not MBIM-capable
ModemManager[1668]: [wwan0p1QCDM/probe] launching port probing: 'qcdm'
ModemManager[1668]: [wwan0p1QCDM/qcdm] forced to close port
ModemManager[1668]: [wwan0/at] opening serial port...
ModemManager[1668]: [plugin-manager] task 0,wwan0: error when checking support with plugin 'foxconn': (wwan/wwan0) failed to open port: Could not open serial device wwan0: No such file or directory
ModemManager[1668]: [plugin-manager] task 0,wwan0: checking with plugin 'generic'
ModemManager[1668]: [plugin/generic] probes required for port wwan0: 'at, qcdm, qmi, mbim'
ModemManager[1668]: [wwan0/probe] launching port probing: 'at, qcdm, qmi, mbim'
ModemManager[1668]: [wwan0/at] forced to close port
ModemManager[1668]: opening device...
ModemManager[1668]: [/dev/wwan0p2MBIM] Couldn't find descriptors file, possibly not using cdc_mbim
ModemManager[1668]: [/dev/wwan0p2MBIM] Fallback to default max control message size: 4096
ModemManager[1668]: [/dev/wwan0p2MBIM] Sent message...
ModemManager[1668]: [/dev/wwan0p2MBIM] Sent message (translated)...
Header:
length = 92
type = command (0x00000003)
transaction = 1
Fragment header:
total = 1
current = 0
Contents:
service = 'proxy-control' (838cf7fb-8d0d-4d7f-871e-d71dbefbb39b)
cid = 'configuration' (0x00000001)
type = 'set' (0x00000001)
Fields:
DevicePath = '/dev/wwan0p2MBIM'
Timeout = '30'
...
ModemManager[1668]: [plugin-manager] task 0,wwan0p2MBIM: found best plugin for port (foxconn)
ModemManager[1668]: [plugin-manager] task 0,wwan0p2MBIM: finished in '1.648350' seconds
ModemManager[1668]: [plugin-manager] task 0,wwan0p2MBIM: found best plugin: foxconn
ModemManager[1668]: [plugin-manager] task 0,mhi_mbim0: deferred task completed, got suggested plugin (foxconn)
...
ModemManager[1668]: [1622022182.202276] [device /sys/devices/pci0000:00/0000:00:1c.0/0000:2d:00.0] creating modem with plugin 'foxconn' and '2' ports
ModemManager[1668]: [plugin/foxconn] (foxconn) MBIM-powered Foxconn-branded modem found...
ModemManager[1668]: [modem0] port 'wwan/wwan0p2MBIM' grabbed
ModemManager[1668]: [modem0] port 'net/mhi_mbim0' grabbed
ModemManager[1668]: [modem0] net/mhi_mbim0 net (data)
ModemManager[1668]: [modem0] wwan/wwan0p2MBIM mbim
ModemManager[1668]: [modem0] running MBIM port 'wwan0p2MBIM' reset with data interface 'mhi_mbim0'
ModemManager[1668]: [base-manager] modem for device '/sys/devices/pci0000:00/0000:00:1c.0/0000:2d:00.0' successfully created
...
ModemManager[1668]: [modem0] couldn't setup SIM hot swap using QMI over MBIM: Couldn't peek client for service 'uim'
ModemManager[1668]: [modem0] SIM hot swap setup succeeded
ModemManager[1668]: [modem0] couldn't query SIM slots: Couldn't peek client for service 'uim'
...
ModemManager[1668]: couldn't check if unlock required: SIM failure
ModemManager[1668]: [modem0] state changed (unknown -> locked)
ModemManager[1668]: [modem0] modem couldn't be initialized: Couldn't check unlock status: SIM failure
ModemManager[1668]: [modem0] state changed (locked -> failed)
ModemManager[1668]: [modem0] voice support check failed: No AT port available to run command
ModemManager[1668]: [modem0] couldn't initialize interface: 'Voice not supported'
...
ModemManager[1668]: [modem0] creating ports context for SIM hot swap
ModemManager[1668]: couldn't open ports during Modem SIM hot swap enabling: Couldn't get primary port
ModemManager[1668]: SIM is missing and SIM hot swap is configured, but ports are not opened.
ModemManager[1668]: couldn't finish initialization in the current state: 'Modem is unusable, cannot fully initialize'
The above
, which is what the modem is reporting.
$ nmcli d
DEVICE TYPE STATE CONNECTION
wwan0p2MBIM gsm unavailable --
$ sudo nmcli d connect wwan0p2MBIM
Error: Failed to add/activate new connection: Connection 'wwan0p2MBIM' is not available on device wwan0p2MBIM because device is not available
Most modem drivers will create a number of ‘tty’ devices in /dev/tty* – if you see no messages about this you may be missing driver support.
Functional description
The FT980 family of cellular modules feature 5G NR / LTE and multi-RAT modem together with an on-chip powerful application processor(32bit [email protected]) and a rich set of interfaces.
The following software runs on the application processor:
- Telit Unified AT command set. this is the main control interface, including the following:
- Hayes standard AT command set
- Standard 3GPP AT command and GPRS-specific commands.
- Standard 3GPP AT commands for SMS (Short Message Service) and CBS (Cell Broadcast Service)
- Firmware Over-The-Air (FOTA) update supporting selective update.
The FT980 family includes a USB3.1 port which is typically used for:
- Flashing of firmware and module configuration
- Production testing
- Accessing the Application Processor’s filesystem (debug bridge)
- AT command access (2 modem ports)
- High speed WWAN access to external host
- Diagnostic monitoring and debugging
- NMEA data to an external host CPU
- The following standardized device classes can be supported:
CDC-ACM, CDC-ECM, MBIM, RNDIS, RMNET (Qualcomm proprietary)
Gps location retrieval
You can query location source specific information with
–location-get-3gpp–location-get-gps-nmea
and
–location-get-gps-raw
; but also for all at the same time:
$ sudo mmcli -m 0 --location-get /org/freedesktop/ModemManager1/Modem/0 ------------------------- 3GPP location | Mobile country code: '214' | Mobile network code: '3' | Location area code: '21071' | Cell ID: '7033737' ------------------------- GPS NMEA traces | $GPGGA,,,,,,0,,,,,,,,*66 | $GPRMC,,V,,,,,,,,,,N*53 | $GPGSA,A,1,,,,,,,,,,,,,,,*1E | $GPGSV,4,1,16,24,,,,29,,,,05,,,,18,,,*7A | $GPGSV,4,2,16,22,,,,14,,,,11,,,,17,,,*7B | $GPGSV,4,3,16,03,,,,12,,,,30,,,,13,,,*78 | $GPGSV,4,4,16,23,,,,15,,,,27,,,,07,,,*79 | $GPVTG,,T,,M,,N,,K,N*2C ------------------------- Raw GPS | Not available ------------------------- CDMA BS | Not available
An example of RAW GPS location information:
$ sudo mmcli -m 0 --location-get-gps-raw /org/freedesktop/ModemManager1/Modem/0 ------------------------- Raw GPS | UTC time: '155142.2' | Longitude: '-3.513941' | Latitude: '40.502603' | Altitude: '18.000000'
Gps location status
You first need to check whether the modem has GPS-specific location
capabilities. Note that we’ll assume the modem is exposed as index 0;
if you have more than one modem, just use –list-modems to check the
proper modem index:
$ mmcli -m 0 --location-status /org/freedesktop/ModemManager1/Modem/0 ---------------------------- Location | capabilities: '3gpp-lac-ci, gps-raw, gps-nmea' | enabled: 'none' | signals: 'no'
The output says that the modem supports 3GPP Location area code/Cell
ID, GPS raw and GPS-NMEA location sources. None is enabled yet, as we
didn’t enable the modem, which we can do issuing:
$ sudo mmcli -m 0 --enable successfully enabled the modem $ mmcli -m 0 --location-status /org/freedesktop/ModemManager1/Modem/0 ---------------------------- Location | capabilities: '3gpp-lac-ci, gps-raw, gps-nmea' | enabled: '3gpp-lac-ci' | signals: 'no'
Help options
- -h, –help
- Show summary of options by group.
- –help-all
- Show all groups and options.
- –help-manager
- Show manager specific options.
- –help-common
- Show common options. These are used for defining the device an option
operates on. For example, modems, bearers, SIMs, SMS’, etc. - –help-modem
- Show modem specific options.
- –help-3gpp
- Show 3GPP specific options.
- –help-cdma
- Show CDMA specific options.
- –help-simple
- Show simple options. These are useful for getting connected or
disconnected and understanding the state of things as fast as possible
without worrying so much about the details. - –help-location
- Show location or positioning specific options.
- –help-messaging
- Show messaging specific options. See also –help-sms which
is related. - –help-time
- Show time specific options.
- –help-firmware
- Show firmware specific options.
- –help-oma
- Show OMA specific options.
- –help-sim
- Show SIM card specific options.
- –help-bearer
- Show bearer specific options.
- –help-sms
- Show SMS specific options. See also –help-messaging which
is related.
Modem control
Modem’s require additional configuration and control to perform the following types of details before moving on to configuring a network interface:
- Dialing (in the old days for dial-up modems)
- SIM pin control and unlocking (security)
- Network provider registration
- Data Protocol selection
Once all of the above is completed, a modem driver will provide a network interface to the Linux OS:
- IP over ethernet
- raw IP
- IP over serial (sometimes via PPP daemon)
And once you finally have an IP networking interface up and running from the modem, you can use the standard IP configuration tools within Linux (like NetworkManager or the lower-level tools such as ip, route, ifconfig, etc).
Different
modem control protocol
s have been developed:
- AT commands
- QMI
- MBIM – Mobile Interface Broadband Model
text commands and responses typically preceded by ‘AT’ and terminated with a CR (carriage return or 0x0d
Qualcomm Modem Interface (A binary protocol used for modern Qualcomm based modems)
A new standard by the USB Implementers Forum specifying a new MBIM USB device model with multiple IP connections over a single USB interface without the need of 802.3 frames and a new MBIM control protocol
The
QMI
protocol is proprietary protocol by Qualcomm.
In contrast to
QMIMBIM
is more standardized protocol for 3G/4G dongles.
Modem filter
ModemManager will not probe all TTYs, NET and cdc-wdm ports found in the system because TTYs that have nothing to do with modem devices.
The daemon comes with several predefined filter policies, each of them composed of one or more filter rules.
- MM_FILTER_RULE_EXPLICIT_WHITELIST
src/mm-filter.c:
mm_filter_register_plugin_whitelist_vendor_id(MMFilter *self, guint16 vid){
...
for (i = 0; i < self->priv->plugin_whitelist_vendor_ids->len; i ) {
guint16 item;
item = g_array_index (self->priv->plugin_whitelist_vendor_ids, guint16, i);
if (item == vid)
return;
}
...
mm_obj_dbg (self, "registered plugin whitelist vendor id: x", vid);
...
}
src/mm-plugin-manager.c:
static void
register_plugin_whitelist_vendor_ids (MMPluginManager *self, MMPlugin *plugin){
...
vendor_ids = mm_plugin_get_allowed_vendor_ids (plugin);
for (i = 0; vendor_ids && vendor_ids[i]; i )
mm_filter_register_plugin_whitelist_vendor_id (self->priv->filter, vendor_ids[i]);
...
}
static gboolean load_plugins (MMPluginManager *self,
GError **error)
{
...
mm_obj_dbg (self, "looking for plugins in '%s'", plugindir_display);
...
/* Load all plugins */
subsystems = g_ptr_array_new ();
for (l = plugin_paths; l; l = g_list_next (l)) {
MMPlugin *plugin;
const gchar **plugin_subsystems;
guint i;
plugin = load_plugin (self, (const gchar *)(l->data));
...
/* Register plugin whitelist rules in filter, if any */
register_plugin_whitelist_tags (self, plugin);
register_plugin_whitelist_vendor_ids (self, plugin);
register_plugin_whitelist_product_ids (self, plugin);
}
...
}
./plugins/quectel/mm-plugin-quectel.c:
G_MODULE_EXPORT MMPlugin *
mm_plugin_create (void)
{
static const gchar *subsystems[] = { "tty", "net", "usbmisc", NULL };
static const gchar *vendor_strings[] = { "quectel", NULL };
static const guint16 vendor_ids[] = { 0x2c7c, 0 };
return MM_PLUGIN (
g_object_new (MM_TYPE_PLUGIN_QUECTEL,
MM_PLUGIN_NAME, MM_MODULE_NAME,
MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids,
MM_PLUGIN_ALLOWED_VENDOR_STRINGS, vendor_strings,
MM_PLUGIN_ALLOWED_AT, TRUE,
MM_PLUGIN_ALLOWED_QCDM, TRUE,
MM_PLUGIN_ALLOWED_QMI, TRUE,
MM_PLUGIN_ALLOWED_MBIM, TRUE,
NULL));
}
Networkmanager
NetworkManager is a package containing a background service/daemon and a command-line-interfalce (nmcli) that can be used to configure and connect network interfaces.
It is often used in conjunction with ModemManager for Cellular modems.
- Show version
# nmcli --version
# nmcli device status
# nmcli connection down id 'Wired connection 1'
- QMI controlled modem with an APN=h2g2 (Google Fi)
# nmcli connection add type gsm ifname cdc-wdm0 con-name mymodem apn h2g2
# nmcli connection add type gsm ifname ttyACM0 con-name mymodem apn vzwinternet
# nmcli connection up id mymodem
Port probing
Whenever a new device is detected by ModemManager, port probing process will get started, so that we can determine which kind of ports we have, and also which plugin we need to use for the specific device.
Devices may expose one or more ports, and all of them will follow the same probing logic.
The whole probing process, including pre-probing and post-probing filters, is implemented in the core ModemManager daemon.Plugins will just configure their own special needs in the probing process, so that only the steps required by the given plugin are executed.
Pre-probing filters are those which control whether the probing, as requested by the specific plugin, takes place.
- Allowed vendor IDs
- Product IDs
- Subsystems
- Drivers
- udev tags
Plugins can provide a list of udev-reported vendor IDs to be used as pre-probing filters.
If the vendor ID reported by the device via udev is found in the list provided by the plugin, port probing will be launched as requested by the given plugin.
This filter is specified by the MM_PLUGIN_ALLOWED_VENDOR_IDS property in the MMPlugin object provided by the plugin.
Plugins can provide a list of udev-reported pairs of vendor and product IDs to be used as pre-probing filters.
If the vendor ID and product ID pair reported by the device via udev is found in the list of ‘allowed’ pairs provided by the plugin, port probing will be launched as requested by the given plugin. This additional filter should be used when the plugin is expected to work only with a given specific product of a given vendor.
If the vendor ID and product ID pair reported by the device via udev is found in the list of ‘forbidden’ pairs provided by the plugin, port probing will not be launched by this plugin. This additional filter should be used when the plugin supports all devices of a given vendor except for some specific ones.
These filters are specified by the MM_PLUGIN_ALLOWED_PRODUCT_IDS and MM_PLUGIN_FORBIDDEN_PRODUCT_IDS properties in the MMPlugin object provided by the plugin.
Plugins can specify which subsystems they expect, so that we filter out any port detected with a subsystem not listed by the plugin.
This filter is specified by the MM_PLUGIN_ALLOWED_SUBSYSTEMS property in the MMPlugin object provided by the plugin.
Plugins can specify which drivers they expect, so that we filter out any port detected being managed by a driver not listed by the plugin.
Plugins can also specify which drivers they do not expect, so that we filter out any port detected being managed by a driver listed by the plugin.
These filters are specified by the MM_PLUGIN_ALLOWED_DRIVERS and MM_PLUGIN_FORBIDDEN_DRIVERS properties in the MMPlugin object provided by the plugin.
Plugins can provide a list of udev tags, so that we filter out any port detected which doesn’t expose any of the given tags.
This filter is specified by the MM_PLUGIN_ALLOWED_UDEV_TAGS property in the MMPlugin object provided by the plugin.
Common enumerations and types in the API.
Post-installation issues
$ sudo mmcli -L
error: couldn't find the ModemManager process in the bus
$ sudo systemctlenable ModemManager.service
Failed to enable unit: Unit file /run/systemd/system/ModemManager.service is masked.
$ file /run/systemd/system/ModemManager.service
/run/systemd/system/ModemManager.service: symbolic link to /dev/null
$ sudo rm/run/systemd/system/ModemManager.service
$ sudo systemctl restart ModemManager.service
Failed to restart ModemManager.service: Unit ModemManager.service is masked.
$ file /run/systemd/system/ModemManager.service
/run/systemd/system/ModemManager.service: cannot open `/run/systemd/system/ModemManager.service' (No such file or directory)
$ sudo systemctlenable ModemManager.service
$ sudo systemctlrestart ModemManager.service
MHI is a protocol
developed by Qualcomm Innovation Center, Inc.
It is used by the host processors to control and communicate with modem devices over high speed peripheral buses or shared memory.
Even though MHI can be easily adapted to any peripheral buses, it is primarily used with PCIe based devices.
MHI provides logical channels over the physical buses and allows transporting the modem protocols, such as IP data packets, modem control messages, and diagnostics over at least one of those logical channels.
This is a generic
MHI-over-PCI controller driver for MHI only devices
such as QCOM modems.
For now it supports registering of Qualcomm SDX55 based PCIe modules.
The MHI channels have been extracted from mhi downstream driver.
This driver is for MHI-only devices which have all functionalities exposed through MHI channels and accessed by the corresponding MHI device drivers (no out-of-band communication).
The MHI support for control channels/ports has recently been merged in Linux along with a new ‘
wwan subsystem
The
wwan subsystem
handles
wwan
devices (e.g.
/sys/class/wwan
/wan0) and related ports (e.g.
/sys/class/wwan
/wwan0p1MBIM…).
$ ls -l /sys/class/wwan
lrwxrwxrwx 1 root root 0 四 2 2020 wwan0 -> ../../devices/pci0000:00/0000:00:1c.0/0000:2d:00.0/mhi0/wwan/wwan0
lrwxrwxrwx 1 root root 0 四 2 2020 wwan0p1QCDM -> ../../devices/pci0000:00/0000:00:1c.0/0000:2d:00.0/mhi0/wwan/wwan0/wwan0p1QCDM
lrwxrwxrwx 1 root root 0 四 2 2020 wwan0p2MBIM -> ../../devices/pci0000:00/0000:00:1c.0/0000:2d:00.0/mhi0/wwan/wwan0/wwan0p2MBIM
Each
WWAN control port
Sms options
All SMS options require the
–sms-s
option.
- –send
- Send an SMS.
- –store
- This option will store the SMS in the default storage defined by the
modem, which may be either modem-memory or SMS-memory. To know what
the existing default storage is, see the –messaging-status
option. - –store-in-storage=STORAGE
- This option states which STORAGE to use for SMS messages.
Possible values for STORAGE include:- ‘sm’
- SIM card storage area.
- ‘me’
- Mobile equipment storage area.
- ‘mt’
- Sum of SIM and Mobile equipment storages
- ‘sr’
- Status report message storage area.
- ‘bm’
- Broadcast message storage area.
- ‘ta’
- Terminal adaptor message storage area.
- –create-file-with-data=PATH
- This option takes an SMS that has DATA (not TEXT) and will
create a local file described by PATH and store the content of
the SMS there.
Test at commands
- Answer an Incoming call
When there is an incoming call, you can see a ‘RING’ message in the minicom. You can input “ATA” to answer the incoming call.
RING
ATA
OK
ATD 99769XXXXX;
OK
ATH
OK
AT CGMI
Nokia
OK
AT CGSN
xxxxxxxxxxxxxxx
OK
AT CIMI
xxxxxxxxxxxxxxx
OK
AT CSQ
CSQ: 29,99
OK
AT CBC
CBC: 1,96
OK
The returned responses:
- CSQ: 29,99
- CBC: 1,96
Represent <Received signal strength indicator>,<Bit Error Rate>
Represent <current charging status>,<charged %>
AT CMGF=1
OK
AT CMGS="99xxxxxxxx"
> This is a test message
>
OK
- The command AT CMGF=1 sets the “Message format” to “text mode”.
- The command AT CMGS, send the SMS to the specified number.
“Ctrl z” is used to terminate the message input.
$ sudo mmcli -m 0 --command='CMD'
CMD:
- AT
AT command returns OK which implies that the communication between the device and the application has been verified.
$ sudo mmcli -m 0 --command='AT'
response: ''
This AT command returns information about device manufacturer.
$ sudo mmcli -m 0 --command='AT CGMI'
response: 'Quectel'
This command returns the IMEI (International Mobile station Equipment Identity) of the mobile terminal.
$ sudo mmcli -m 0 --command='AT CGSN'
response: '***'
This AT command returns IMSI (International Mobile Subscriber Identity) of the mobile terminal.
$ sudo mmcli -m 0 --command='AT CIMI'
error: command failed: 'GDBus.Error:org.freedesktop.ModemManager1.Error.MobileEquipment.NotAllowed: Operation not allowed'
AT CFUN AT command sets the level of functionality in the MT.
- Level “full functionality” is where the highest level of power is drawn.
- “Minimum functionality” is where minimum power is drawn.
Possible values are,
$ sudo mmcli -m 0 --command='AT cfun?'
response: ' CFUN: 1'
The commandis used to enter a password or query whether or not the module requires a password which is necessary before it can be operated.
- TestCommand: AT CPIN=?
Response: OK
$ sudo mmcli -m 0 --command='AT CPIN=?'
response: ''
$ sudo mmcli -m 0 --command='AT cpin?'
error: command failed: 'GDBus.Error:org.freedesktop.ModemManager1.Error.MobileEquipment.SimBusy: SIM busy
- Query all options of the configuration
$ sudo mmcli -m 0 --command='AT QCFG=?'
response: ' QCFG: "gprsattach",(0,1)
QCFG: "nwscanseq",(00-0102030405),(0,1)
QCFG: "rrc",(0-5)
QCFG: "msc",(0-2)
QCFG: "sgsn",(0-2)
QCFG: "hsdpacat",(6,8,10-24)
QCFG: "hsupacat",(5,6)
QCFG: "pdp/duplicatechk",(0,1)
QCFG: "ledmode",(0,1)
QCFG: "ltesms/format"[,(0-2)]
QCFG: "ModemRstLevel",(0,1)
QCFG: "mdlogcfg",(0,1)
QCFG: "lte4x4mimo/disable",(0,1)
QCFG: "lte4x4mimo/swmethod",(0,AT)(1,check_PIN68)
QCFG: "ApRstLevel",(0,1)
QCFG: "ims",(0,1)
QCFG: "pcmclk",(0,1)
QCFG: "thermal/modem"[,<level>,<trig>,<clr>]
QCFG: "thermal/limit_rates"[,<enable>]
QCFG: "lte/bandprior",(1-43),(1-43),(1-43)
QCFG: "qsar/qsardpr",(0,1)
QCFG: "vts/async",(0,1)
QCFG: "imsreg/iptype",(0,1)
QCFG: "sim/onchip",(0,1)
QCFG: "powerup/regctl",(0,1)
QCFG: "volte_disable",(0,1)
QCFG: "sim/clk_freq",(0,1)
QCFG: "diversity/config",<0-5>,<0-7>,<0-2>
QCFG: "div_test_mode",<0-1>
QCFG: "usbid",<vid>,<pid>
QCFG: "usbcfg",<vid>,<pid>,<diag>,<nmea>,<at_port>,<modem>,<rmnet>,<adb>
QCFG: "usbnet",<0-3>
QCFG: "data_interface",(0,1),(0,1)
QCFG: "stkauto/setupmenutr",(0,1)
QCFG: "fcc_enable",(0,1)
QCFG: "soft_hotswap",(0,1),(5-60)'
it will return ERROR if you query an option that is unset
$ sudo mmcli -m 0 --command='AT qcfg="fcc_enable",0'
$ sudo mmcli -m 0 --command='AT qcfg="fcc_enable"'
response: ' QCFG: "fcc_enable",0'
Test on se30
$ mmcli -V
mmcli 1.16.6
$ qmicli -V
qmicli 1.29.7
- Request Modem and Application Firmware Versions
$ sudo mmcli -m 0 --command='AT qgmr'
response: 'EM120RGLAPR02A07M4G_13.013.13.013'
$ sudo mmcli -m 0 --command='AT cfun?'
response: ' CFUN: 1'
$ sudo mmcli -m 0 --command='AT cpin?'
response: ' CPIN: READY'
$ sudo mmcli -m 0 --command='AT qcfg="fcc_enable"'
response: ' QCFG: "fcc_enable",0'
$ sudo LD_LIBRARY_PATH=/usr/local/libModemManager --debug
...
ModemManager[247780]: <debug> [1621778032.453754] [plugin-manager] successfully loaded 38 plugins registering 4 subsystems: tty, net, usbmisc, wwan
ModemManager[247780]: <debug> [1621778032.455336] service name 'org.freedesktop.ModemManager1' was acquired
ModemManager[247780]: <debug> [1621778032.455400] [base-manager] starting automatic device scan...
...
Un-documented at commands
References:
CMD:
- AT qgmr
Request Modem and Application Firmware Versions
$ sudo mmcli -m 0 --command='AT qgmr'
response: 'EM160RGLAPR02A07M4G_01.001.01.001'
Extended Configuration Settings.
The command is used to query and configure various settings.
- AT qcfg=”fcc_enable”
The following table lists the AT commands that are related to the writing and sending of SMS messages:
- operate in SMS text mode
AT CMGF=1
AT CMGW=" 85291234567"
> A simple demo of SMS text messaging.
CMGW: 1
” CMGW: 1” tells us that the index assigned to the SMS text message is 1.
It indicates the location of the SMS text message in the message storage.
AT CMSS=1
“1” is the index of the SMS text message in the message storage.
AT CMGS
CMGD
CMGC
CMMS
In most cases, instead of writing your own code for interacting with the mobile phone or GSM/GPRS modem via AT commands, a better solution is to use a high-level SMS messaging API (Application programming interface) / SDK (Software development kit) / library.
The links to some open source and free SMS messaging libraries can be found in the article ”
“.
Most 4G/LTE cellular modules implements the USB Implementers Forums
Mobile Broadband Interface Model (MBIM)
Interface.
Microsoft request cellular module vendors to include the MBIM interface for good compatibility with Windows 8, 8.1, 10 and later systems. The Windows built-in connection manager also rely on MBIM interface for control of the cellular modules.
There is a open source Linux in-kernel driver supporting MBIM interface and it is called cdc_mbim. The library libmbim can be used to communicate with the cellular devices over the interface and do necessary configurations to trigger the data connection over the cellular network.
Verify that you have the Linux in-kernel cdc_mbim driver installed for the cellular modules exposed MBIM interface endpoint over USB.
$ lsusb -t
The libmbim provides a command line utility
mbimcli
$ mbimcli --version
The cellular modules mbim interface is usually named the device
cdc-wdm
* .
Using the qmi protocol
This protocol is implemented in recent enough Linux kernels (>= 3.4) and can be accessible through the
cdc-wdm
and
qmi_wwan
drivers.
$ lsmod | grep wan
qmi_wwan 36864 0
cdc_wdm 24576 2 qmi_wwan
usbnet 49152 1 qmi_wwan
usb_wwan 24576 1 option
usbserial 57344 8 usb_wwan,option
Once these drivers are in place and the modem gets plugged in, the kernel will expose a new
/dev/cdc-wdm
device which can talk QMI protocol, along with a
wwan
interface associated to each QMI port.
libqmi is a library providing easy access to Qualcomm’s ‘QMI’ protocol.qmicli is used as a developer tool for testing the libqmi-glib library.The project also comes with a small bash script called ‘qmi-network‘, which allows you to launch a broadband connection using libqmi-glib and qmicli.This script requires two arguments;
- the cdc-wdm device to talk to
- the action (start|stop|status) to execute
QMI(Qualcomm MSM Interface,官方名稱應該是Qualcomm Message Interface)是高通用來替代OneRPC/DM的協議,用來與modem通信。
QMI協議定義了多個服務:
協議裏的每個服務都定義了請求和響應(也叫做 Indication), 每個請求響應都有一個匹配的ID,這樣用戶可以一次發出多個請求。並且響應也不必嚴格按照請求的順序進行回應。
If not using a higher level manager which utilizes libqmi such as ModemManager, you can use libqmi directly (make sure ModemManager is not installed or running!).
Several cellular modules based on Qualcomm chipsets implements the Qualcomm Qualcomm MSM (QMI) Interface.
There is a open source Linux in-kernel driver supporting this interface and it is called
qmi_wwan
This driver can be used together with
ModemManager
and
NetworkManager
to automate connection establishment and as a connection manager.
The library libqmi which ModemManager uses can also be used to communicate in a more direct way with the cellular devices over the QMI interface and to step by step do necessary configurations and trigger the data connection over the cellular netwowk.
Example on how to set up the data connection step by step manually with libqmi:
qmicli [OPTION?]