Looking for a guide how to get started with LTE on Mervis IDE? Please see this tutorial, otherwise continue here.
Patron units are shipped with the Mervis OS pre-installed. If you do not want to use Mervis, you must first re-flash the OS on the unit.
This manual refers to the LTE series of Patron units - currently S167, M267 and M567.
sudo su apt-get update apt-get install unipi-lte systemctl enable unipi-lte reboot
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
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 steps 5 to 7.
mc -e /etc/unipi/lte.conf
pin: 1234 ;
IPV4V6
is mandatory, the second parameter is the APN and the correct value is determined by the operator, the default value is internet
: apn: "IPV4V6","internet" ;
reboot
Be patient, registration to the mobile network can take several minutes. When registered, NET LED lights up.
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 |
All LEDs flashing — LTE module is restarting.
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.
pin: 1234 ; Uncomment and set it if SIM pin is active (ignored if SIM is not pin-protected). apn: "IPV4V6","internet" ; APN (depends on your provider) auth_method: 0 ; PPP Authentication: 0 - no auth.(default), 1 - PAP, 2 - CHAP (Axon only feature) auth_user: ; Username for PAP/CHAP auth methods (Axon only feature) auth_pass: ; Password for PAP/CHAP auth methods (Axon only feature) usbmode: 2 ; 2(default) for CDC_ECM + 3x CDC_ACM, 3 for RNDIS + 1x CDC_ACM (Axon only feature) oneshot: false ; LTE modem initialization only. Close ttyACM and exit the dameon. No LED handling! Default: FALSE. reg_timeout: 120 ; In seconds suspend_timeout: 43200 ; In seconds (e.g. 86400 = 24 hours),-1 = suspend forever (goes to HALT mode) report_period: 86400 ; In seconds (e.g. 86400 = 24 hours) auto_keepon: true ; Automatically up the LTE network interface if it goes down accidentally.
IPV4V6
define the APN protocol, it is mandatory and must not be changed or deleted ; the second parameter is the APN, where the default value is the internet
, this value can be different and is determined by the operatorThe auth_method and usbmode parameters are not used and are present only for backward compatibility.
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: /var/log/unipilte.log ; If not defined (commented), syslog is used instead of an user file severity: info ; Severity threshold - debug, info, warning, error, cititical logfile_size: 131072 ; Meaningless if syslog is used
active: True primary_iface: eth0 ; Primary WAN interface. The LTE connection is always a backup one. fail_threshold: 3 ; Default: 3 ip_eth: 8.8.8.8 ; Adress that the daemon pings to via ethernet interface ip_lte: 8.8.8.8 ; Adress that the daemon pings to via lte interface period: 4 ; Ping period given in 10 sec timesteps; 0 - every 10 sec timeout: 2 ; Wait for pong in seconds packetsize: 2 ; Payload size in ping packet autoswitch: true ; MAIN/BACKUP iface switching - set false if LTE is the primary and the ONLY active interface ; Config file signature - do not modify it nor add any lines or whitespaces! ; c3c9959c716370b33d07652529503f6e
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.
In order to switch between the primary and backup interfaces, it is necessary that the metric values of all network interfaces are non-zero positive values.
metric 0
. Metric can be set in the network interface configuration file within etc/network/interfaces.d by inserting a constant, such as metric 5
. # Example of static IP configuration for a unit on a LAN auto eth0 iface eth0 inet static address 192.168.221.188 gateway 192.168.221.1 netmask 255.255.255.0 dns-nameservers 192.168.221.1 metric 5 # Non-zero positive value
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.
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.
The log file is invaluable for debugging. By default, all relevant logs from unipi-lte are stored in /var/log/unipilte.log
. 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
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:
minicom -D /dev/ttyLTE_AT1
AT+QCFG="nat",X
To disable NAT it is necessary to set parameter 1 instead of X, or parameter 0 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.