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

From Wiki for Dragino Project
Jump to: navigation, search
(Send Text Data)
(Send Text Data)
Line 621: Line 621:
  
 
While Error in format, return  
 
While Error in format, return  
 +
 
AT_BUSY_ERROR/AT_BUSY_ERROR/AT_NO_NETWORK_JOINED
 
AT_BUSY_ERROR/AT_BUSY_ERROR/AT_NO_NETWORK_JOINED
  

Revision as of 01:10, 2 November 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

See Devices User Manual for Device. The user manual can be found in each product page of Dragino Official Website



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



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 3 bytes mode value.

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

  • Example 1: Downlink Payload: 05000001 // Set AT+CFM=1
  • Example 2: Downlink Payload: 05000000 // 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 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+AT+SENDB=12:abcdef0123456789 Send hexadecimal data along with the application port. OK
AT+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

0x05 Enable/Disable Data Confirm Mode

Set end node to use confirm mode or unconfirm mode to uplink payload.

  • Downlink Payload: 05000001, Set AT+CFM=1, use confirm mode to uplink.
  • Downlink Payload: 05000000, set AT+CFM=0, use unconfirm mode to uplink.


0x20 LoRa® Network Join Mode-- ABP or OTAA

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

  • Downlink Payload: 0x2000, Set AT+NJM=O, use ABP mode to uplink.
  • Downlink Payload: 0x2001, Set AT+NJM=1, use OTAA mode to uplink.


0x22 Adaptive Rate

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

  • Downlink Payload: 0x2201, Set AT+ADR=1.
  • Downlink Payload: 0x2200FFFF, Set AT+ADR=0.


0x23 Application Port

Set the application port

  • Example1 : Downlink Payload: 0x2305 // Set AT+PORT=5 .
  • Example2 : Downlink Payload: 0x2317 // Set AT+PORT=23 .


0x24 Eight Channel Mode

Set eight channels mode,Only for US915,AU915,CN470

  • Example : Downlink Payload: 0x24 01 // Set AT+CHE=1 902.3 902.5 902.7 902.9 903.1 903.3 903.5 903.7 .


0x25 UplinkDwellTime

Set UplinkDwellTime

  • Downlink Payload: 0x2500, Set AT+DWELLT=0 to uplink.
  • Downlink Payload: 0x2501, Set AT+DWELLT=1 to uplink.


0x21 Set response level

  • Downlink Payload: 0x2101, Set AT+RPL=1. //Receive an unconfirmed packet and reply with an empty packet to the server.
  • Downlink Payload: 0x210101, Set AT+RPL=1,1. //Receive an unconfirmed packet and reply with 00 packet to the server.


  • Downlink Payload: 0x2102, Set AT+RPL=2. //Receive the confirmed packet and reply an empty packet to the server.
  • Downlink Payload: 0x210201, Set AT+RPL=2,1. //Receive the confirmed packet and reply with 00 packet to the server.


  • Downlink Payload: 0x2103, Set AT+RPL=3. //Receive an ADR packet and reply with an empty packet to the server.
  • Downlink Payload: 0x210301, Set AT+RPL=3,1. //Receive an ADR packet reply to 00 packet to the server.