Skip to main content

Communicate with ABP End Node without LoRaWAN Network Server

Applies to: DLOS8N / LPS8N / LG308N Firmware: Since LG02_LG08--build-v5.4.1593400722-20200629-1120


1. Introduction​

The Dragino LoRaWAN gateway can communicate with a LoRaWAN ABP End Node without the need of a LoRaWAN server. It can be used in some cases such as:

  • No internet connection.

  • User wants to get data forward in gateway and forward to their server base on MQTT/HTTP, etc. (Combine ABP communication method and MQTT forward together).

The basic of this feature is the decoding of LoRaWAN ABP End Node.

1.1 Requirements​

ItemRequirement
End nodeMust work in ABP mode. Most end nodes are set to OTAA mode by default.
Gateway modelDLOS8N, LPS8N, LG308N
FirmwareSince LG02_LG08--build-v5.4.1593400722-20200629-1120
Serial toolUSB-UART adapter and a Serial Port Debug Assistant on the PC
WebUI accessThe gateway WebUI is reachable on the LAN or through its Wi-Fi AP

1.2 How It Works​

A Dragino gateway can deliver LoRaWAN data in two ways, and the choice is made on the gateway itself.

ABP decoding on the gateway

The gateway decrypts the payload with the ABP session keys and forwards the readable data to your own server. No LoRaWAN server is involved.

ABP end node
| (1) LoRa uplink
v
Gateway radio
| (2) packet forwarding
v
fwd process
| (3) decrypt with the ABP session keys
| (4) produce the decoded record
v
Forwarding layer
|
+-- (5) forward with ONE configured method:
MQTT, TCP, or a custom script
v
Target application / server

LoRaWAN network server

ABP decryption is disabled on the gateway. The gateway forwards the original encrypted payload to a LoRaWAN network server, which performs decryption, MIC validation and device management.

ABP / OTAA end node
| (1) LoRa uplink
v
Gateway radio
| (2) packet forwarding
v
fwd process
| (3) keep the payload encrypted
v
Forwarding layer
|
+-- (4) forward the original packet:
Semtech UDP :1700, or Basic Station :8887
v
LoRaWAN network server
| (5) decrypt, validate and manage devices
| (6) publish to the application
v
Application server

Why the two options are exclusive

A LoRaWAN network server needs the original encrypted payload to verify the MIC, validate the frame counter and build valid downlinks. Once the gateway decrypts the payload, the server can no longer act as a network server.

Option A — ABP decodingOption B — LoRaWAN server
Gateway decrypts the payloadYesNo
ABP keys entered on the gatewayRequiredNot required
Supports OTAANoYes
Receiving endYour application (MQTT / TCP / script)LoRaWAN network server
Gateway forwarding protocolMQTT / TCPSemtech UDP :1700 or Basic Station :8887

1.3 Key Concepts​

ABP communication relies on three values that must match on the node and on the gateway: ABP communication relies on three values that must match on the node and on the gateway. Read them from the node with AT+CFG, then enter the same values on the gateway's ABP Decryption page.

TermMeaningNode sideGateway side
DevAddr32-bit device address in the networkAT+DADDRDev ADDR field
NwkSKeyNetwork session key, protects signallingAT+NWKSKEYNetwork Session Key field
AppSKeyApplication session key, protects the payloadAT+APPSKEYAPP Session Key field
ABP vs OTAA
  • OTAA — the node and network server negotiate session keys over the air. A network server is required.
  • ABP — session keys are pre-shared. There is no join procedure, so the gateway can decrypt locally.

2. Prerequisites​

2.1 Tools​

Download the serial port debug assistant

2.2 End Node​

Setting the LoRaWAN Node to ABP Mode​

This section uses a serial port debug assistant in two steps: establish the serial connection first, then send the AT commands.

Step 1: Establish the serial connection​

Connect the node to the PC with a USB-UART adapter. Check the COM port assigned by the system in Device Manager, then configure the serial port debug assistant as follows:

Port: The example shows COM6( do not copy this value, select the COM port detected on your own PC)

Baud rate: 9600 (Set them to the same value)

Keep the rest of the settings the same as in the screenshot.

After configuration is complete,Click the ▶ button in the toolbar to open the port. The connection is ready when the status bar at the bottom shows the port is open.

12.png

Serial port settings (select the COM port detected on your own PC)
Step 2: Send the AT commands​

Enter AT+NJM?, AT+NJM=?, AT+NJM=0 in the input box respectively, then click the Send button to set the end device to ABP mode. An OK response indicates the configuration is successful.

13.png

Set the LoRaWAN node to ABP mode using AT commands
AT commands
  • AT+NJM? : Query the available modes (typically 0 = ABP mode, 1 = OTAA mode)
  • AT+NJM=? : Check which mode the device is currently in
  • AT+NJM=0 : Set the LoRaWAN node to ABP mode
  • To get the usage of other AT commands or more detailed instructions: the commonly used AT Commands

After switching, the node reports JOINED once it starts uplinking in ABP mode.

2.3 Session Keys​

Assume we have the LoRaWAN sensor node SN50v3-LB which works in ABP mode and the EU868 band. Send AT+CFG to view the configuration. It has the keys below.

14.png

View LoRaWAN Node Information
# Get the data
AT+DADDR=260B4FC4
AT+APPSKEY=C0 45 F5 97 2D E7 08 CC 65 67 EE A1 1F 07 8A CC
AT+NWKSKEY=05 02 BC BA F0 07 85 71 C2 17 73 70 D1 1F 8A 90
AT commands
  • AT+CFG : Prints the complete device configuration.

2.4 Gateway​

And we have the LPS8N which works in the EU868 band and supports ABP decryption. Users can input these keys in the LPS8N so that it can communicate with the SN50v3-LB.

You need to access the WebUI of the LPS8N. For steps, refer to : LPS8N Access the WebUI

Step 1: Confirm that the frequency plan configured on the LPS8N is the same as the one used by the end node​

Open the LPS8N WebUI and navigate to LoRa → LoRa:

15.png

Configure LoRa frequency plan and save the settings
Note

The frequency plan must match the end node, otherwise the gateway cannot receive uplinks from that node.

Step 2:Navigate to LoRa -> ABP Decryption,Add ABP end node keys and enable ABP decryption.:​

3.png

Input the above keys in the LPS8N and enable ABP decryption

3. LoRaWAN Gateway Data Integration Options​

For detailed steps, see: MQTT forward together

3.2 Other connection methods (Rarely used)​

3.2.1: Communicate with LT-22222-L​

Script can be downloaded from: Example Script 1

#!/bin/sh
# This script shows how to use LPS8/LG308/DLOS8 to communicate with two LoRaWAN End Nodes, without the use of internet or LoRaWAN server
#
# Hardware Prepare:
## 1. LT-22222-L x 2, both are configured to work in
# a) Class C ;
# b) ABP Mode ;
# c) AT+Mod=1
## 2. LPS8,
# a) Firmware version >
# b) Input the LT-22222-L keys in LPS so LPS8 can talk with them.
# c) LoRaWAN server choose built-in
# d) in Custom page, select custom script to point to this script. (put this script in /etc/iot/scripts directory)
#
# How it works?
# a) Devices 1 sends a uplink payload to LPS8. LPS8 will get the DI1 and DI2 info from the payload
# b) LPS8 will send a message to Device 2 to set the Device2 DO1 = Device1 DI1, and Device DO2 = Device DI2.
# c) Device2 will change DO1 and DO2 to according to the message from LPS8, and send back a message to LPS8 with the its DO1
# and DO2 value. LPS8 will ask Device1 to change its DO1 to same as Device 2, and change the DO2 to the same as Device 2.
# ( The purpose of this step is to show that the Device2 has already do the change there).
#
# For example: If current status of Device1 and Device2 leds shows:
# Device1: DI1: ON, DI2: ON , DO1: OFF, DO2: OFF
# Device2: DI1: OFF, DI2: OFF , DO1: OFF, DO2: OFF
#
# Step2 will cause below change:
# Device1: DI1: ON, DI2: ON , DO1: OFF, DO2: OFF
# Device2: DI1: OFF, DI2: OFF , DO1: ON, DO2: ON
#
# Step3 will cause below change:
# Device1: DI1: ON, DI2: ON , DO1: ON, DO2: ON
# Device2: DI1: OFF, DI2: OFF , DO1: ON, DO2: ON
# So if a person is in the Device 1 location, he can check if the DO LED match DI LEDs on Device 1 to confirm
# whether the Device 2 has been changed.

1. Input keys

image-20220527162450-3.png

Input Keys in LPS8

2. Make sure the LPS8 and LT use the same frequency bands. EU868 is used in this test.

3. Run the script.

image-20220722115213-2.png

Run the script

4. Output:

image-20220722115133-1.png

Output from LPS8

3.2.2: Communicate to TCP Server​

image-20220527162648-7.png

Network Structure

Full instruction video, including how to write scripts to fit the server's needs, is here:

Video Instruction: https://youtu.be/-nevW6U2TsE

Note

Firmware version must be higher than lgw-5.4.1607519907.

Assume we already set up ABP keys in the gateway:

6.png

Input Keys in LPS8

Start the socket tool on the PC

1. Socket tool download: Socket tool

7.png

Socket tool

2. Input Server address and port

8.png

Input Server address and port

3. See the value received in the socket tool:

5.png

Value received in socket tool

If the user wants to modify the TCP connection method, they can refer to tcp_process.sh. The same script is at /usr/bin on the gateway.


4. Troubleshooting​

ABP mode uses a four-stage data path. When something fails, first work out which stage is failing, then open the matching section.

StageHow to tellWhere to look
1. The node sends dataThe serial port shows txDoneSerial port debug assistant
2. The gateway receives itThe gateway log shows your device addressGateway shell
3. The data reaches the receiverThe MQTT client or socket tool receives itMQTT client / socket tool

If a stage fails, open the matching section below.

The commands in this chapter run in the gateway shell. Use either method to log in.

Method 1. SSH (recommended) — run this on your PC.

Open PowerShell: press Win + R, type powershell, and press Enter. You can also search for PowerShell in the Start menu.

ssh -p 2222 root@<gateway-ip>
  • Port: 22 (via WiFi AP mode) or 2222 (via WAN Interface)
  • User: root
  • Password: dragino (default)
  • <gateway-ip>: the same IP address you used to open the WebUI in section 2.4

19.png

Successfully access the gateway shell interface

Method 2. Serial console — connect a USB-UART adapter to the gateway and open it with a serial tool at 115200 baud.

Download SecureCRT

After successful login, the prompt shows:

root@dragino-xxxxxx:~#

16.png

SecureCRT serial quick-connect window

17.png

Logged in to the gateway serial shell

4.1 Quick reference​

What you seeLikely causeSection
No MQTT message, and the device is missing from the logNode not sending, wrong keys, wrong band, decryption disabled4.1
MQTT messages arrive but the content is wrongThe decoder does not match the payload4.2
The gateway receives data but MQTT stays silentForwarding disabled, broker unreachable, topic mismatch4.3
MQTT works but your server sees nothingThe subscriber topic differs4.3
A downlink is sent but the node does not reactWrong address, wrong timing mode, payload too long4.4
A custom script exits immediatelyWrong script path or argumentsRun it manually and read the output

4.2 The gateway does not receive the node's data​

4.2.1. Did the node actually send?

Look at the node's serial output. You should see:

TX on freq ... at DR ...
txDone

txDone means the transmission finished.

If txDone never appears, the problem is on the node, not the gateway. Send ATZ to restart the node and try again.

18.png

Node log showing a completed uplink transmission

4.2.2. Does your device appear in the gateway log?

In the gateway shell, run:

logread -f

Then let the node send an uplink and watch the output.

20.png

Gateway logs receive uplink data from the end node with my DevAddr
What you seeWhat it means
Your device address appearsThe gateway received it — continue with 4.2 or 4.3
Only other devices appearThe radio works but your node is not heard — check the band and the distance
Nothing at all appearsThe gateway receives no signal — check the antenna, the band and the distance

4.2.3. Do the keys match?

On the node, run:

AT+CFG

Compare DevAddr, NwkSKey and AppSKey character by character with what you entered on the WebUI ABP Decryption page. A single wrong byte stops the gateway from decrypting that device.

4.2.4. Is ABP decryption enabled?

On the WebUI, tick Enable ABP Decryption and click SAVE.

4.2.5. Is the signal strong enough?

A very low RSSI or a failed CRC drops the packet. Move the node closer to the gateway and try again.

Cause and fix

CauseFix
The node is not sendingCheck or shorten the reporting interval (AT+TDC), or send ATZ to restart it
Gateway and node use different bandsSet the same frequency plan on both (for example EU868)
Wrong keysCopy the three values again from AT+CFG
ABP decryption is disabledTick Enable ABP Decryption and save
Signal too weakMove the node closer and check the RSSI

4.3 Data arrives but the values are wrong​

Symptom

The MQTT client receives messages, but the content makes no sense, for example:

{"BatV": 3276.7, "TempC1": 3276.7, "Illum": -400, ...}

What is happening

The decoder does not match the device's data format. The data itself is fine; the decoder is interpreting it with the wrong layout.

What to do

4.3.1. Confirm the data itself is fine

In the MQTT client, open the full message and look at RSSI and SNR:

FieldNormal range
RSSIabout -30 to -120 dBm
SNRabout -20 to +15 dB

If these two look reasonable, reception and decryption are working and only the decoder is wrong.

4.3.2. Try the raw output first

On the WebUI ABP Decryption page, set the decoder to ASCII String and save.

Keep MQTT forwarding enabled, trigger one uplink from the node, then check the gateway logs.

logread if

When using ASCII String, the gateway does not parse fields, and the data contains raw hexadecimal content.

[IoT.MQTT]:decoder: ASCII
[IoT.MQTT]:mqtt_data[-m]: ffffffb0000000500d487fff03d700fe700000

This confirms that data is arriving and shows its length. If this output appears, the gateway side is working and the only remaining question is which decoder to pick.

4.3.3. Select a decoder that matches the payload format

SituationChoice
The gateway should turn the raw payload into readable dataSelect the decoder that matches the device's payload format
Only the raw payload is neededASCII String

Decoders are not one-to-one with device models. What matters is the payload format:

  • Different models with an identical payload format can share the same decoder.
  • The same model may change its payload format between firmware versions.
  • When unsure, keep ASCII String and compare the hex output with the decoder output.

4.3.4. Compare the two decoder outputs

With Dragino_LSN50V2_S31, the gateway outputs readable values:

[IoT.MQTT]:decoder: Dragino_LSN50V2_S31
[IoT.MQTT]:mqtt_data[-m]: {"BatV":3.4,"SNR":7.2,"EXTI_Trigger":"FALSE","Illum":-400,"MODE":0,"ADC_CH0V":0.98,"Work_mode":"IIC","RSSI":-79,"Digital_IStatus":"Low","TempC1":3276.7,"Door_status":"OPEN"}

If the values are reasonable, the decoder is correct. If they are impossible (such as 3276.7 or -400), try another decoder.

4.3.5. If no available decoder gives sensible values

The device uses a payload format that is not supported out of the box. The user does not need to write or edit scripts. Contact Dragino support and ask for a decoder for that device model.

Cause and fix

CauseFix
The decoder does not match the deviceSelect the correct decoder
The wrong decoder is selectedChange it on the ABP Decryption page and save
No decoder exists for this deviceContact Dragino support for a matching decoder
Notice

The uplink payload length must satisfy the LoRaWAN requirement (the maximum depends on frequency and data rate), otherwise the gateway cannot decode the payload.

4.4 Nothing arrives on the MQTT broker​

Symptom

The gateway receives and decrypts the data, but the MQTT client receives no messages at all.

Check in this order

4.4.1. Has the gateway received the data?

If not, start with section 4.1.

4.4.2. Is MQTT forwarding enabled and is the address correct?

In the gateway shell, run:

uci show mqtt

22.png

Check that pub_enable is checked and that server_address and port point to your broker.

4.4.3. Is the forwarding process running?

ps | grep '[m]qtt_process'

21.png

4.4.4. Can the gateway reach your broker?

nc -zv <broker-ip> 1883

23.png

4.4.5. Does the topic match?

Let the node send an uplink and watch the log:

logread -f | grep 'IoT.MQTT'
# [IoT.MQTT]: MQTT Publish Case: 4

24.png

The gateway publishes to:

CLIENTID/CHANNEL/data
# for example dragino-072185/260B4FC4/data

25.png

The subscriber must use the same topic, or a wildcard that covers it.

26.png

Cause and fix

CauseFix
MQTT forwarding is disabledEnable it on the WebUI and save
Wrong broker addressCorrect server_address and port
Broker unreachableCheck the network and firewall rules
Topic does not matchSubscribe to <hostname>/<DevAddr>/uplink or <hostname>/#
The network blocks port 1883Use the broker's TLS port (8883) and enable TLS
Port 1883 is blocked
  • Some networks block outbound port 1883. Verify with nc -zv <host> 1883.
  • If it times out but port 443 works, use the broker's TLS port (8883) and enable TLS on the client.

Symptom

You sent a downlink from the gateway, but the node never receives the payload.

Check in this order

4.5.1. Is the device address correct?

The first field must be the device address in hex, without the 0x prefix.

4.5.2. Is the timing mode correct?

ModeMeaningUse for
immeSend immediatelyClass C devices
timeWait for the next uplink, then sendClass A devices

If the device is Class A and you use time, the downlink is only transmitted after the device sends another uplink.

4.5.3. Is the payload too long?

An oversized payload is rejected. The limit depends on frequency and data rate.

27.png

Check LoRa node configuration with `AT+CFG`.
Tip

Use AT+CLASS=x (x=A/B/C) to modify the Class mode.

4.5.4. Check the gateway log

In the gateway shell, run:

logread -f | grep -E 'DNLK|JIT'

A working downlink produces these lines in order:

[INFO~][DNLK]Looking file : text
[INFO~][DNLK] Pending IMMEDIATE downlink for 260B4FC4
[INFO~][DNLK]customer immediate downlink for 260B4FC4 ready
[INFO~][JIT] send done on rf_chain 0 in count_us=2141341906 with freq=869525000, SF12

28.png

If the DNLK lines appear but the final send done line does not, the transmission itself failed.

Cause and fix

CauseFix
Wrong device addressUse the device address in hex, no 0x
Class A window missedUse imme for Class C, or retry after the next uplink
Payload too longShorten the payload
RX2 frequency mismatchCheck the region defaults

4.6 Information to collect before contacting support​

If the problem persists, gather the following before contacting Dragino:

uci get system.version
uci show mqtt
ls -l /var/iot/channels/
hexdump /var/iot/channels/<DevAddr>-0
logread | grep -iE 'mote|DNLK|IoT.MQTT' | tail -50