LoRa Gateway Packet Forwarder JSON Daten
25.12.2024
Elektronik | Funk | Software
Der Technik-Blog
The UDP Packet Forwarder developed by Semtech on a LoRa or LoRaWAN gateway is responsible for bidirectional data transfer between the gateway and the network server. This article describes the JSON objects appended to a message starting from the 12th byte. Further details about the first 12 bytes of each message are explained in this article.
For the uplink (transmission from the gateway to the network server), two JSON objects are used: STAT and RXPK. STAT transmits the status of the gateway (location, various counters, and timestamp), while RXPK represents a data packet received by the gateway, including the packets data content and information about the packet itself (size, signal strength, modulation, etc.).
For the downlink (transmission from the network server to the gateway), two JSON objects are used: TXPK and TXPK_ACK. TXPK is used to transmit data packets to the gateway, which are to be sent via radio. If the downlink is accepted by the gateway or can be transmitted, a 12-byte TX_ACK response without a JSON object is sent. In the event of an error, the TXPK_ACK object is appended to the preceding 12 bytes and returned to the network server.
The following tables describe the individual keys of each JSON object.
STAT (Cyclic status messages from the gateway to the network server):
{ "stat": { "ackr": 0.000000, "dwnb": 0, "rxfw": 0, "rxnb": 0, "rxok": 0, "time": "2024-11-15 10:45:54 GMT", "txnb": 0 } }
Key | Type | Description |
---|---|---|
rxnb | u_int | Packets received via radio since system start |
rxok | u_int | Packets with valid CRC received via radio since system start |
rxfw | u_int | Packets forwarded to the network server since system start |
dwnb | u_int | Downlink packets received from the network server since system start |
txnb | u_int | Packets sent via radio since system start |
ackr | int | Percentage of packets acknowledged by the network server |
time | string | Gateway timestamp |
lati | float | Gateway location (latitude) |
long | float | Gateway location (longitude) |
alti | int | Gateway location (altitude) |
RXPK (Received data packet or multiple data packets in an array):
{ "rxpk": [{ "chan": 0, "codr": "4/5", "data": "QN3Mu6qATgEBddf3CGO3W+c=", "datr": "SF7BW125", "freq": 868.100000, "lsnr": 9.750000, "modu": "LORA", "rfch": 1, "rssi": -32, "size": 26, "stat": 1, "time": "2024-11-15T10:47:43.674536Z", "tmst": 2905060155 }] }
Key | Type | Description |
---|---|---|
chan | u_int | Logical channel number |
rfch | u_int | RF chain: Physical module in the gateway that received the data packet |
freq | float | Reception frequency in MHz |
modu | string | Modulation type (LoRa or FSK) |
rssi | float | Signal strength (RSSI) in dBm |
lsnr | float | LoRa signal-to-noise ratio in dB |
datr | string / u_int | Spreading factor and bandwidth in kHz for LoRa, or frame bit rate in Hz for FSK |
codr | string | Coding rate for LoRa modulation |
stat | int | CRC status (1 = OK; -1 = Invalid; 0 = No CRC) |
time | string | UTC timestamp from the gateway at reception time (ISO8601 compact format) with microseconds |
tmst | u_int (32-bit) | Internal microsecond counter since system start; overflows after 72.5 minutes |
tmms | u_int | Elapsed milliseconds since January 6, 1980 |
size | u_int | PHYPayload size (bytes) |
data | string | PHYPayload (Base64) |
TXPK (Downlink: Sending a telegram via a gateway)
{"txpk":{"imme":true,"freq":868.500,"rfch":1,"powe":14,"modu":"LORA","datr":"SF11BW125","codr":"4/5","ipol":false,"size":24,"data":"3UBCTIB9FOa+LyVdGkt63237S2p4CEX/"}}
Key | Type | Description |
---|---|---|
imme | bool | If true, the packet is sent immediately, and tmst/time is ignored |
tmst | u_int (32-Bit) | If imme=false and tmst is present, the packet is sent when the internal counter is reached |
tmms | string | If imme=false and tmst is not present, the packet is sent at the specified UTC timestamp |
freq | u_float | Transmission frequency in MHz |
rfch | u_int | Selection of transmission module (RF Chain) |
powe | int | Transmission power in dBm |
modu | string | Modulation type (LORA or FSK) |
datr | string / u_int | For LoRa modulation: spreading factor and bandwidth (SFxBWm, x=7-12; m=bandwidth in kHz), for FSK: frame bitrate in Hz |
codr | string | ECC Coding Rate (e.g., 4/5) |
ipol | bool | Indicates whether the inverted polarity bit is used (false means no inversion). |
prea | u_int | RF Preamble size |
size | u_int | PHYPayload in Bytes |
data | string | Base64 PHYPayload |
ncrc | bool | If true, no CRC is generated in the Physical Layer |
TXPK_ACK (Antwort vom Gateway zum Netzwerkserver auf ein PULL-RESP):
{"txpk_ack":{"error":"TX_FREQ"}}
Key | Type | Beschreibung |
---|---|---|
error | string | Gibt eine Fehlermeldung zurück |
Mit dem Key "error" können folgende Fehlermeldungen Übermittelt werden:
error | Beschreibung |
---|---|
TOO_EARLY | Das Paket wurde zu früh empfangen, bevor der vorgesehene Sendezeitpunkt erreicht war |
TOO_LATE | Das Paket kam zu spät an, um rechtzeitig gesendet zu werden |
COLLISION_PACKET | Eine Kollision mit einem anderen bereits gesendeten Paket wurde festgestellt |
COLLISION_BEACON | Das Paket kollidierte mit einem Beacon-Signal, das Vorrang hat |
TX_FREQ | Die Sendefrequenz ist ungültig oder nicht erlaubt |
TX_POWER | Die angeforderte Ausgangsleistung ist ungültig oder außerhalb der zulässigen Grenzen |
GPS_UNLOCKED | Die GPS-Synchronisation war nicht verfügbar, daher konnte keine genaue Zeitplanung erfolgen |
Every day hundreds of meteorological radiosondes fall from the sky. In this article we convert a radiosonde into a GPS tracker for APRS, RTTY & CW
read moreExample code for the PT100 temperature sensor on an Arduino with 16x2 LC display Output
read moreAEQ-WEB © 2015-2024 All Right Reserved