LoRa Node
38
Chapter 3 Commands for the LoRa Node
The IOT400-DL is a LoRaWAN compliant LoRa node. With proper configuration, it can automatically send out
(report) the status (data) of all the connected meter/sensors to a registered LoRa Network Server through a
certain LoRaWAN gateway(s) at a designated time interval. Moreover, it also can listen for the commands
issued from network server, and take expected action immediately.
3.1 Command Basics
Each command is composed with a formatted data stream. The basic format is outlined as:
Command
Total length
Data[]
Checksum
Command
:
1 byte Command code for the followed data stream.
Total Length
:
1 byte length for the complete command stream, excluding the checksum byte, i.e.,
Length of C Total Data[]
Data[]
:
accompanied data bytes for the issued command.
Checksum
:
Checksum byte for the complete command stream (C Total
Data[]).
Direction:
The MSB of the Command code is defined as a Direction bit. ‘0’ for uplink direction, and ‘1’ for downlink.
For example, command code 0x01 is an uplink command issued from a LoRa node to network server; and 0x81
is a downlink command issued from network server to a LoRa node.
Data Alignment:
Big endian alignment is adapted for the data elements in the byte streams. To extract the value for a multi-
byte element, like word, Integer, or double word, big endian alignment is required.
Checksum Calculation:
A simple checksum calculation is introduced to check the correctness of the command stream that is
transmitted and received wirelessly. Hereunder is the algorithm for Checksum Calculation:
char count_chksum(char *buf, int len){
char ret;
int i;
ret = 0;