General LTE settings and functions

(i)

Looking for a guide how to get started with LTE on Mervis IDE? Please see this tutorial, otherwise continue here.

This manual refers to the LTE series of Patron and Edge units - currently S167, M267, M567, E410*, E412* and E413*.

(!)

Note:
*LTE is optional.

  1. Insert a micro-sim supporting LTE data into the slot
  2. Connect to the unit via SSH
  3. Check the status of the unipi-lte service using the command:
    systemctl status unipi-lte
    * unipi-lte.service - LED indication of embedded GSM/3G/LTE module status
        Loaded: loaded (/lib/systemd/system/unipi-lte.service; enabled; vendor preset: enabled)
        Active: active (running) since Thu 2023-07-20 07:57:07 UTC; 9min ago
      Main PID: 393 (python3)
        Tasks: 1 (limit: 796)
        Memory: 16.6M
        CGroup: /system.slice/unipi-lte.service
                `-393 python3 /opt/unipi/tools/unipi-lte.py

    (i)

    Note:
    If the operator uses the APN value internet and the SIM card is not protected by a PIN, there is no need to set anything and you can skip following steps.

  4. Start editing the lte.conf file, e.g. with MidnightCommander:
    sudo mc -e /etc/unipi/lte.conf
  5. If the SIM card is PIN protected, set the correct PIN and uncomment the line:
    pin: 1234 
  6. The APN setting is mandatory (if this line is missing or commented out, the LTE service is disabled). The correct value is determined by the operator, the default value is internet:
    apn: "internet" 

    (i)

    Note:
    In older lte.conf versions parameter connection_type was included in apn. If you are using older version without connection_type parameter, it is necessary to set the apn parameter in the following format: apn: “IPV4V6”,“internet”

  7. Save and exit editing the file and restart the unipi-lte service with the command:
    sudo systemctl restart unipi-lte

(i)

Note:
Be patient, registration to the mobile network can take several minutes. When registered, NET LED lights up.


  1. During normal operation, “Mobile network” LED indicators SIM, NET, INT should be ON while blinking SIG indicates signal strength. See LED Indicators table.
  2. In case of any problem, we recommend that you check the unipi-lte service log file. The log is described in detail in chapter Log File.
LED OFF ON Flashing
SIM LTE service (daemon) is not active
(disabled or not installed)
SIM is OK Slow - No sim inserted (or SIM corrupted)
Fast - wrong PIN
NET Not registered to LTE network Registered to network —
SIG No signal Excellent signal Signal quality - faster ∼ better
INT No WAN access Unit online, backup active
(or single interface only)
Slow - connected via the primary WAN interface, backup inactive
Fast - connected via backup WAN interface

(!)

Note:
All LEDs flashing — LTE module is restarting.

Service and related packages can be updated by:

  1. Connect to the unit via SSH
  2. Obtain a refreshed list of available packages:
    sudo apt update
  3. The LTE service can be installed or updated with:
    sudo apt install unipi-kernel unipi-os-configurator unipi-os-configurator-data unipi-lte

(!)

Note:
To flash an old OS image or backup of OS to Patron unit with LTE in revision FID 2.0+, it is necessary that it includes LTE package in version 0.64 or newer and it's dependencies in compatible versions. We recommend to update the packages on Patron in revision FID 1.x and then create a backup of OS with updated packages, which can be flashed on the newer Patron units.
Package version can be displayed with:

dpkg -s unipi-lte | grep Version
  • for optimal signal strength it is necessary to use an external antenna installed in an open area (eg. outside any enclosures). For some Unipi units external antenna is included in the package - during the purchase, you can choose between the default antenna with magnetic mount or a larger one with on-wall mount. Both antennas can be also purchased separately.
  • By default, Ethernet is set as the primary network interface and LTE as the backup interface. Changing the primary interface is possible in the configuration file in the PING section.
  • WAN connection availability is determined by ping to 8.8.8.8. The IP address and ping interval can be set in the configuration file in the PING section.

Configuration File

The lte.conf configuration file is available in the /etc/unipi/ directory. Editing the file is possible e.g. with MidnightCommander:

mc -e /etc/unipi/lte.conf

This file is divided into three sections, some settings (auto_keepon, autoswitch, Log File) are described in detail in separate chapters.

MAIN

(i)

Note:
In older lte.conf versions parameter connection_type was included in apn. If you are using older version without connection_type parameter, it is necessary to set the apn parameter in the following format: apn: “IPV4V6”,“internet”

  • pin: if the SIM is protected by PIN code it is necessary to enter it here, if the SIM is not protected by PIN code just comment the line (with semicolon “;”)
  • apn: Access Point Name ; the default value is the internet, this value can be different and is determined by the operator
  • connection_type: protocol type ; specifies the type of data protocol, possible values are IP, IPV4V6 or IPV6
  • auth_user: user name ; if authentication is required
  • auth_pass: user password ; if authentication is required
  • oneshot: performs only the initialization and then exits
  • reg_timeout: the time in seconds that the modem attempts to register with the operator's network
  • suspend_timeout: delay between modem re-initializations, if an error occurs (default: 34200 seconds, i.e. 12 hours)
  • report_period: frequency with which the periodic report is written to the log (default: 86400 seconds, i.e. 24 hours)
  • auto_keepon: if an accidental disconnection occurs and is set to true, the connection is automatically restored ; this parameter is detailed in the auto_keepon chapter

The auth_method and usbmode parameters are not used and are present only for backward compatibility.

LOG

Logs are stored in the log file for debugging and possible troubleshooting. For a detailed description of the log file, see the Log File chapter.

  • path: location of the log file ; if not defined, messages will be written to the syslog
  • severity: severity of the message to be logged
  • logfile_size: log file size

PING

  • active: enable periodic ping retries to the configured addresses
  • primary_iface: primary network interface
  • fail_threshold: the number of times a connection is attempted before the device switches to the backup network interface
  • ip_eth: the address that the daemon is trying to ping over the ethernet network interface (eth0)
  • ip_lte: the address that the daemon is trying to ping over the lte network interface (wwan0)
  • period: time between contact attempts, 0 → 10s, 1 → 20s, 3 → 40s, etc. ; in 10s increments
  • timeout: time to wait for a response in seconds
  • packetsize: size of the ping sent in packets
  • autoswitch: enable/disable the autoswitch feature, set true to enable, false to disable, see Autoswitch feature for details

Autoswitch feature

When Autoswitch feature is enabled (default state), service unipi-lte automatically selects the default network gateway based on WAN availability on the primary/backup network interface. By default, the primary network interface is fixed Ethernet (eth0) and the LTE interface is the backup connection. The Linux routing table must always contain the default routing for both interfaces. If there is a need to switch between the primary and backup interfaces, the unipi-lte service will automatically increase/decrease the LTE interface metric.

  • IP address from the DHCP server: There is no need to set anything, as the (non-zero) metric is set by the DHCP client.
  • Static IP address: You must always set a non-zero metric value manually, as the default static routing is set to metric 0. The static configuration can be configured via systemd-networkd.

The Autoswitch feature can be disabled in the configuration file in the PING section of the unipi-lte service. Feature is turned on/off by setting the values true/false.

Autokeepon feature

The auto_keepon feature is also available, which automatically enables the LTE network interface when it is accidentally disabled (e.g. by an ifdown command). In this case, the feature re-enables the interface (ifup) and updates the routing table entries. The feature is enabled by default and can be disabled in the configuration file in the MAIN section.

Log File

The log file is invaluable for debugging. By default, all relevant logs from unipi-lte are stored in syslog. The location and severity of the logs can be set in the configuration file in the LOG section.

Example of log file

2023-07-25 08:33:00,047 - INFO - unipi-lte version 0.36 from 2023-03-14 10:19:01 - Logging started..
2023-07-25 08:33:00,052 - INFO - Running on Patron series, model: S167
2023-07-25 08:33:01,067 - INFO - Created/corrected wwan0 iface file
2023-07-25 08:33:02,143 - ERROR - Incorrect or undefined password (PIN). Going to sleep...
2023-07-25 08:33:02,144 - WARNING - Daemon halted forever...must be restarted manually 3
2023-07-25 08:36:06,945 - INFO - Exiting after received signal 15
2023-07-25 08:36:18,065 - INFO - unipi-lte version 0.36 from 2023-03-14 10:19:01 - Logging started..
2023-07-25 08:36:18,071 - INFO - Running on Patron series, model: S167
2023-07-25 08:36:19,084 - INFO - Created/corrected wwan0 iface file
2023-07-25 08:36:20,597 - INFO - Pin resolved
2023-07-25 08:36:36,942 - INFO - Modem init complete
2023-07-25 08:36:37,546 - INFO - Registered to: O2.CZ Network type: 7 RSSI: 31 Sigqual: 99
2023-07-25 08:36:40,562 - INFO - WAN IP ADDRESS: 100.71.129.7 INTERFACE IP ADDRESS: 100.71.129.7
2023-07-26 08:36:18,370 - INFO - RSSI: (MIN 21, MAX 31, AVG 25), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {6} PING_COUNT: 1727 PING_SUCCESS_RATIO: 99.94
2023-07-26 21:55:06,956 - INFO - Ping failure threshold reached 3 on main eth0.Switching to backup wwan0...
2023-07-26 22:06:48,490 - WARNING - Routing table metric mismatch A (changed by other application?), re-setting... 203 202
2023-07-26 22:21:49,183 - WARNING - Routing table metric mismatch A (changed by other application?), re-setting... 203 202
2023-07-26 22:36:47,974 - WARNING - Routing table metric mismatch A (changed by other application?), re-setting... 203 202
2023-07-26 22:47:38,255 - INFO - Main interface eth0 becomes available, switching to it
2023-07-27 08:36:25,783 - INFO - RSSI: (MIN 17, MAX 31, AVG 23), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {4, 6} PING_COUNT: 1727 PING_SUCCESS_RATIO: 99.36
2023-07-28 08:36:33,574 - INFO - RSSI: (MIN 18, MAX 31, AVG 24), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {6} PING_COUNT: 1726 PING_SUCCESS_RATIO: 99.94
2023-07-29 08:36:41,673 - INFO - RSSI: (MIN 21, MAX 31, AVG 24), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {6} PING_COUNT: 1727 PING_SUCCESS_RATIO: 100.00
2023-07-30 08:36:49,334 - INFO - RSSI: (MIN 21, MAX 31, AVG 24), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {6} PING_COUNT: 1727 PING_SUCCESS_RATIO: 99.94
2023-07-31 08:36:57,165 - INFO - RSSI: (MIN 17, MAX 31, AVG 24), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {6} PING_COUNT: 1727 PING_SUCCESS_RATIO: 99.83

  • 2023-07-25 08:33:00: Initialization and start of connection
  • 2023-07-25 08:33:02: Error caused by wrong PIN
  • 2023-07-25 08:36:20: Correct PIN code entered
  • 2023-07-25 08:36:40: Connection to LTE network successfully established
  • 2023-07-25 21:55:06: eth0 network failure, Unipi device switching to backup LTE connection
  • 2023-07-25 22:47:38: eth0 network available again
  • 2023-07-2x 08:36:xx: Periodic report, the frequency of the report can be set with the report_period parameter in the configuration file in the MAIN section.

Disabling/Enabling NAT for LTE modem

By default, NAT is enabled. To turn it off/on, you need to send a specific AT command to the modem via the virtual serial line:

  1. communication is possible via the virtual serial line /run/unipi-plc/by-sys/lte.1/tty_at1 (e.g. by the minicom):
    minicom -D /run/unipi-plc/by-sys/lte.1/tty_at1​
  2. then you need to send the string, depending on the modem variant (see AT commands of the relevant Unipi unit):
    1. for the modems - EG912Y-EU, EC200U-EUAB and EC200U-EUAP:
      AT+QCFG="​nat",​X

      (!)

      Note:
      To disable NAT it is necessary to set parameter 1 instead of X, or parameter 0 to enable it.

    2. for the modems - EG915U-EU and EC200A-EUAH:
      AT+QCFG="nat/cid",0xYY 

      (!)

      Note:
      To disable NAT it is necessary to set parameter 00 instead of YY, or parameter 7F to enable it.

After sending the command and exiting the minicom program, it is necessary to restart the modem for the settings to take effect. Restart is possible e.g. by unplugging/plugging the power supply of the controller.


Note: The string (AT command) must be entered in the exact format, including case sensitivity. A proven method is, for example, to copy the entire AT command string and then paste it into the terminal window running minicom.

Note on minicom: To exit the minicom, press the CTRL+A key combination, followed by the Q key, which brings up a dialog where you still need to confirm the exit.

I want PPP instead of unipi-lte

If you are using PPP for your application and therefore do not want a unipi-lte solution, we also recommend that you disable unipi-lte and remove the network interface definition.

  1. Permanently disable the unipi-lte service by:
    sudo systemctl stop unipi-lte
    sudo systemctl disable unipi-lte
  2. Delete the LTE interface in /etc/systemd/network/ and restart the systemd-networkd service.

(!)

Attention:
This section refers only to Unipi units equipped with GNSS capable modem.

All GNSS AT commands and mapping of GNSS virtual serial line can be found in port mapping of the relevant Unipi unit. The antenna for the GNSS must be connected to the LTE DIV connector.

Configuration of GNSS can be done via virtual serial line tty_at1 similar to NAT configuration. Only difference is used AT commands:

  • Set active antenna mode:
    AT+QGPSPOWER=1
  • Set passive antenna mode:
    AT+QGPSPOWER=0
  • Configure GNSS
    AT+QGPSCFG="setting",value

    for available settings see AT commands documentation.

  • Turning on GNSS:
    AT+QGPS=1
  • Turning off GNSS:
    AT+QGPSEND=1
  • Read positional data:
    AT+QGPSLOC=2

    (!)

    Note:
    Before reading the position for the first time after enabling the GNSS it is necessary to wait for position solution fix. That process of GNSS module can take up to 20 minutes and until its not finished the command will return error code 516.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies