Difference between revisions of "End Device AT Commands and Downlink Commands"

From Wiki for Dragino Project
Jump to: navigation, search
(Set packet receiving response level)
(Set Packet Receiving Response Level)
Line 1,282: Line 1,282:
 
Feature: Get or Set packet receiving response level. This feature is used to set compatible with different LoRaWAN servers. If RPL doesn;t match , user will see strange message in the server portal.  
 
Feature: Get or Set packet receiving response level. This feature is used to set compatible with different LoRaWAN servers. If RPL doesn;t match , user will see strange message in the server portal.  
  
 +
RPL value:
 +
* AT+RPL=0: Device won't immediately reply any downlink commands from platform.
 +
* AT+RPL=1: Device will immediately reply message to Unconfirmed Data Down. Payload is 0x00.
 +
* AT+RPL=2: Device will immediately reply message to Confirmed Data Down. Payload is 0x00 and requied response header for this command.
 +
* AT+RPL=3: Device will immediately reply message to MAC Command. Payload is 0x00 and requied response header for this command.
 +
* AT+RPL=4: Device will immediately reply message to Confirmed Data Down & MAC Command. Payload is 0x00 and requied response header for these two commands.
 +
 +
Case Analyes:
 +
* For Class A devices, AT+RPL=0 is ok. that is defaut settings in software.
 +
* For Class C devices used in ChirpStack, need to set AT+RPL=4 because Chirpstack require immedietely reply message to MAC Command.
 +
* For Class C devices used in TTI, need to set AT+RPL=4 because TTI require immediately reply message to Confirmed Data Down & MAC Command.
  
 
<span CLASS=bluemiddle> AT Command: AT+RPL</span>
 
<span CLASS=bluemiddle> AT Command: AT+RPL</span>

Revision as of 03:51, 5 December 2020

Introduction

Dragino LoRaWAN End Node support two types of AT Commands and Downlink Commands:

  • Common Commands: They should be available for each sensor, such as: change uplink interval, reset device.
  • Sensor Related Commands: Only for special sensor, such as control relay, poll RS485 device.

This page shows the common commands since Dragino LoRaWAN stack DR-LWS-005. Make sure the end node support stack higher than DR-LWS-005 before checking this page.

How to use AT Commands or Downlink command

  • For AT Command , See Devices User Manual for Device. The user manual can be found in each product page of Dragino Official Website
  • For LoRaWAN Downlink: See use note for different serves Servers Note




Support End Node and firmware version

Dragino STM32 base hardware Firmware / LoRaWAN stack list
Model Description Firmware Version ; Stack Version
LSN50-v1, LSN50-V2, Open Source Generic LoRaWAN Sensor Node LSN50 v1.6.0 <--> DR-LWS-003;

LSN50 v1.7.0 <--> DR-LWS-005; --> Support since this version

LBT1, LoRaWAN BLE Indoor Tracker LBT1 v1.0 <--> DR-LWS-005;



System Management Commands

Change Uplink Interval

Feature: Change LoRaWAN End Node Transmit Interval.

AT Command: AT+TDC

AT+TDC
Command Example Function Response
AT+TDC? Show current transmit Interval 30000

OK

the interval is 30000ms = 30s

AT+TDC=60000 Set Transmit Interval OK

Set transmit interval to 60000ms = 60 seconds


Downlink Command: 0x01

Format: Command Code (0x01) followed by 3 bytes time value.

If the downlink payload=0100003C, it means set the END Node’s Transmit Interval to 0x00003C=60(S), while type code is 01.

  • Example 1: Downlink Payload: 0100001E // Set Transmit Interval (TDC) = 30 seconds
  • Example 2: Downlink Payload: 0100003C // Set Transmit Interval (TDC) = 60 seconds



Reboot End Node

Feature: Reboot End Node to perform a new OTAA or ABP Join.

AT Command: ATZ

ATZ: Trig a reset of the MCU
Command Example Function Response
ATZ Reset MCU Device reset and show booting info
LSN50 Device/LoRa ST Module
Image Version: XX
Frequency Band: XX
DevEui= XX XX XX XX XX XX XX XX

<followed by the Tx and Rx information>


Downlink Command: 0x04

Format: Command Code (0x04) followed by FF.

If the downlink payload=04FF, the end node will reboot.

Reset to factory Default

Feature: Reset the parameters to Factory Default, factory default value depends on the firmware settings, the OTAA and ABP keys will reserve after this command.

AT Command: AT+FDR

Reset to factory default
Command Example Function Response
AT+FDR Reset to factory default Device reset to factory default parameters and show booting info
LSN50 Device/LoRa ST Module
Image Version: XX
Frequency Band: XX
DevEui= XX XX XX XX XX XX XX XX
Please set the parameters or reset Device to apply change


Downlink Command: 0x04

Format: Command Code (0x04) followed by FE.

If the downlink payload=04FE, Reset Parameters to Factory Default, Keys Reserve.

Show Firmware Version

Feature: Show firmware version. No downlink command yet.

AT Command: AT+VER

AT+VER: Image Version and Frequency Band
Command Example Function Response
AT+VER=? Show Image version and Frequency Band
1.3 EU868
OK



Show System Configure

Feature: Show All configure. No downlink command yet.

AT Command: AT+CFG

AT+CFG: Print all configurations
Command Example Function Response
AT+CFG Show all configures
AT+DEUI = XX XX XX XX XX XX XX XX
AT+DADDR=XXXXXXXX
……….
AT+RX2WTO=X
AT+CHS=868100000
OK



Keys, IDs and EUIs management

Application EUI

Feature: Get or Set the Application EUI.

AT Command: AT+APPEUI

AT+APPEUI
Command Example Function Response
AT+APPEUI=? Get the Application EUI 00 b3 d5 00 00 00 00 00

OK

AT+APPEUI=00 b3 d5 7e f0 00 4d 34 Set the Application EUI OK


Application Key

Feature: Get or Set the Application Key.

AT Command: AT+APPKEY

AT+APPKEY
Command Example Function Response
AT+APPKEY=? Get the Application Key 00 35 55 55 22 23 55 53 43 24 23 42 34 35 35 35

OK

AT+APPKEY=00 35 55 55 22 23 55 53 43 24 23 42 34 35 35 35 Set the Application Key. OK


Application Session Key

Feature: Get or Set the Application Session Key.

AT Command: AT+APPSKEY

AT+APPSKEY
Command Example Function Response
AT+APPSKEY=? Get the Application Session Key 00 7d dc 73 33 d3 eb 9e 14 38 d5 a4 3e 62 5b e2

OK

AT+APPSKEY=00 7d dc 73 33 d3 eb 9e 14 38 d5 a4 3e 62 5b e2 Set the Application Session Key. (While Error in format, return AT_PARAM_ERROR)

OK


Device Address

Feature: Get or Set the Device Address.

AT Command: AT+DADDR

AT+DADDR
Command Example Function Response
AT+DADDR=? Get the Application Session Key. (While Error in format, return AT_PARAM_ERROR)

A8 40 41 FF

OK

AT+DADDR=A8 40 41 FF Set the Application Session Key. OK


Device EUI

Feature: Get or Set the Device EUI.

AT Command: AT+DEUI

AT+DEUI
Command Example Function Response
AT+DEUI=? Get the Device EUI. 00 44 34 22 33 45 55 55

OK

AT+DEUI=A8 40 41 FF FF 12 34 56 Set the Device EUI. (System will write new value to Device EUI,While Error in format, return AT_PARAM_ERROR)

OK


Network ID

Feature: Get or Set the Network ID.(You can enter this command change only after successful network connection)

AT Command: AT+NWKID

AT+NWKID
Command Example Function Response
AT+NWKID=? Get the Network ID. a8 40 41 ff

OK

AT+NWKID=A8 40 41 FF Set the Network ID. OK


Network Session Key

Feature: Get or Set the Network Session Key

AT Command: AT+NWKSKEY

AT+NWKSKEY
Command Example Function Response
AT+NWKSKEY=? Get the Network Session Key. 00 4f 19 25 52 ce 97 09 d7 fa 84 71 db 51 02 92

OK

AT+NWKSKEY=A8 40 41 FF FF 12 34 56 00 01 02 04 05 06 06 07 Set the Network Session Key. OK


Joining and sending date on LoRaWAN network

Confirm Mode

Feature: Get or Set the confirmation mode (0-1).

AT Command: AT+CFM

AT+CFM
Command Example Function Response
AT+CFM=? Get the confirmation mode 0

OK

AT+CFM=1 Set the confirmation mode OK
AT+CFM=2 Set the confirmation mode While Error in format, return AT_PARAM_ERROR


Downlink Command: 0x05

Format: Command Code (0x05) followed by 2 bytes mode value.

If the downlink payload=0501, it means set end node to use confirm mode, while type code is 05.

  • Example 1: Downlink Payload: 0501 // Set AT+CFM=1
  • Example 2: Downlink Payload: 0500 // Set AT+CFM=0



Confirm Status

Feature: Get confirmation status of the last AT+SEND (0-1).

AT Command: AT+CFS

AT+CFS
Command Example Function Response
AT+CFS=? Get confirmation status 0

OK


Join LoRa® Network

Feature: Join network.

AT Command: AT+JOIN

AT+JOIN
Command Example Function Response
AT+JOIN ? Get imformation. AT+JOIN: Join network

OK

While Error in format, return AT_BUSY_ERROR


LoRa® Network Join Mode

Feature: Get or Set the Network Join Mode. (0: ABP, 1: OTAA).

AT Command: AT+NJM

AT+NJM
Command Example Function Response
AT+NJM=? Get the Network Join Mode 1

OK

AT+NJM=0 Set the Network Join Mode OK
AT+NJM=2 Set the Network Join Mode While Error in format, return AT_PARAM_ERROR


Downlink Command: 0x20

Format: Command Code (0x20) followed by 1 bytes mode value.

If the downlink payload=2000, it means set the Network Join Mode, while type code is 20.

  • Example 1: Downlink Payload: 2000 // Set AT+NJM=O
  • Example 2: Downlink Payload: 2001 // Set AT+NJM=1



LoRa® Network Join Status

Feature: LoRa® Network Join Status.

AT Command: AT+NJS

AT+NJS
Command Example Function Response
AT+NJS=? Get the join status. 0

OK


Print Last Received Data in Raw Format

Feature: Print Last Received Data in Raw Format<port:data>.

AT Command: AT+RECV

AT+RECV
Command Example Function Response
AT+RECV=? print last received data in raw format. 0:

OK


Print Last Received Data in Binary Format

Feature: Print Last Received Data in Binary Format<port:data>.

AT Command: AT+RECVB

AT+RECVB
Command Example Function Response
AT+RECVB=? print last received data in binary format (with hexadecimal values). 2: 0010

OK


Send Text Data

Feature: Send Text Data<port:data>.

AT Command: AT+SEND

AT+SEND
Command Example Function Response
AT+SEND=12:hello world Send text data along with the application port. OK

While Error in format, return

AT_BUSY_ERROR/AT_BUSY_ERROR/AT_NO_NETWORK_JOINED



Send Hexadecimal Data

Feature: Send hexadecimal data along with the application port.

AT Command: AT+SENDB

AT+SENDB
Command Example Function Response
AT+SENDB=12:abcdef0123456789 Send hexadecimal data along with the application port. OK
AT+SENDB=abcdef0123456789 Send hexadecimal data along with the application port. While Error in format, return

AT_PARAM_ERROR AT_BUSY_ERROR/AT_NO_NETWORK_JOINED



LoRaWAN network management

Adaptive Rate

Feature: Get or Set the Adaptive Data Rate setting. (0: off, 1: on).

AT Command: AT+ADR

AT+ADR
Command Example Function Response
AT+ADR=? Get the Adaptive Data Rate setting. 1

OK

AT+ADR=0 Set the Adaptive Data Rate setting. OK
AT+ADR=2 Set the Adaptive Data Rate setting. While Error in format, return

AT_PARAM_ERROR


Downlink Command: 0x22


If the downlink payload=2201, it means setting the adaptive data rate to 1, while type code is 22.

  • Example 1: Downlink Payload: 2201 // Set AT+ADR=1.
  • Example 2: Downlink Payload: 2200FFFF // Set AT+ADR=0.



LoRa® Class

Feature: Get or Set the Device Class(Currently only support class A, class C).

AT Command:AT+CLASS

AT+CLASS
Command Example Function Response
AT+CLASS=? Get the Device Class. A

OK

AT+CLASS=C Set the Device Class. OK



Duty Cycle Setting

Feature: Get or Set the ETSI Duty Cycle setting - 0=disable, 1=enable - Only for testing.

AT Command:AT+DCS

AT+DCS
Command Example Function Response
AT+DCS=? Get the ETSI Duty Cycle setting. 1

OK

AT+DCS=1 Set the ETSI Duty Cycle setting. OK



Data Rate

Feature: Get or Set the Data Rate. (0-7 corresponding to DR_X) .

AT Command: AT+DR

AT+DR
Command Example Function Response
AT+DR=? Get the Data Rate. 5

OK

AT+DR=2 Set the Data Rate. OK



Downlink Command: 0x2200aaFF


If the downlink payload=220001FF, it means setting the data rate to 1, while type code is 22 00 aa FF.

  • Example 1: Downlink Payload: 220001FF // Set AT+DR=1.
  • Example 2: Downlink Payload: 220000FF // Set AT+DR=0.



Frame Counter Downlink

Feature: Get or Set the Frame Counter Downlink.

AT Command:AT+FCD

AT+FCD
Command Example Function Response
AT+FCD=? Get the Frame Counter Downlink. 0

OK

AT+FCD=10 Set the Frame Counter Downlink. (System will write new value to FCD)

OK



Frame Counter Uplink

Feature: Get or Set the Frame Counter Uplink.

AT Command:AT+FCU

AT+FCU
Command Example Function Response
AT+FCU=? Get the Frame Counter Uplink. 0

OK

AT+FCU=10 Set the Frame Counter Uplink. OK



Join Accept Delay1

Feature: Get or Set the Join Accept Delay between the end of the Tx and the Join Rx Window 1 in ms.

AT Command:AT+JN1DL

AT+JN1DL
Command Example Function Response
AT+JN1DL=? Get the Join Accept Delay. 5000

OK

AT+JN1DL=10000 Set the Join Accept Delay. OK



Join Accept Delay2

Feature: Get or Set the Join Accept Delay between the end of the Tx and the Join Rx Window 2 in ms.

AT Command:AT+JN2DL

AT+JN2DL
Command Example Function Response
AT+JN2DL=? Get the Join Accept Delay. 6000

OK

AT+JN2DL=20000 Set the Join Accept Delay. OK



Public Network Mode

Feature: Get or Set the public network mode. (0: off, 1: on)

AT Command:AT+PNM

AT+PNM
Command Example Function Response
AT+PNM=? Get the public network mode. 1

OK

AT+PNM=1 Set the public network mode. (System will write new value to PNM)

OK



Receive Delay1

Feature: Get or Set the delay between the end of the Tx and the Rx Window 1 in ms

AT Command:AT+RX1DL

AT+RX1DL
Command Example Function Response
AT+RX1DL=? Get the delay. 1000

OK

AT+RX1DL=1500 Set the delay. OK



Receive Delay2

Feature: Get or Set the delay between the end of the Tx and the Rx Window 2 in ms

AT Command:AT+RX2DL

AT+RX2DL
Command Example Function Response
AT+RX2DL=? Get the delay. 2000

OK

AT+RX2DL=2500 Set the delay. OK



Rx2 Window Data Rate

Feature: Get or Set the Rx2 window data rate (0-7 corresponding to DR_X)

AT Command:AT+RX2DR

AT+RX2DR
Command Example Function Response
AT+RX2DR=? Get the Rx2 window data rate. 2

OK

AT+RX2DR=6 Set the Rx2 window data rate. OK



Rx2 Window Frequency

Feature: Get or Set the Rx2 window frequency

AT Command:AT+RX2FQ

AT+RX2FQ
Command Example Function Response
AT+RX2FQ=? Get the Rx2 window frequency. 434665000

OK

AT+RX2FQ=434665000 Set the Rx2 window frequency. OK



Transmit Power

Feature: Get or Set the Transmit Power(0-5, MAX:0, MIN:5, according to LoRaWAN Spec, or 40=10dB, 41 = 11dB, …, 50 = 20dB which is out of LoRaWAN spec. )

AT Command:AT+TXP

AT+TXP
Command Example Function Response
AT+TXP=? Get the Transmit Power. 0

OK

AT+TXP=1 Set the Transmit Power. OK



RSSI of the Last Received Packet

Feature: Get or Set the Rx2 window frequency

AT Command:AT+RSSI

AT+RSSI
Command Example Function Response
AT+RSSI=? Get the RSSI of the last received packet. 0

OK


SNR of the Last Received Packet

Feature: Get the SNR of the last received packet

AT Command:AT+SNR

AT+SNR
Command Example Function Response
AT+SNR=? Get the RSSI of the last received packet. 0

OK


Application Port

Feature: Get or set the application port.

AT Command: AT+PORT

AT+PORT
Command Example Function Response
AT+PORT=? Get the application port 21

OK

AT+PORT=21 Set the application port OK


Downlink Command: 0x23

Format: Command Code (0x23) followed by 1 bytes port value.

If the downlink payload=2301, it means set the application port to 1, while type code is 23.

  • Example 1: Downlink Payload: 2301 // set the application port to 1
  • Example 2: Downlink Payload: 2305 // set the application port to 5



Single Channel Mode

Feature:Get or Set Frequency (Unit: Hz) for Single Channel Mode.

AT Command: AT+CHS

AT+CHS
Command Example Function Response
AT+CHS=? Get Frequency for Single Channel Mode 0

OK

AT+CHS=868100000 Set Frequency for Single Channel Mode OK


Eight Channel Mode

Feature: Get or Set eight channels mode,Only for US915,AU915,CN470.

AT Command: AT+CHE

AT+CHE
Command Example Function Response
AT+CHE=? Get eight channels mode 1

902.3 902.5 902.7 902.9 903.1 903.3 903.5 903.7

OK

AT+CHE=1 Set eight channels mode OK


Downlink Command: 0x24

Format: Command Code (0x24) followed by 1 bytes channel value.

If the downlink payload=2401, it means set channel mode to 1, while type code is 24.

  • Example 1: Downlink Payload: 2401 // set channel mode to 1
  • Example 2: Downlink Payload: 2405 // set channel mode to 5



Get or Set RXwindows1 timeout

Feature:Get or Set the number of symbols to detect and timeout from RXwindow1(0 to 255).

AT Command: AT+RX1WTO

AT+ RX1WTO
Command Example Function Response
AT+RX1WTO=? Get RXwindows1 timeout 14

OK

AT+RX1WTO=60 Set RXwindows1 timeout OK


Get or Set RXwindows2 timeout

Feature:Get or Set the number of symbols to detect and timeout from RXwindow2(0 to 255).

AT Command: AT+RX2WTO

AT+ RX2WTO
Command Example Function Response
AT+RX2WTO=? Get RXwindows2 timeout 7

OK

AT+RX2WTO=20 Set RXwindows2 timeout OK


Setting up uplinkdwelltime (as923, au915)

Feature: Get or Set uplinkdwelltime

AT Command: AT+DWELLT

AT+DWELLT
Command Example Function Response
AT+DWELLT=? Get uplinkdwelltime 1

OK

AT+DWELLT=0 Set uplinkdwelltime OK


Downlink Command: 0x25

Format: Command Code (0x25) followed by 1 bytes state value.

If the downlink payload=2501, it means set uplinkdwelltime to 1, while type code is 25.

  • Example 1: Downlink Payload: 2501 // set uplinkdwelltime to 1
  • Example 2: Downlink Payload: 2500 // set uplinkdwelltime to 0



Set Packet Receiving Response Level

Feature: Get or Set packet receiving response level. This feature is used to set compatible with different LoRaWAN servers. If RPL doesn;t match , user will see strange message in the server portal.

RPL value:

  • AT+RPL=0: Device won't immediately reply any downlink commands from platform.
  • AT+RPL=1: Device will immediately reply message to Unconfirmed Data Down. Payload is 0x00.
  • AT+RPL=2: Device will immediately reply message to Confirmed Data Down. Payload is 0x00 and requied response header for this command.
  • AT+RPL=3: Device will immediately reply message to MAC Command. Payload is 0x00 and requied response header for this command.
  • AT+RPL=4: Device will immediately reply message to Confirmed Data Down & MAC Command. Payload is 0x00 and requied response header for these two commands.

Case Analyes:

  • For Class A devices, AT+RPL=0 is ok. that is defaut settings in software.
  • For Class C devices used in ChirpStack, need to set AT+RPL=4 because Chirpstack require immedietely reply message to MAC Command.
  • For Class C devices used in TTI, need to set AT+RPL=4 because TTI require immediately reply message to Confirmed Data Down & MAC Command.

AT Command: AT+RPL

AT+RPL
Command Example Function Response
AT+RPL=? Get packet receiving response level 1

OK

AT+RPL=0 Set packet receiving response level OK


Downlink Command: 0x21

Format: Command Code (0x21) followed by 1 bytes level value.

If the downlink payload=2101, it means set packet receiving response level to 1, while type code is 21.

  • Example 1: Downlink Payload: 2101 // set packet receiving response level to 1
  • Example 2: Downlink Payload: 2102 // set packet receiving response level to 2