EdgeSolutions Device usage

LTE / 5G Modem

We currently tested our devices and this documentation with the Telit Modems LN920 (4G) and FN990 (5G). The modem will be placed in the M.2 slot and can be accessed with ModemManager and their serial interfaces for sending AT commands and receiving GPS data.

4G / 5G Modem cellular setup

First, make sure that the modem is properly installed and all required drivers are available by listing the modem details with the mmcli command of ModemManager:

root@helium-22:~# mmcli -L
    /org/freedesktop/ModemManager1/Modem/0 [Telit] LN920A6-WW (1)
root@helium-22:~# mmcli -m 0
  ----------------------------------
  General  |                   path: /org/freedesktop/ModemManager1/Modem/0
           |              device id: d1787fb624bf67389b266229c044f872ecd7a39e
  ----------------------------------
  Hardware |           manufacturer: Telit
           |                  model: LN920A6-WW (2)
           |      firmware revision: M0L.010004
           |         carrier config: default
           |           h/w revision: 1.10
           |              supported: gsm-umts, lte
           |                current: gsm-umts, lte
           |           equipment id: 35[...]49
  ----------------------------------
  System   |                 device: /sys/devices/platform/bus@0/3610000.usb/usb2/2-1
           |                drivers: option, qmi_wwan
           |                 plugin: telit
           |           primary port: cdc-wdm0
           |                  ports: cdc-wdm0 (qmi), ttyUSB0 (ignored), ttyUSB1 (gps),
           |                         ttyUSB2 (at), ttyUSB3 (at), ttyUSB4 (ignored), wwan0 (net)
  ----------------------------------
  Status   |              lock: sim-pin
           |    unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), sim-puk2 (10)
           |             state: locked
           |       power state: on
[...]
  -----------------------------
  SIM      |  primary sim path: /org/freedesktop/ModemManager1/SIM/0
           |    sim slot paths: slot 1: /org/freedesktop/ModemManager1/SIM/0 (active) (3)
           |                    slot 2: /org/freedesktop/ModemManager1/SIM/1
1 The modem is listed as modem number 0
2 The modem details show the correct modem
3 The SIM Card is detected. In case of an FN990 modem, the SIM card detection pin logic might need to be inverted using AT commands (see below)

ModemManager seems to recognize the modem and all its interfaces, so we can start configuring the modem connection using NetworkManager with its command tool nmcli:

root@helium-22:~# nmcli dev
DEVICE    TYPE      STATE                   CONNECTION
enP9p1s0  ethernet  connected               Wired connection 2
tun0      tun       connected (externally)  tun0
cdc-wdm0  gsm       disconnected            --  (1)
enP8p1s0  ethernet  unavailable             --
can0      can       unmanaged               --
lo        loopback  unmanaged               --
1 The modem interface cdc-wdm0 is listed but not connected yet.

Currently, the modem interface cdc-wdm0 is not configured. We will create a connections defining the modem interface and the APN of our SIM card. If required, we will also provide the PIN to unlock the SIM card:

root@helium-22:~# nmcli con add type gsm con-name modem apn internet connection.autoconnect yes gsm.pin 1234 (1)
Connection 'modem' (c0dc3943-daf3-41a4-b415-94983c00eea8) successfully added.
root@helium-22:~# nmcli con
NAME                UUID                                  TYPE      DEVICE
Wired connection 2  2bfa8691-7428-3a27-84e6-2ea40b1cfe48  ethernet  enP9p1s0
modem               c0dc3943-daf3-41a4-b415-94983c00eea8  gsm       cdc-wdm0 (2)
tun0                4b3c8ff1-ab49-4fe3-b05b-0e5e3ed84317  tun       tun0
Wired connection 1  39c60dd3-946b-36da-9c3f-8f71af964e3c  ethernet  --
1 The apn internet and the PIN 1234 of this sample need to be replaced with you SIM-Card details. If the SIM card does not require a PIN, the gsm.pin 1234 option can be omitted.
2 The modem interface cdc-wdm0 is now connected to the new connection modem.

After creating the connection, we can check the connection details:

root@helium-22:~# ip a show dev wwan0
5: wwan0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/none
    inet 10.19.196.133/30 brd 10.19.196.135 scope global noprefixroute wwan0 (1)
       valid_lft forever preferred_lft forever
    inet6 2a01:599:a42:9911:60aa:d7eb:f49c:77e/64 scope global noprefixroute
       valid_lft forever preferred_lft forever
root@helium-22:~# ping -I wwan0 8.8.8.8 -c 5
PING 8.8.8.8 (8.8.8.8) from 10.19.196.133 wwan0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=114 time=145 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=114 time=40.5 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=114 time=29.2 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=114 time=28.3 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=114 time=36.1 ms

--- 8.8.8.8 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4008ms (2)
rtt min/avg/max/mdev = 28.323/55.896/145.260/44.908 ms
1 We got an IP address from the SIM card provider
2 We are able to ping external IP addresses, so the modem connection is working properly.

Invert SIM card detection logic for FN990

The SIM card detection logic of the FN990 modem is inverted to the LN920 default, so the modem will report that no SIM card is inserted even if there is one. This can be fixed by sending the following AT commands to the modem:

root@helium-22:~# minicom -D /dev/ttyUSB2 -b 115200
AT#SIMINCFG=1,0
AT#SIMINCFG=2,0
AT#REBOOT

You can leave minicom with Ctrl+A followed by Q and confirming with Enter.

After these commands, the modem will restart and should then report the SIM card as inserted and can be used with ModemManager and NetworkManager as described above. This configuration will be kept even after power cycles, so it only needs to be done once.

GPS usage with the modem

You can connect an active or passive GPS antenna to the modem. After selecting the NEMA messages to be received and activating the GPS functionality with AT commands, the GPS data will be available on the ttyUSB1 interface of the modem. You can directly read them from the serial interface or use a GPS software like gpsd to parse the GPS data and make it available to other applications on the system.

root@helium-22:~# minicom -D /dev/ttyUSB2 -b 115200 (1)
AT$GPSNMUN=1,1,1,1,1,1,1 (2)
AT$GPSP=1 (3)
1 Connect to the AT interface to configure GPS
2 Select all message types to be send to the serial interface
3 Activate the GPS functionality

After this, you should be able to read messages though ttyUSB1:

root@helium-22:~# cat /dev/ttyUSB1
$GPSNMUN: $GPGSA,A,1,,,,,,,,,,,,,,,,*32
$GPSNMUN: $GPVTG,,T,,M,,N,,K,N*2C
$GPSNMUN: $GPRMC,,V,,,,,,,,,,N,V*29
$GPSNMUN: $GPGGA,,,,,,0,,,,,,,,*66
$GPSNMUN: $GPGLL,,,,,,V,N*64
[...]

This type of messages will be received when there is no data from satellites yes.

Later, the messages will contain the GPS data when the modem has a GPS fix.

root@helium-22:~# cat /dev/ttyUSB1
$GPSNMUN: $GPGSV,3,1,11,05,18,084,26,09,00,000,21,16,11,295,28,21,14,056,42,1*68
$GPSNMUN: $GPGSV,3,2,11,25,40,120,23,26,42,296,38,28,47,229,31,31,48,274,46,1*6F
$GPSNMUN: $GPGSV,3,3,1 Have a detaild look at the modem and antenna documentation to check if the used antenna is active or passive and if it needs to be powered. Wrong configuration can damage the modem or the antenna! 1,12,04,115,,18,38,177,,29,71,057,,1*5A
$GPSNMUN: $GPGSA,A,3,21,26,28,29,31,,,,,,,,2.5,1.6,2.0,1*29
$GPSNMUN: $GPVTG,,T,,M,0.0,N,0.0,K,A*23
$GPSNMUN: $GPRMC,082307.00,A,4928.091570,N,01100.799176,E,0.0,,140426,0.3,E,A,V*63
$GPSNMUN: $GPGGA,082307.00,4928.091570,N,01100.799176,E,1,05,1.6,279.0,M,46.9,M,,*6D
$GPSNMUN: $GPGLL,4928.091570,N,01100.799176,E,082307.00,A,A*6D

Using the Telit modems, you need to activate the GPS of the modem after every power cycle. This can be automated with a cron job:

echo '@reboot root /usr/bin/sleep 60; /usr/bin/echo -en "AT\$GPSP=1\r" > /dev/ttyUSB2' > /etc/cron.d/enable_gps_power

Configure modem for usage with an active antenna

Have a detailed look at the modem and antenna documentation to check if the used antenna is active or passive and if it needs to be powered. Wrong configuration can damage the modem or the antenna!

If you are using an active GPS antenna, you need to provide power to the antenna by sending the following AT command:

root@helium-22:~# minicom -D /dev/ttyUSB2 -b 115200
AT$GPSP=0
AT$GPSANTPORT=3
AT$GPSP=1