...
The preferred method to use LoRaWAN is Over The Air Activation (OTAA). When WAN="lorawan"
the device uses the values to perform an OTAA Join with the LoRaWAN Network Server. Make sure the values for DevEUI, JoinEUI, and AppKey match.
ABP - Activation by personalisation
Our devices support activation by personalisation (ABP) when WAN="lorawan-abp"
. This mode is useful for devices that have a bad reception. You will have to synchronise session keys by hand between the device and your Network Server when using ABP.
TODO
LAN Parameters (WAN = "lan")
Connection via LAN/Ethernet is not supported, yet.
Note |
---|
Coming soon! |
Modbus related Parameters
...
The device is manufactured with a globaly unique EUI64 that is used as DevEui. This EUI is printed on the devices label and can be used to identify a device. You can change the DevEUI used for LoRaWAN by changing the configuration parameter DevEUI
. The device will still keep it's unique EUI64 it was delivered with. You can see it in the Log output during booting, even if a different value is used for the DevEUI.
Each Device will be configured with a unique JoinEUI and AppKey that are generated using a cryptographic hashing algorithm. Those values will seem random and are very likely to be unique for each device. These values are known to Lobaro but will not be made public. You can change the AppKey
if you prefere to have Keys that are known only to you. Be sure to use a good random source when generating keys.
ABP - Activation by personalisation
Our devices support activation by personalisation (ABP) when WAN="lorawan-abp"
. This mode is useful for devices that have a bad reception. You will have to synchronise session keys by hand between the device and your Network Server when using ABP.
When using ABP, the device will use the parameters DevEUI
and AppKey
for genrating the session parameters:
DevAddr
will consist of the last for bytes ofDevEUI
NetSKey
will be cryptographically derived fromAppKey
AppSKey
will be cryptographically derived fromAppKey
The Values will be printed out in the Log after boot, so you can copy them to the configuration in your Network Server. Do change the DevAddr
, alter the DevEUI
value in the configuration. To create a different pair of session keys, change the value of AppKey
in the configuration. Best practise is, to change it to randomly generated bytes comming from a good random source. The generated Session Keys will be deterministic for a given value of AppKey
, even if used on different devices.
LAN Parameters (WAN = "lan")
Connection via LAN/Ethernet is not supported, yet.
Note |
---|
Coming soon! |
Modbus related Parameters
Name | Description | Default Value | Values Description & Examples |
---|---|---|---|
MbCmd | List of Modbus Commands with Cron and Modbus parameters (see below). | 0 0/5 * * * *:R,9600,8N1:010300000003 | One or more entries of Modbus commands to be executed by the device. Each entry starts with a Cron expression defining when to execute the commands followed by the bus parameters used to address the Modbus slave devices. Each entry can contain multiple commands. See description below for a detailed explanation. † |
† See also our Introduction to Cron expressions.
MbCmd
defines, what Modbus commands are executed on the Bus, when, and what Modbus Configuration to use for them. The configuration is very flexible and allows complex setups, that include executing different commands at individual intervals or times or using multiple diffent Modbus parameters to address incompatible Slaves on the same installation. Any Modbus command can be sent, including writing registers or diagnostic messages.
The default value of 0 0/5 * * * *:R,9600,8N1:010300000003
shows a very basic example with a single entry executed every 5 minutes using Modbus RTU to read 3 consecutive holdingregisters from a single slave device.
The parameter consists of up to 32 entries, separated by semicolons. Each entry consists of thre parts, separated by colons: its individual Cron expression, the Modbus configuration used, and the Modbus commands to be executed. Each entry can have multiple Modbus commands to execute on activation, separated by comma. A Modbus command must be written as the Bytes to be sent on the bus in Hex notation. The Checksums will be added my the device according to the protocol used.
Code Block | ||
---|---|---|
| ||
MbCmd = "<Entry1>;<Entry2>;...;<Entry32>"
Entry = "<Cron>:<MbParm>:<Command1>,<Command2>,...,<CommandN>"
MbParm = "<Protocol>,<Baud>,<SymbolCfg>"
Protocol = "R" for Modbus RTC, "A" for Modbus ASCII
Baud = Baud rate, any of: 2400, 4800, 9600, 19200, 38400, 57600, 115200
SymbolConfig = Token string defining Data Length, Parity, and Stop Bits. Any of: "7E1", "7E2", "8N1", "8N2"
Command = "<bytes to be sent in hex without checksum>" |
Examples
Code Block |
---|
Example A:
"0 0/5 * * * *:R,9600,8N1:010300000003"
Entry 1:
Cron: "0 0/5 * * * *": Execute entry every 5 minutes, on minutes 0, 5, 10, 15, ..., 55
Config: "R,9600,8N1": Use Modbus RTU on 9600 Baud, Datalength: 8, Parity: None, 1 stop bit
Commands:
"010300000003": Read 3 holding registers of Slave 1, starting at register 0
Example B:
"0 * * * * *:A,9600,7E1:0e0400100004,0f400100004;0 0 * * * *:A,9600,7E1:0e0400200020"
Entry 1:
Cron: "0 * * * * *": Execute entry every full minute
Config: "A,9600,7E1": Use Modbus ASCII on 9600 Baud, Datalength:7, Parity: Even, 1 stop bit
Commands:
"0e0400100004": Read 4 input registers of Slave 14, starting at register 16
"0f0400100004": Read 4 input registers of Slave 15, starting at register 16
Entry 2:
Cron: "0 0 * * * *": Execute entry every full hour
Config: "A,9600,7E1": Use Modbus ASCII on 9600 Baud, Datalength:7, Parity: Even, 1 stop bit
"0e040a800020": Read 32 input registers of Slave 14, starting at register 2688
|
Modes of operation (work cycle)
Note |
---|
Subject to change! This product is still very young and exprience might lead to adjustments in the future. |
This chapter explains how the device starts and works to collect and upload data.
Startup process
The starting process of the device is linear and executed the following steps in the order given here. The startup is triggered on power on or after a reset was triggered; this can happen over the reset button, by using the lobaro tool over the config adapter, by sending a reboot command via downlink, of if a fatal error occurs during opeartion of the device.
- On power on (or after a reset), the device will start by verifying the signature of the installed firmware. It will only continue the boot process if the signature is valid.
- The device will then activate the Arm TrustZone of its central processor, to prepare an isolated environment for the actual firmware to run. This activates hardware security mechanisms that protect the device from a wide range of errors and manipulations while it is running.
- Only then, the application program is started, having restricted access to the hardware.
- The application reads and outputs the configuration parameters programmed into it and verifies the configuration does not contain any obious errors (like invalid syntax or impossile value combinations). If any fatal errors exist, the device will output information about it in the Log and then reboot, so that you spot invalid configurations directly when you set them.
- At this point the RGB-LED starts to continuously output the state of the Modbus connection and the connection to the backend.
- The device will try and execute every Modbus command from every entry in the configuration parameter
MbCmd
, using the Modbus configuration of the entry (writing operations are skipped to avoid side effects). This allows you to check your Modbus configuration and the connection to the slave devices early on boot and even without a config adapter attached. The device will continue execution, even if the Modbus Commands fail, so that you can check the connection to the backend even when not connected to the Modbus slaves. - After testing Modbus, the device will try to connect to the network for connection to the backend. The exact action will depend on your configuration:
- For NB-IoT or LTE-M the Gateway will activate its Modem and try to attach to the mobile provider. If that succeeds, it will try to connect to the backend configured (normaly an instance of the Lobaro Platform). If that succeeds, the device will upload some information about itself to the backend (including its configuration) and than synchronise its internal clock over the connection. Only if all this succeeds, the device will move on.
- For LoRaWAN with OTAA, the device will perform an OTAA Join operation with the LoRaWAN Network Server. If that succeeds, the device will upload a Status Message that will also be used to synchronise its internal clock with the network. Only if that succeeds, the device will move on. On failure, the device will retry with increasing timeouts to perform the join operation and time sync, until it succeeds.
- For LoRaWAN with ABP there is no explicit joining operation, as the session must already exist between Network Server and Device. It simply uploads a Status Message that will also be used to synchronise the internal clock. If the synching fails multiple times, the device will skip synchronisation and just move on to start normal operations. Be aware that this can lead to the Device operating with a clock that does not match real time. The Modbus Commands will be executed according to that clock, which will most likely not be consistent with what you expect. This exception is introduced on purpose, as ABP is meant to make the device usable in locations, where there is poor downlink reception from the Network, where an OTAA Join cannot be performed, but Uplink messages still might be comming through to the Network. The device will continue to try and synchronise its clock every day and might succeed at some point in the future. The changing of the clock will be compensated as well as possible, but the exact times when commands are executed is most likely to change at that point.
- When the connection to the backend has been established (this is not certain to have succeeded when using LoRaWAN ABP), the device will start its internal scheduler and will from this moment on be running in normal operation mode.
Normal operation
The actions executed by the device during normal operation are controlled by a scheduler that executes a list of jons whenever it is their time to run. Only a single job will be executed at any time, so if a job is running for some time, other jobs will be executed delayed (but the execution will not be skipped). Each entry you add to the MbCmd
config parameter will have its own job in the scheduler. The Cron Expression of the entry will control, how often and when the job will be executed. In addition to that there will be a Status job which runs once every day and triggers the upload of a status message which will also perform a clock synchronisation. When your configuration has multiple entries that are scheduled for the same time, they will be executed in the order you put them in the configuration.
The jobs will generate uplink messages that need to be uploaded. Those will be queued and upload in the order they are generated. The device will continue to execute jobs while handling uploads. When uplinks are generated faster than they can be sent, the queue will run full and new uplinks will be dropped silently. This is most likely to happen when using LoRaWAN on higher spreading factors, as the Gateway can read data over Modbus much faster than it can be sent over LoRaWAN.
After each uplink sent, the device will look for downlinks comming from the Network (this is done for both, LoRaWAN and LTE configurations). Downlinks can contain remote commands controlling the device (like configuration changes, reboot requests, or (for LTE only) remote firmware updates). There can also be Modbus commands sent via Downlink that will be executed on the bus by the Gateway directly (the response from the slave will be sent as Uplink). Downlink Modbus commands are currently only supported for LoRaWAN.
The daily Status message Uplink makes sure that the device can be reached for remote configuration within 24 hours, independent of the current configuration.
Changing configuration or performing a firmware update will result in the Gateway rebooting. We try our best to keep our devices from ever reaching a state that makes them unreachable. A new configuration set via Downlink will be temporary until a connection to the Network can be established again. If the new conguration fails to connect to the Network, the previous configuration is restored
† See also our Introduction to Cron expressions.
MbCmd
defines, what Modbus commands are executed on the Bus, when, and what Modbus Configuration to use for them. The configuration is very flexible and allows complex setups, that include executing different commands at individual intervals or times or using multiple diffent Modbus parameters to address incompatible Slaves on the same installation. Any Modbus command can be sent, including writing registers or diagnostic messages.
The default value of 0 0/5 * * * *:R,9600,8N1:010300000003
shows a very basic example with a single entry executed every 5 minutes using Modbus RTU to read 3 consecutive holdingregisters from a single slave device.
The parameter consists of up to 32 entries with individual Cron expression and Modbus configuration. Multiple entries are separated by semicolon. Each entry can have multiple Modbus commands to execute on activation, separated by comma.
Code Block | ||
---|---|---|
| ||
MbCmd = "<Entry1>;<Entry2>;...;<Entry32>"
Entry = "<Cron>:<MbParm>:<Command1>,<Command2>,...,<CommandN>
MbParm = "<Protocol>,<Baud>,<SymbolCfg>"
Protocol = "R" for Modbus RTC, "A" for Modbus ASCII
Baud = Baud rate, any of: 2400, 4800, 9600, 19200, 38400, 57600, 115200
SymbolConfig = Token string defining Data Length, Parity, and Stop Bits. Any of: "7E1", "7E2", "8N1", "8N2"
Command = "<bytes to be sent in hex without checksum>" |
Modes of operation (work cycle)
Note |
---|
Subject to change! |
This chapter explains how the device works to collect and upload data.
...
.
Mobile data consumption
Uploading one uplink with 400 bytes including all metadata (might be less, depending on the configuration).
...