{{page>en:hw:004-edge:edge-in-development-hidden}} ====== LTE ====== #;; Edge #;; {{ :files:img_warning-line_b.png?nolink |}} {{ :en:hw:08_safety-instructions_pseudo-ISO-7010-info.png?nolink |(i)}} **Note:** \\ This article refers only to Unipi Edge units equipped with LTE modem. {{ :files:img_warning-line_b.png?nolink |}} {{ :en:hw:08_safety-instructions_pseudo-ISO-7010-info.png?nolink |(i)}} Looking for a guide how to get started with LTE on **Mervis IDE**? Please see [[en:sw:01-mervis:lte-configuration-hidden|this tutorial]], otherwise continue here. \\ General settings and functions for LTE daemon are described in [[en:automation:lte-deamon-hidden]]. Optional variants of LTE: * Without LTE * LTE Cat 1 (EC200U-EUAB) * LTE Cat 4 (EC200A-EUHA) * LTE Cat 1 with GNSS (EC200U-EUAP) ===== Port mapping ===== {{page>en:hw:004-edge:06-peripherals:lte-portmap-table-hidden}} ===== Overview of the functions and states of the indication LEDs ===== {{page>en:hw:lte_led_description-hidden}} ===== Technical parameters ===== /* toto by se mělo přesunout do edge NS */ {{page>en:hw:technical-parameters-edge-lte-hidden}} /* DELETEME ===== Quick-start guide ===== - Insert a micro-sim supporting LTE connectivity into the slot - Power up the unit and connect [[en:files:software:tools:putty-hidden?tns|via SSH]] /* DELETEME - Install the **unipi-lte** package:sudo su apt-get update apt-get install unipi-lte systemctl enable unipi-lte reboot - 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 {{ :files:img_warning-line_b.png?nolink |}} {{ :en:hw:08_safety-instructions_pseudo-ISO-7010-info.png?nolink |(!)}} **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 next steps. - Start editing the **lte.conf** file, e.g. with Midnight Commander: mc -e /etc/unipi/lte.conf - If the SIM card is PIN protected, set the correct PIN and uncomment the line: pin: 1234 ; - **The APN setting is mandatory** (if this line is missing or commented out, the LTE service is disabled). The parameter is the APN and the correct value is determined by the operator, the default value is ''internet'': apn: "internet" ; - Save and exit editing the file and restart the unit with the command: reboot /* - Set connection type. Default value is **IP** meaning only IPv4 connection. Alternatives are **IPV6** (IPv6 only) and **IPV4V6** (handles dual IP stack User Equipment capability). connection_type: IP ; ---- {{ :files:img_warning-line_b.png?nolink |}} {{ :en:hw:08_safety-instructions_pseudo-ISO-7010-info.png?nolink |(!)}} **Note:** \\ Be patient, registration to the mobile network can take several minutes. When registered, NET LED lights up. ---- - During normal operation, "Mobile network" LED indicators SIM, NET, INT should be ON while blinking SIG indicates signal strength. [[#overview_of_the_functions_and_states_of_the_indication_leds|See LED Indicators table]]. - In case of any problem, we recommend to check the syslog. For a persistent log, first set up the unipi-lte service log file. The logging setup is described in detail in the [[#log_file|Log File]] chapter. ===== Overview of the functions and states of the indication LEDs ===== {{page>en:hw:lte_led_description-hidden}} ===== Useful hints ===== * for optimal signal strength **it is necessary to use an external antenna** installed in an open area (eg. outside any enclosures). Antenna can be [[https://www.unipi.technology/others-c42|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 [[#ping|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 [[#ping|configuration file in the PING]] section. ===== Detailed information ===== ==== 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 ([[#autokeepon_feature|auto_keepon]], [[#autoswitch_feature|autoswitch]], [[#log_file|Log File]]) are described in detail in separate chapters. === MAIN === /* pin: 1234 ; Uncomment and set it if SIM pin is active (ignored if SIM is not pin-protected). apn: "internet" ; APN (depends on your provider) connection_type: IPV4V6 ; type of the network interface, can be IP, IPV4V6 or IPV6 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. * **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 **;** it is mandatory and must not be changed or deleted **;** 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 * **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 between 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 [[#autokeepon_feature|auto_keepon]] chapter The **auth_method** and **usbmode** parameters are not used and are present only for backward compatibility. === LOG === By default, logs are written to the syslog, but by changing the LTE configuration, logs can be written to a persistent log file for debugging and troubleshooting. For a detailed description of the log file, see the [[#log_file|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 * **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: 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 * **active**: enable periodic ping retries to the configured addresses * **primary_iface**: primary network interface (eth0, eth1, wwan0, etc.) * **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**, **eth1**) * **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|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. 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**. * __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''. /* Metric can be set in the network interface configuration file within ** //etc/network/interfaces.d// ** by inserting a constant, such as ''metric 5''. \\ For interface eth0, the contents of the file ** //etc/network/interfaces.d/eth0// ** with static IP configuration will look something like this: \\ # 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 [[#ping|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. In this case, the feature re-enables the interface and updates the routing table entries. The feature is enabled by default and can be disabled in the [[#main|configuration file in the MAIN]] section. ==== Log File ==== The log file is invaluable for debugging, but by default the logs are written to (non-persistent) syslog. For debugging purposes it is advisable to set the log as persistent, which is possible by setting the location of the log file in the LTE configuration [[#log|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 [[#main|configuration file in the MAIN]] section. ===== Advanced options ===== ==== 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: - 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​ - then you need to send the string, depending on the modem variant(see [[#port_mapping|AT commands]]): - for CAT 1: AT+QCFG="​nat",​X {{ :files:img_warning-line_b.png?nolink |}}{{ :en:hw:08_safety-instructions_pseudo-ISO-7010-info.png?nolink |(!)}}**Note:** \\ To disable NAT it is necessary to set parameter **1** instead of **X**, or parameter **0** to enable it. - for CAT 4: AT+QCFG="nat/cid",0xYY {{ :files:img_warning-line_b.png?nolink |}}{{ :en:hw:08_safety-instructions_pseudo-ISO-7010-info.png?nolink |(!)}}**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 /*, or by restarting the **unipi-lte** service . ---- **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. - Permanently disable the unipi-lte service by: sudo systemctl stop unipi-lte sudo systemctl disable unipi-lte - Delete the LTE interface in ** /etc/systemd/network/** and restart the systemd-networkd service. ==== Configuration of GNSS ==== {{ :files:img_warning-line_b.png?nolink |}} {{ :en:hw:09_safety-instructions_pseudo-ISO-7010-attention.png?nolink |(!)}} **Attention:** \\ This section refers only to Unipi Edge units equipped with GNSS capable modem. /* See [[..:#part_number_description|overview]] for more details. All GNSS AT commands and mapping of GNSS virtual serial line can be found in [[#port_mapping|Port mapping]]. 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 [[#disabling_enabling_nat_for_lte_modem| 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 {{en:hw:004-edge:ec200-gnss-manual.pdf|AT commands documentation}}. * Turning on GNSS: AT+QGPS=1 * Turning off GNSS: AT+QGPSEND=1 * Read positional data: AT+QGPSLOC=2 {{ :files:img_warning-line_b.png?nolink |}} {{ :en:hw:08_safety-instructions_pseudo-ISO-7010-info.png?nolink |(!)}} **Note:** \\ Before reading the position for the first time after enabling the GNSS it is necessary that the antenna is fixed. The fixing process can take up to 20 minutes and until its not done the command will return Error code 516. */