Lorawan™ Api Documentation For Tarangmini™ SMXX: Melange Systems PVT LTD
Lorawan™ Api Documentation For Tarangmini™ SMXX: Melange Systems PVT LTD
Lorawan™ Api Documentation For Tarangmini™ SMXX: Melange Systems PVT LTD
Contents
1. TarangMini™ ...................................................................................................................................................... 4
2. LoRaWAN™ Network Stack for TarangMini™ ............................................................................................. 4
3. API Interface ........................................................................................................................................................ 4
3.1. Module Configuration Commands ........................................................................................................ 4
3.1.1. Generic Configuration Command Format ........................................................................................ 4
3.1.2. Generic Configuration Command Response Format....................................................................... 4
3.1.3. List of Supported Configuration Commands ................................................................................... 5
3.2. Module Communication Commands ..................................................................................................... 6
3.2.1. Generic UplinkCommand & Response Format ................................................................................ 6
3.2.2. Generic DownlinkCommand Format ................................................................................................ 6
3.2.3. Module Start-up Serial Message ......................................................................................................... 6
4. API Commands Description ............................................................................................................................. 7
4.1. Restore Defaults (W) ................................................................................................................................. 7
4.2. Restart Module (W) ................................................................................................................................... 7
4.3. Flash Write (W) .......................................................................................................................................... 7
4.4. Serial Baudrate (R/W) .............................................................................................................................. 7
4.5. Device EUI Read (R) ................................................................................................................................. 8
4.6. Application EUI (R/W) ........................................................................................................................... 8
4.7. Application Key Read (R) ........................................................................................................................ 8
4.8. Network Key Read (R).............................................................................................................................. 9
4.9. Network Connection Type Read (R) ...................................................................................................... 9
4.10. Network ID (R/W) .................................................................................................................................... 9
4.11. Module Hardware Version Read (R) .................................................................................................... 10
4.12. Firmware Version Read (R) ................................................................................................................... 10
4.13. Adaptive Data Rate (R/W) .................................................................................................................... 10
4.14. Confirm Message (R/W) ........................................................................................................................ 10
4.15. Port Number (R/W)................................................................................................................................ 11
4.16. Device Network Address Read (R) ....................................................................................................... 11
4.17. Transmission Acknowledgement (R/W) ............................................................................................. 11
4.18. Confirm Message Retries (R/W) ........................................................................................................... 12
4.19. Default Data Rate (R/W)........................................................................................................................ 12
4.20. Sleep Time (R/W) ................................................................................................................................... 13
1. TarangMini™
Melange Systems TarangMini™ family of RF modules provide a common footprint which can host
multiple platforms, including TarangNet™ (Point to Point, Point to Multi-point), Pretty mesh™ (for mesh
network), 6LoWPAN and LoRaWAN™. These modules are designed to address the unique needs of low-
power, low-cost wireless sensor and control networks. TarangMini™ modules support both AT and API
interface to the host. Both have their own unique use cases.
3. API Interface
API mode is a frame-based protocol that allows you to direct data on a packet basis. From Transmitting
Side, the host packages the data with needed information, such As Start Byte, Packet Length, Packet
Type, command ID and Payload. Also, at receiving Side, the Destination node accepts the data with
information such as Start Byte, Packet Length, Packet Type and Pay load. API Mode allows the user
greater flexibility and increased reliability in some cases.
Command: 2B 05 02 00 00 00
Response: 2B 05 82 00 00 00
Payload: NA
Example:
[TX] - 2B 05 02 00 00 00
[RX] - 2B 05 82 00 00 00
Command: 2B 05 02 00 00 01
Response: 2B 05 82 00 01 00
Payload: NA
Example:
[TX] - 2B 05 02 00 00 01
[RX] - 2B 05 82 00 01 00
[RX] - 2B 10 05 4C 6F 52 61 57 41 4E 2D 53 54 41 52 54 FF 2B 03 85 00
Command: 2B 05 02 00 00 02
Response: 2B 05 82 00 02 00
Payload: NA
Example:
[TX] - 2B 05 02 00 00 02
[RX] - 2B 05 82 00 02 00
This command enables the user toset or read the module serial Baudrate.
Command: 2B 05 02 00 00 03
Response: 2B 06 82 00 03 00 XX
Payload: 1 Byte
Supported Baudrate list in bps: 0x00(1200), 0x01(2400), 0x02(4800), 0x03(9600), 0x04(19200), 0x05(38400),
0x06(57600), 0x07(115200)
Default Value: 0x03(9600)
Example:
• Readmodule serial Baudrate:
[TX] - 2B 05 02 00 00 03
[RX] - 2B 06 82 00 03 00 03
• Set module serial Baud rate to 9600 bps:
[TX] - 2B 06 02 01 00 03 03
[RX] - 2B 05 82 00 03 00
Command: 2B 05 02 00 00 04
Response: 2B 0D 82 00 04 00 3C C1 F6 05 XX XXXXXX
Payload: NA
Example:
[TX] - 2B 05 02 00 00 04
[RX] - 2B 0D 82 00 04 00 3C C1 F6 05 12345678
This command enables the user toset or readthe module Application EUI.
Command: 2B 05 02 00 00 05
Response: 2B 0D 82 00 05 00 XXXXXXXXXXXXXXXX
Payload: 8 Byte
Example:
• Read module Application EUI:
[TX] - 2B 05 02 00 00 05
[RX] - 2B 0D 82 00 05 003456789098765432
• Set module Application EUI):
[TX] - 2B 0D 02 01 00 05 3456789098765432
[RX] - 2B 05 82 00 05 00
Command: 2B 05 02 00 00 06
Response: 2B 15 82 00 06 00 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Payload: NA
Example:
[TX] - 2B 05 02 00 00 06
[RX] -2B 15 82 00 06 00 00112233445566778899AABBCCDDEEFF
Command: 2B 05 02 00 00 07
Response: 2B 15 82 00 07 00 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Payload: NA
Example:
[TX] - 2B 05 02 00 00 07
[RX] - 2B 15 82 00 07 00 00112233445566778899AABBCCDDEEFF
Command: 2B 05 02 00 00 08
Response: 2B 06 82 00 08 00 XX
Payload: NA
Supported Network connection type list: 0x00(ABP), 0x01(OTAA).
Default Value: 0x00(ABP)
Example:
[TX] - 2B 05 02 00 00 08
[RX] - 2B 06 82 00 08 00 00
This command enables the user toset or readthe module Network ID.
Command: 2B 05 02 00 00 09
Response: 2B 09 82 00 09 00 XXXXXXXX
Payload: 4 Byte
Example:
• Read the module Network ID:
[TX] - 2B 05 02 00 00 09
[RX] - 2B 09 82 00 09 00 00 00 00 00
• Set module Network ID:
[TX] - 2B 09 02 01 00 09 11223344
[RX] - 2B 05 82 00 09 00
Command: 2B 05 02 00 00 0A
Response: 2B XX 82 00 0A 00 XXXXXXXXXXXXXXXX
Payload: NA
Example:
[TX] - 2B 05 02 00 00 0A
[RX] - 2B 0D 82 00 0A 00 53 4D 32 30 4C 52 30 33
Command: 2B 05 02 00 00 0B
Response: 2B XX 82 00 0B 00 XXXXXXXXXXXXXXXX
Payload: NA
Example:
[TX] - 2B 05 02 00 00 0B
[RX] - 2B 29 82 00 0B 00 4C 6F 52 61 57 41 4E 5F 43 41 5F 33 5F 31 5F 30
5F 50 72 6F 64 75 63 74 69 6F 6E 5F 30 35 30 36 32 30 31 38
This command enables the user toset or readthe Adaptive Data Rate status.
Command: 2B 05 02 00 00 0C
Response: 2B 06 82 00 0C 00 XX
Payload: 1 Byte
Supported Payload List: 0x00(Disable), 0x01(Enable)
Default Value: 0x00(Disable)
Example:
• Read Adaptive Data Rate Status:
[TX] - 2B 05 02 00 00 0C
[RX] - 2B 06 82 00 0C 00 00
• Set Adaptive Data Rate to Disabled Mode:
[TX] - 2B 06 02 01 00 0C 00
[RX] - 2B 05 82 00 0C 00
Command: 2B 05 02 00 00 0D
Response: 2B 06 82 00 0D 00 XX
Payload: 1 Byte
Supported Payload list: 0x00(Disable), 0x01(Enable)
Default Value: 0x00(Disable)
Example:
• Read Confirm Message Setting Status:
[TX] - 2B 05 02 00 00 0D
[RX] - 2B 06 82 00 0D 00 00
• Disable Confirm Message:
[TX] - 2B 06 02 01 00 0D 00
[RX] - 2B 05 82 00 0D 00
This command enables the user toset or readthe module Port Number.
Command: 2B 05 02 00 00 0E
Response: 2B 06 82 00 0E 00 XX
Payload: 1 Byte
Default Value: 0x02
Example:
Command: 2B 05 02 00 00 10
Response: 2B 09 82 00 10 00 XXXXXXXX
Payload: NA
Example:
[TX] - 2B 05 02 00 00 10
[RX] - 2B 09 82 00 10 00 22334455
This command enablessetting or reading the status of the transmission acknowledgement for the uplinks.
Enabling this will provide an UART acknowledgement for every uplink
Command: 2B 05 02 00 00 11
Response: 2B 06 82 00 11 00 XX
Payload: 1 Byte
Supported Payload list: 0x00(Disable), 0x01(Enable)
Default Value: 0x00(Disable)
Example:
This command enables the user toset or readthe number of Confirm Message Retries.
Command: 2B 05 02 00 00 12
Response: 2B 06 82 00 12 00 XX
Payload: 1 Byte
Default Value: 0x03
Example:
This command enables the user toset or readthe Default Data Rate parameter.
Command: 2B 05 02 00 00 13
Response: 2B 06 82 00 13 00 XX
Payload: 1 Byte
Supported Payload list: 0x00(SF12), 0x01(SF11), 0x02(SF10), 0x03(SF09), 0x04(SF08), 0x05(SF07)
Default Value: 0x00(SF12)
Example:
• Read Default Data Rate parameter:
[TX] - 2B 05 02 00 00 13
[RX] - 2B 06 82 00 13 00 00
This command enables the user toset or read the Sleep Time parameter (in Seconds).
Command: 2B 05 02 00 00 14
Response: 2B 07 82 00 14 00 XXXX
Payload: 2 Byte
Default Value: 0x00 14
Example:
• Reading the configured Sleep Time interval:
[TX] - 2B 05 02 00 00 14
[RX] - 2B 07 82 00 14 00 00 14
Command: 2B 05 02 00 00 15
Response: 2B 07 82 00 15 00 XXXX
Payload: 2 Byte
Default Value: 0x00 14
Example:
Command: 2B 05 02 00 00 16
Response: 2B 09 82 00 16 00 XXXXXXXX
Payload: NA
Example:
[TX] - 2B 05 02 00 00 16
[RX] - 2B 09 82 00 16 00 00 00 00 01
This command enables the user toset or read the Sleep Modeconfiguration.
Command: 2B 05 02 00 00 17
Response: 2B 06 82 00 17 00 XX
Payload: 1 Byte
Supported Payload list: 0x00(No Sleep), 0x01(Pin Asserted Sleep), 0x02(Periodic Sleep)
Default Value: 0x00(No Sleep)
Example:
This command enables the user toset or readLoRaWAN Device Class operation.
Command: 2B 05 02 00 00 18
Response: 2B 06 82 00 18 00 XX
Payload: 1 Byte
Supported Payload list: 0x00(Class C), 0x01(Class A)
Default Value: 0x00 (Class C)
Example:
• Read the class of operation device is set
[TX] - 2B 05 02 00 00 18
[RX] - 2B 06 82 00 18 00 00
This command enables the user toset or readmode of downlink acknowledgementto Network Server
(Applicable only to Class C mode of operation).
Command: 2B 05 02 00 00 19
Response: 2B 06 82 00 19 00 XX
Payload: 1 Byte
Supported Payload list: 0x00 (Immediate ACK ), 0x01(ACK with next packet)
Default Value: 0x01 (ACK with next packet)
Example:
This command enables the user toreadthe module Multicast Application Key.
Command: 2B 06 02 00 00 1A 01
Response: 2B 15 82 00 1A 00 XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Payload: 1 Byte
Supported Payload list: 0x01- 0x08 (Multicast location)
Example:
Command: 2B 06 02 00 00 1B 01
Response: 2B 15 82 00 1B 00 XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Payload: 1 Byte
Supported Payload list: 0x01- 0x08 (Multicast location)
Example:
Command: 2B 06 02 00 00 1C 01
Response: 2B 09 82 00 1C 00 XX XXXXXX
Payload: 1 Byte
Supported Payload list: 0x01- 0x08 (Multicast location)
Example:
This command enables the user toset or readthe Maximum Retry attempt for the joining message in
OTAA mode.
Command: 2B 05 02 00 00 1D
Response: 2B 06 82 00 1D 00 XX
Payload: 1 Byte
Default Value: 0xFF( Infinite retransmission)
Example:
• Read OTAA Maximum Retry:
[TX] - 2B 05 02 00 00 1D
[RX] - 2B 06 82 00 1D 00 FF
• Set OTAA Maximum Retry to 0:
[TX] - 2B 06 02 01 00 1D 05
[RX] - 2B 05 82 00 1D 00
Note:This feature is recommended only for sleep mode enabled modules. In the API example retry count
is set to 5. In event of 5 unsuccessful retries module will send a join error message "2B 03 85 01" and
resume to sleep. HOST MCU must wake the module up and issue a restart command to perform any
retries. Up on successfully joining to the network module will issue "2B 03 85 00".
Command: 2B 05 02 00 00 IE
Response: 2B XX 82 00 IE 00 XXXXXXXXXXXXXXXX
Payload: NA
Example:
[TX]-2B 05 02 00 00 1E
[RX]-2B 16 82 00 1E 00 53 4D 32 35 4C 52 30 31 5F 32 36 30 35 32 30 31
38
Command: 2B 05 02 00 00 IF
Response: 2B XX 82 00 IF 00 XXXXXXXXXXXXXXXX
Payload: NA
Example:
[TX] -2B 05 02 00 00 1F
[RX] -2B 15 82 00 1F 00 30 5F 32 36 30 35 32 30 31 38 31 34 30 34 33 30
This command enables the user toset or readMax Output Power of the module. Please refer the hardware
documentation to map these values to corresponding power index. Note: This API has impact only on
SM25xx Series modules
Command: 2B 05 02 00 00 20
Response: 2B 06 82 00 20 00 XX
Payload: 1 Byte
Supported Payload list: 0x00 - 0x08
Default Value: 0x08
Example:
This command reads the RSSI and SNR values of the last received packet (in ASCII format).
Command: 2B 05 02 00 00 30
Response: 2B XX 82 00 30 00 XXXXXXXXXXXXXXXX
Payload: NA
Example:
[TX] - 2B 05 02 00 00 30
[RX] - 2B 0D 82 00 30 00 2D 31 30 32 2C 31 39
Command: 2B 05 02 00 00 31
Response: 2B 06 82 00 31 00 XX
Payload: NA
Example:
[TX] - 2B 05 02 00 00 31
[RX] -2B 06 82 00 31 00 00
Note: In this example 00(SF12) is the data rate in which next transmission will happen.
Command: 2B 05 02 00 00 32
Response: 2B 06 82 00 32 00 XX
Payload: NA
Example:
[TX] - 2B 05 02 00 00 32
[RX] -2B 06 82 00 32 00 01
Note: In this example 01 is the response when the device is joined to LoRaWAN network.
4.36. Set LoRaWAN KEYs (AppKey, NwkKey, DevAddress, Network connection type) (W)
Command: 2B 2A 02 01 00 58 XXXXXXXXXXXX
Response: 2B 05 82 00 58 00
Payload: NA
Example:
[TX]-2B 2A 02 01 00 58 0A 86 02 56 97 45 4A 23 20 24 A8 58 39 A3 45 23
20 46 43 90 52 19 03 74 11 35 13 4A 64 A9 9A 2200 00 12 5F00
[RX] - 2B 05 82 00 58 00
[RX]- 2B 10 05 4C 6F 52 61 57 41 4E 2D 53 54 41 52 54 FF
Note: In this example keys are configured with the following values:
AppKey - 0A 86 02 56 97 45 4A 23 20 24 A8 58 39 A3 45 23
NwkKEY - 20 46 43 90 52 19 03 74 11 35 13 4A 64 A9 9A 22
DevAddres - 00 00 12 5F
Nwk Conn Type -00(ABP)
Command: 2B 2A 02 01 00 21 XXXXXXXXXXXX
Response: 2B 05 82 00 21 00
Payload: NA
Example:
[TX]-2B 2A 02 01 00 21 0322 11 01 06 12 73 33 97 80 6A 98 80 79 5A 34
73A1 76 4A 28 85 77 80 30 06 05 80 69 7A 29 44 A400 00 18 AE
[RX] - 2B 05 82 00 21 00
Note: In this example Multicast keys are configured with the following values:
Location - 03
AppKey - 22 11 01 06 12 73 33 97 80 6A 98 80 79 5A 34 73
NwkKEY - A1 76 4A 28 85 77 80 30 06 05 80 69 7A 29 44 A4
DevAddress - 00 00 18 AE
This command allows the user to retain the module OTAA parameter in the event of a power cycle.
Command: 2B 05 02 01 00 23
Response: 2B 05 82 00 23 XX
Payload: NA
Example:
• Write Retain OTAA KEYs:
[TX] - 2B 05 02 01 00 23
[RX] - 2B 05 82 00 23 00
Note: Invoking 'Retain OTAAKEYs' API will enable module to save the OTAA credentials to a non-
volatile memory, thus preventing it from being lost on a power cycle
This command allows the user to check the maximum possible payload size of the next uplink.
Command: 2B 05 02 00 00 24
Response: 2B 06 82 00 24 00 XX
Example:
• Read Next Possible Payload Size:
[TX] - 2B 05 02 00 00 24
[RX] - 2B 06 82 00 24 00 33
5. Generic Examples
5.1. Activation By Personalization (ABP) Configuration
• Restore Defaults
[TX] - 2B 05 02 00 00 00
[RX] - 2B 05 82 00 00 00
• EXIT/Restart
[TX] - 2B 05 02 00 00 01
[RX] - 2B 05 82 00 01 00
Note: AppKey - 0A 86 02 56 97 45 4A 23 20 24 A8 58 39 A3 45 23
NwkKEY - 20 46 43 90 52 19 03 74 11 35 13 4A 64 A9 9A 22
DevAddres - 00 00 12 5F
Nwk Conn Type – 00(ABP)
• EXIT/Restart
[TX] - 2B 05 02 00 00 01
[RX] - 2B 05 82 00 01 00
• UP Link Command
[TX] - 2B 0B 04 01 02 03 04 05 06 07 08 09
[RX] - 2B 03 81 00
Note: Once uplink command is issued module may respond back with any of the following replies.
2B 03 81 00 - ACK received
2B 03 81 01 - NACK (no ACK received)
2B 03 81 02 - Uplink busy
2B 03 81 03 - Uplink buffer is more than the allowed limit
• Downlink API
[RX] - 2B 06 80 01 01 02 03
• Restore Defaults
[TX] - 2B 05 02 00 00 00
[RX] - 2B 05 82 00 00 00
• EXIT/Restart
[TX] - 2B 05 02 00 00 01
[RX] - 2B 05 82 00 01 00
• EXIT/Restart
[TX] - 2B 05 02 00 00 01
[RX] - 2B 05 82 00 01 00
• UP Link Command
[TX] - 2B 0B 04 01 02 03 04 05 06 07 08 09
[RX] - 2B 03 81 00
Note: Once uplink command is issued module may respond back any of the with following replies.
2B 03 81 00 - ACK received
2B 03 81 01 - NACK (no ACK received)
2B 03 81 02 - Uplink busy
2B 03 81 03 - Uplink buffer is more than the allowed limit
• Downlink API
[RX] - 2B 06 80 01 01 02 03
Note:2B 03 85 00 command will be serially transmitted after module attaches with the gateway.
Note:01 2C, 00 14are the corresponding Device Sleep Time and Device Wake
Time in seconds (hex format).
Note:Pin 13 has to be HIGH for module to wake up (2B 03 84 01) and Pin 13 should be LOW for module
to go to sleep (2B 03 84 00).
c. No Sleep Mode
• Class C (00)
[TX] - 2B 06 02 01 00 18 00
[RX] - 2B 05 82 00 18 00
• Class A(01)
[TX] - 2B 06 02 01 00 18 01
[RX] - 2B 05 82 00 18 00
• Selecting Class C
[TX] - 2B 06 02 01 00 18 00
[RX] - 2B 05 82 00 18 00
• Device Write Flash/save parameters
[TX] - 2B 05 02 00 00 02
[RX] - 2B 05 82 00 02 00
• EXIT/Restart
[TX] - 2B 05 02 00 00 01
[RX] - 2B 05 82 00 01 00
• Selecting Class A
[TX] - 2B 06 02 01 00 18 01
[RX] - 2B 05 82 00 18 00
• Device Write Flash/save parameters
[TX] - 2B 05 02 00 00 02
[RX] - 2B 05 82 00 02 00
• EXIT/Restart
[TX] - 2B 05 02 00 00 01
[RX] - 2B 05 82 00 01 00
• EXIT/Restart
[TX] - 2B 05 02 00 00 01
[RX] - 2B 05 82 00 01 00
Note: In this example Multicast keys are configured with the following values:
Location -03
AppKey - 22 11 01 06 12 73 33 97 80 6A 98 80 79 5A 34 73
NwkKEY -A1 76 4A 28 85 77 80 30 06 05 80 69 7A 29 44 A4
DevAddress -00 00 18 AE
• EXIT/Restart
[TX] - 2B 05 02 00 00 01
[RX] - 2B 05 82 00 01 00