Skip to main content

RAK7201 AT Command Manual

Overview

The configuration of the RAK WisNode Button can be done by AT commands send by RAK Serial Tool through a USB cable between a PC and the button.

NOTE

To use the AT commands to configure the RAK WisNode Button you need to activate the Configuration Mode. To activate it press the number 1 key for 3 seconds. All four LED’s will light in blue. After that, you can use the Serial Tool to send AT commands.

AT Commands Basics

The maximum length of an AT command string is 255 characters (including "\r\n").

The command must start with "at+" and end with <CR><LF> ("\r\n").

NOTE

Adding \r\n at the end of every AT command is not required if the RAK Serial Tool is used. All commands in this manual will be described without \r\n added as the RAK Serial Tool is used.

AT commands can be divided into:

  • Read commands - Read the configuration or status of the device, the general format is:

    at+get_config=<m>:<m>

    The command name and the parameter are separated by "=". If multiple parameters are included, they are separated by ":".

  • Write commands - Write/modify the device configuration, the general format is:

    at+set_config=<m>:<n>

    The command name and the parameter are separated by "=". If there are multiple parameters, they are separated by ":".

  • Other commands - There are some commands, neither read nor write. For example, the command for LoRa to send data is:

    at+send=lora:<m>:<n>

Command responses:

  • When the execution of the command is successful:
OK [information]

Read command response will start with "OK", followed by the obtained information. A write command response will contain just "OK".

Some special commands will trigger module restart. For example, the command "at+set_config=device:restart". It ends with "Initialization OK", in the following format:

[information]
Initialization OK
  • When the command configuration is unsuccessful:
ERROR: <error code>

The response will start with "ERROR:" followed by the error code.

Error Code Meaning

Error CodeMeaning
1The last command received is an unsupported AT command.
2An invalid parameter in the AT command.
3There is an error when reading or writing the flash memory.
5There is an error when sending data through the UART port.
80The LoRa transceiver is busy, could not process a new command.
81LoRa service is unknown. Unknown MAC command was received by the node. Execute commands that are not supported in the current state, such as sending the "at+join" command in P2P mode.
82The LoRa parameters are invalid.
83The LoRa frequency is invalid.
84The LoRa data rate is invalid.
85The LoRa frequency and data rate are invalid.
86The device hasn’t joined a LoRa network.
87The length of the packet exceeded the maximum allowed by the LoRa protocol.
88The service is closed by the server. Due to the limitation of the duty cycle, the server will send the "SRV_MAC_DUTY_CYCLE_REQ" MAC command to close the service.
89This is an unsupported region code.
90The duty cycle is restricted. Due to duty cycle, data cannot be sent at this time until the time limit is removed.
91No valid LoRa channel could be found.
92No available LoRa channel could be found.
93Status is an error. Generally, the internal state of the protocol stack is wrong.
94Time out reached while sending the packet through the LoRa transceiver.
95Time out reached while waiting for a packet in the LoRa RX1 window.
96Time out reached while waiting for a packet in the LoRa RX2 window.
97There is an error while receiving a packet during the LoRa RX1 window.
98There is an error while receiving a packet during the LoRa RX2 window.
99Failed to join into a LoRa network.
100Duplicated down-link message detected. A message with an invalid down-link count was received.
101The payload size is not valid for the current data rate.
102There were many downlink packets lost.
103Address fail. The address of the received packet does not match the address of the current node.
104Invalid MIC was detected in the LoRa message.

General AT Commands

at+version

This command is used to read the version number of the current firmware.

Command typeCommandResponse
Readat+versionOK <version>

Parameter: None

Example:

at+version
OK V1.0.0.101520_RC

at+help

This command lists all AT commands supported by the current firmware.

Command typeCommandResponse
Readat+helpOK <all AT commands>

Parameter: None

Example:

at+help
OK Device AT commands:
at+version
at+help
at+set_config=device:restart
at+get_config=device:status
at+heartbeat=<interval>
at+button=<button>:<port>:<data>
LoRaWAM AT commands:
at+join
at+send=lora:<port>:<data>
at+set_config=lora:region:<region>
at+get_config=lora:channel
at+set_config=lora:dev_eui:<deveui>
at+set_config=lora:app_eui:<appeui>
at+set_config=lora:app_key:<appkey>
at+set_config=lora:dev_addr:<devaddr>
at+set_config=lora:apps_key:<appskey>
at+set_config=lora:nwks_key:<nwkskey>
at+set_config=lora:join_mode:<mode>
at+set_config=lora:ch_mask:<channel>:<mask>
at+set_config=lora:confirm:<confirm>
at+set_config=lora:dr:<dr>
at+set_config=lora:tx_power:<power>
at+set_config=lora:adr:<adr>
at+get_config=lora:status
at+set_config=lora:default_parameters

at+set_config=device:restart

This command is used to restart the device.

Command typeCommandResponse
Writeat+set_config=device:restart

Parameter: None

Example:

at+set_config=device:restart
RAK Button version:1.0.0.101520_RC
Initialization OK

at+get_config=device:status

This command is used to query the key content of the device.

Command typeCommandResponse
Readat+get_config=device:statusOK <information>

Parameter: None

Example:

at+get_config=device:status
OK Board Core:RAK4270
MCU:STM32L071KB
LoRa chip:SX1262
Heartbeat interval time : 1 h
Button1 Port:1 Information: 1234
Button2 Port:1 Information: 1234
Button3 Port:1 Information: 1234
Button4 Port:1 Information: 1234

at+heartbeat=<interval>

This command is used to configure the device's heartbeat. The heartbeat is used to send a packet to the Server at a defined period. This command is disabled by default.

Command typeCommandResponse
Writeat+heartbeat=<interval>OK

Parameter:

ParameterDescription
intervalHeartbeat sending interval, value range 1-120, unit hours. 0 = disable.

Example:

at+heartbeat=1
OK

at+button=<button>:<port>:<data>

This command is used to configure every button frame port and data.

Command typeCommandResponse
Otherat+button=<button>:<port>:<data>OK

Parameter:

ParameterDescription
buttonSet the key for sending data, range 1-4.
portThe sending port of LoRa, the value range is 1-223.
dataThe data to be sent by the key, max. 10 characters.

Example: Configure button 1 to send data 1234 on frame port 1.

at+button=1:1:1234
OK

LoRaWAN AT Commands

at+join

This instruction is used to join the LoRaWAN network.

Command typeCommandResponse
Otherat+joinOK Join Success

Parameter: None

Example:

at+join
OK Join Success

at+send=lora:<port>:<data>

This command is used to manually send data through LoRaWAN.

Command typeCommandResponse
Otherat+send=lora:<port>:<data>OK

Parameter:

ParameterDescription
portThe sending port of LoRa, the value range is 1-223.
dataThe data to be sent has a maximum length of 10 characters.

Example:

  • When the sent data is an unconfirmed type:
at+send=lora:1:5A00
OK
  • When the sent data is a confirmed type:
at+send=lora:1:5A00
OK
RX RSSI:-105 SNR:-12

When the confirmed type is used, the node will receive an ACK response from the Network. The received message is constructed by the reception parameters. In the exemplary response "RX RSSI:-105 SNR:-12" "-105" represents the RSSI and "-12" represents the SNR.

at+set_config=lora:region:<region>

This command is used to set the corresponding working frequency band. The default is EU868.

Command typeCommandResponse
Writeat+set_config=lora:region:<region>OK

Parameter:

ParameterDescription
regionIN865, EU868, US915, AU915, KR920, AS923.

Example:

at+set_config=lora:region:EU868
OK

at+get_config=lora:channel

This command is used to read all LoRa channel information of the current region of the device.

Command typecommandanswer
Readat+get_config=lora:channelOK <channel information>

Parameter: None

Example:

at+get_config=lora:channel
OK *0,on,868100000,0,5; *1,on,868300000,0,5; *2,on,868500000,0,5; 3,off,0,0,0; 4,off,0,0,0; 5,off,0,0,0; 6,off,0,0,0; 7,off,0,0,0; *8,on,867100000,0,5; *9,on,867300000,0,5; *10,on,867500000,0,5; *11,on,867700000,0,5; *12,on,867900000,0,5; 13,off,0,0,0; 14,off,0,0,0; 15,off,0,0,0

The example is for the EU868 region. In "*0, on,868100000,0,5" as an example, the channel parameter analysis is: "*" if the channel is open, there will be this mark in front; "0" is the number of the channel; "on" means that the channel is currently open; "868100000" is the actual frequency of the channel, in Hz; "0,5" means the DR range of the channel is DR0~DR5.

at+set_config=lora:ch_mask:<channel_number>:<status>

This command is used to set a channel in the current region to open or close.

Command typeCommandResponse
Writeat+set_config=lora:ch_mask:<channel_number>:<status>OK

Parameter:

ParameterDescription
channel_numberChannel number.
status0 = close, 1 = open.

Example:

at+set_config=lora:ch_mask:0:0
OK

at+set_config=lora:dev_eui:<dev_eui>

This command is used to set the parameter Device EUI.

Command typeCommandResponse
Writeat+set_config=lora:dev_eui:<dev_eui>OK

Parameter:

ParameterDescription
dev_euiDevice EUI.

Example:

at+set_config=lora:dev_eui:3530353064377716
OK

at+set_config=lora:app_eui:<app_eui>

This command is used to set the parameter Application EUI.

Command typeCommandResponse
Writeat+set_config=lora:app_eui:<app_eui>OK

Parameter:

ParameterDescription
app_euiApplication EUI.

Example:

at+set_config=lora:app_eui:0000000000000001
OK

at+set_config=lora:app_key:<app_key>

This command is used to set the parameter Application Key.

Command typeCommandResponse
Writeat+set_config=lora:app_key:<app_key>OK

Parameter:

ParameterDescription
app_keyApplication Key.

Example:

at+set_config=lora:app_key:841986913ACD00BBC2BE2479D70F3228
OK

at+set_config=lora:dev_addr:<dev_addr>

This command is used to set the Device Address parameter of LoRaWAN.

Command typeCommandResponse
Writeat+set_config=lora:dev_addr:<dev_addr>OK

Parameter:

ParameterDescription
dev_addrDevice Address.

Example:

at+set_config=lora:dev_addr:260125D7
OK

at+set_config=lora:apps_key:<apps_key>

This command is used to set the parameter Application Session Key.

Command typeCommandResponse
Writeat+set_config=lora:apps_key:<apps_key>OK

Parameter:

ParameterDescription
apps_keyApplication Session Key.

Example:

at+set_config=lora:apps_key:841986913ACD00BBC2BE2479D70F3228
OK

at+set_config=lora:nwks_key:<nwks_key>

This command is used to set the parameter Network Session Key.

Command typeCommandResponse
Writeat+set_config=lora:nwks_key:<nwks_key>OK

Parameter:

ParameterDescription
nwks_keyNetwork Session Key.

Example:

at+set_config=lora:nwks_key:69AF20AEA26C01B243945A28C9172B42
OK

at+set_config=lora:join_mode:<mode>

This command is used to set the network access mode of LoRaWAN to OTAA or ABP. It is set to OTAA by default.

Command typeCommandResponse
Writeat+set_config=lora:join_mode:<mode>OK

Parameter:

ParameterDescription
modeNetwork access mode, 0 = OTAA, 1 = ABP.

Example:

at+set_config=lora:join_mode:1
OK

at+set_config=lora:confirm:<type>

This command is used to set the type of data sent to confirmed or unconfirmed. It is set to unconfirmed data by default.

Command typeCommandResponse
Writeat+set_config=lora:confirm:<type>OK

Parameter:

ParameterDescription
type0 = Unconfirmed package, 1 = Confirmed package.

Example:

at+set_config=lora:confirm:0
OK

at+set_config=lora:dr:<dr>

This command is used to set the data rate (DR).

Command typeCommandResponse
Writeat+set_config=lora:dr:<dr>OK

Parameter:

ParameterDescription
drThe data rate is related to the current region. In most LoRaWAN regions, 0~5 are commonly used. For details, please refer to the LoRaWAN 1.0.2 specification.

Example:

at+set_config=lora:dr:0
OK

at+set_config=lora:tx_power:<tx_power>

This command is used to set the transmit power level of the device.

Command typeCommandResponse
Writeat+set_config=lora:tx_power:<tx_power>OK

Parameter:

ParameterDescription
tx_powerThe transmit power level will depend on the frequency band and DR. For details, please refer to the LoRaWAN 1.0.2 specification or Appendix 2 of this document. The default is 0, which is the maximum transmit power.

Example:

at+set_config=lora:tx_power:0
OK

at+set_config=lora:adr:<status>

This command is used to set the Adaptive Data Rate parameter on or off. It is on by default.

Command typeCommandResponse
Writeat+set_config=lora:adr:<status>OK

Parameter:

ParameterDescription
status0 = off, 1 = on.

Example:

at+set_config=lora:adr:0
OK

at+get_config=lora:status

This command is used to obtain all current LoRa status information (except channel information).

Command typeCommandResponse
Readat+get_config=lora:statusOK <lora status details>

Parameter: None

Example:

at+get_config=lora:status
OK Work Mode: LoRaWAN
Region: EU868
MulticastEnable: false
DutycycleEnable: false
Send_repeat_cnt: 0
Join_mode: OTAA
DevEui: AC1F09FFFE013644
AppEui: BBB09D997EB51030
AppKey: AC1F09FFFE013644AC1F09FFF9157201
Class: A
Joined Network:false
IsConfirm: confirm
AdrEnable: false
EnableRepeaterSupport: false
RX2_CHANNEL_FREQUENCY: 869525000, RX2_CHANNEL_DR:0
RX_WINDOW_DURATION: 3000ms
RECEIVE_DELAY_1: 1000ms
RECEIVE_DELAY_2: 2000ms
JOIN_ACCEPT_DELAY_1: 5000ms
JOIN_ACCEPT_DELAY_2: 6000ms
Current Datarate: 5
Primeval Datarate: 5
ChannelsTxPower: 0
UpLinkCounter: 0
DownLinkCounter: 0

at+set_config=lora:default_parameters

This command is used to restore the factory settings in OTAA or ABP.

Command typeCommandResponse
Writeat+set_config=lora:default_parametersOK

Parameter: None

Example:

at+set_config=lora:default_parameters
OK

Appendix 1: Data Rate

EU868/AS923

Data RateConfigurationIndicative Physical Bit Rate (bit/s)
0LoRa: SF12/ 125 kHz250
1LoRa: SF11/ 125 kHz440
2LoRa: SF10/ 125 kHz980
3LoRa: SF9/ 125 kHz1760
4LoRa: SF8/ 125 kHz3125
5LoRa: SF7/ 125 kHz5470
6LoRa: SF7/ 250 kHz11000
7FSK: 50 kbps50000
8 …15RFURFU

KR920

Data RateConfigurationIndicative Physical Bit Rate (bit/s)
0LoRa: SF12/ 125 kHz250
1LoRa: SF11/ 125 kHz440
2LoRa: SF10/ 125 kHz980
3LoRa: SF9/ 125 kHz1760
4LoRa: SF8/ 125 kHz3125
5LoRa: SF7/ 125 kHz5470
6…15RFURFU

US915

Data RateConfigurationIndicative Physical Bit Rate (bit/s)
0LoRa: SF10/ 125 kHz980
1LoRa: SF9/ 125 kHz1760
2LoRa: SF8/ 125 kHz3125
3LoRa: SF7/ 125 kHz5470
4LoRa: SF8/ 500 kHz12500
5…7RFURFU
8LoRa: SF12/ 500 kHz980
9LoRa: SF11/ 500 kHz1760
10LoRa: SF10/ 500 kHz3900
11LoRa: SF9/ 500 kHz7000
12LoRa: SF8/ 500 kHz12500
13LoRa: SF7/ 500 kHz21900
14…15RFURFU

AU915

Data RateConfigurationIndicative Physical Bit Rate (bit/s)
0LoRa: SF12/ 125 kHz250
1LoRa: SF11/ 125 kHz440
2LoRa: SF10/ 125 kHz980
3LoRa: SF9/ 125 kHz1760
4LoRa: SF8/ 125 kHz3125
5LoRa: SF7/ 125 kHz5470
6LoRa: SF8/ 500 kHz12500
7RFURFU
8LoRa: SF12/ 500 kHz980
9LoRa: SF11/ 500 kHz1760
10LoRa: SF10/ 500 kHz3900
11LoRa: SF9/ 500 kHz7000
12LoRa: SF8/ 500 kHz12500

IN865

Data RateConfigurationIndicative Physical Bit Rate (bit/s)
0LoRa: SF12/ 125 kHz250
1LoRa: SF11/ 125 kHz440
2LoRa: SF10/ 125 kHz980
3LoRa: SF9/ 125 kHz1760
4LoRa: SF8/ 125 kHz3125
5LoRa: SF7/ 125 kHz5470
6RFURFU
7FSK: 50 kbps50000
8 …15RFURFU

Appendix 2: TX Power

EU868

By default, Max EIRP is considered to be +16 dBm.

TX PowerConfiguration (EIRP)
0Max EIRP
1Max EIRP - 2 dB
2Max EIRP - 4 dB
3Max EIRP - 6 dB
4Max EIRP - 8 dB
5Max EIRP - 10 dB
6Max EIRP - 12 dB
7Max EIRP - 14 dB
8...15RFU

US915

TX PowerConfiguration (conducted power)
030 dBm - 2*TXpower
128 dBm
226 dBm
3...9...
1010 dBm
11...15RFU

AU915

By default, Ma EIRP is considered to be +30 dBm.

TX PowerConfiguration (EIRP)
0Max EIRP
1...10Max EIRP - 2*TXpower
11...15RFU

KR920

By default, Max EIRP is considered to be +14 dBm.

TX PowerConfiguration (EIRP)
0Max EIRP
1Max EIRP - 2 dB
2Max EIRP - 4 dB
3Max EIRP - 6 dB
4Max EIRP - 8 dB
5Max EIRP - 10 dB
6Max EIRP - 12 dB
7Max EIRP - 14 dB
8...15RFU

AS923

By default, Max EIRP is considered to be 16 dBm.

TX PowerConfiguration (EIRP)
0Max EIRP
1Max EIRP - 2 dB
2Max EIRP - 4 dB
3Max EIRP - 6 dB
4Max EIRP - 8 dB
5Max EIRP - 10 dB
6Max EIRP - 12 dB
7Max EIRP - 14 dB
8...15RFU

IN865

By default, Max EIRP is considered to be 30 dBm.

TX PowerConfiguration (EIRP)
0Max EIRP
1Max EIRP - 2 dB
2Max EIRP - 4 dB
3Max EIRP - 6 dB
4Max EIRP - 8 dB
5Max EIRP - 10 dB
6Max EIRP - 12 dB
7Max EIRP - 14 dB
8Max EIRP - 16 dB
9Max EIRP - 18 dB
10Max EIRP - 20 dB
11...15RFU