Skip to content

Commit

Permalink
v1.4.0
Browse files Browse the repository at this point in the history
- Feature: Adding TX FSK support.
- Feature: optional auto-quit if a certain number of PULL_ACK is missed.
- Feature: upstream and downstream ping time is displayed on console.
- Bugfix: some beacons were missed at high beaconing frequency.
- Bugfix: critical snprintf error caused a crash for long payloads.
- FSK bitrate now appears in the upstream JSON.
  • Loading branch information
Sylvain Miermont committed Oct 27, 2014
1 parent e435e9b commit 09a8861
Show file tree
Hide file tree
Showing 10 changed files with 571 additions and 205 deletions.
Binary file removed PROTOCOL.PDF
Binary file not shown.
114 changes: 77 additions & 37 deletions PROTOCOL.TXT
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
______ _
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
Expand All @@ -8,6 +9,7 @@
Basic communication protocol between Lora gateway and server
=============================================================


1. Introduction
----------------

Expand All @@ -18,26 +20,27 @@ There is no authentication of the gateway or the server, and the acknowledges
are only used for network quality assessment, not to correct UDP datagrams
losses (no retries).


2. System schematic and definitions
------------------------------------

((( Y )))
|
|
+- -|- - - - - - - - - - - - -+ xxxxxxxxxxxx +--------+
|+--+-----------+ +------+| xx x x xxx | |
|| | | || xx Internet xx | |
|| Concentrator |<----+ Host |<------xx or xx-------->| |
|| | SPI | || xx Intranet xx | Server |
|+--------------+ +------+| xxxx x xxxx | |
| ^ ^ | xxxxxxxx | |
| | PPS +-------+ NMEA | | | |
| +-----| GPS |------+ | +--------+
| | (opt) | |
| +-------+ |
| |
| Gateway |
+- - - - - - - - - - - - - - -+
((( Y )))
|
|
+ - -|- - - - - - - - - - - - - + xxxxxxxxxxxx +--------+
| +--+-----------+ +------+ | xx x x xxx | |
| | | | | | xx Internet xx | |
| | Concentrator |<--->| Host |<-------xx or xx-------->| |
| | | SPI | | | xx Intranet xx | Server |
| +--------------+ +------+ | xxxx x xxxx | |
| ^ ^ | xxxxxxxx | |
| | PPS +-------+ NMEA | | | |
| +-----| GPS |-------+ | +--------+
| | (opt) | |
| +-------+ |
| |
| Gateway |
+- - - - - - - - - - - - - - - -+

__Concentrator__: radio RX/TX board, based on Semtech multichannel modems
(SX130x), transceivers (SX135x) and/or low-power stand-alone modems (SX127x).
Expand All @@ -63,6 +66,7 @@ It is assumed that the server has an static IP address (or an address solvable
through a DNS service) and is able to receive incoming connections on a
specific port.


3. Upstream protocol
---------------------

Expand Down Expand Up @@ -109,12 +113,13 @@ PUSH_DATA packets received.
1-2 | same token as the PUSH_DATA packet to acknowledge
3 | PUSH_ACK identifier 0x01


4. Upstream JSON data structure
--------------------------------

The root object can contain an array named "rxpk":

```json
``` json
{
"rxpk":[ {...}, ...]
}
Expand All @@ -132,17 +137,18 @@ and associated metadata with the following fields:
rfch | number | Concentrator "RF chain" used for RX (unsigned integer)
stat | number | CRC status: 1 = OK, -1 = fail, 0 = no CRC
modu | string | Modulation identifier "LORA" or "FSK"
datr | string | Datarate identifier (eg. SF12BW500 for Lora)
codr | string | ECC coding rate identifier
datr | string | LoRa datarate identifier (eg. SF12BW500)
datr | number | FSK datarate (unsigned, in bits per second)
codr | string | LoRa ECC coding rate identifier
rssi | number | RSSI in dBm (signed integer, 1 dB precision)
lsnr | number | Lora SNR ratio in dB (signed float, 0.1 dB precision)
size | number | RF packet payload size in bytes (unsigned integer)
data | string | Base64 encoded RF packet payload, padded

Example (white-spaces, indentation and newlines added for readability):

```json
"rxpk":[
``` json
{"rxpk":[
{
"time":"2013-03-31T16:21:17.528002Z",
"tmst":3512348611,
Expand All @@ -157,6 +163,18 @@ Example (white-spaces, indentation and newlines added for readability):
"lsnr":5.1,
"size":32,
"data":"-DS4CGaDCdG+48eJNM3Vai-zDpsR71Pn9CPA9uCON84"
},{
"time":"2013-03-31T16:21:17.530974Z",
"tmst":3512348514,
"chan":9,
"rfch":1,
"freq":869.1,
"stat":1,
"modu":"FSK",
"datr":50000,
"rssi":-75,
"size":16,
"data":"VEVTVF9QQUNLRVRfMTIzNA=="
},{
"time":"2013-03-31T16:21:17.532038Z",
"tmst":3316387610,
Expand All @@ -172,12 +190,12 @@ Example (white-spaces, indentation and newlines added for readability):
"size":32,
"data":"ysgRl452xNLep9S1NTIg2lomKDxUgn3DJ7DE+b00Ass"
}
]
]}
```

The root object can also contain an object named "stat" :

```json
``` json
{
"rxpk":[ {...}, ...],
"stat":{...}
Expand All @@ -186,7 +204,7 @@ The root object can also contain an object named "stat" :

It is possible for a packet to contain no "rxpk" array but a "stat" object.

```json
``` json
{
"stat":{...}
}
Expand All @@ -209,8 +227,8 @@ That object contains the status of the gateway, with the following fields:

Example (white-spaces, indentation and newlines added for readability):

```json
"stat":{
``` json
{"stat":{
"time":"2014-01-12 08:59:28 GMT",
"lati":46.24000,
"long":3.25230,
Expand All @@ -221,9 +239,10 @@ Example (white-spaces, indentation and newlines added for readability):
"ackr":100.0,
"dwnb":2,
"txnb":2
}
}}
```


5. Downstream protocol
-----------------------

Expand Down Expand Up @@ -297,12 +316,13 @@ metadata that will have to be emitted by the gateway.
3 | PULL_RESP identifier 0x03
4-end | JSON object, starting with {, ending with }, see section 6


6. Downstream JSON data structure
----------------------------------

The root object must contain an object named "txpk":

```json
``` json
{
"txpk": {...}
}
Expand All @@ -319,8 +339,10 @@ That object contain a RF packet to be emitted and associated metadata with the f
rfch | number | Concentrator "RF chain" used for TX (unsigned integer)
powe | number | TX output power in dBm (unsigned integer, dBm precision)
modu | string | Modulation identifier "LORA" or "FSK"
datr | string | Datarate identifier (eg. SF12BW500 for Lora)
codr | string | ECC coding rate identifier
datr | string | LoRa datarate identifier (eg. SF12BW500)
datr | number | FSK datarate (unsigned, in bits per second)
codr | string | LoRa ECC coding rate identifier
fdev | number | FSK frequency deviation (unsigned integer, in Hz)
ipol | bool | Lora modulation polarization inversion
prea | number | RF preamble size (unsigned integer)
size | number | RF packet payload size in bytes (unsigned integer)
Expand All @@ -330,10 +352,10 @@ That object contain a RF packet to be emitted and associated metadata with the f
Most fields are optional.
If a field is omitted, default parameters will be used.

Example (white-spaces, indentation and newlines added for readability):
Examples (white-spaces, indentation and newlines added for readability):

```json
"txpk":{
``` json
{"txpk":{
"imme":true,
"freq":864.123456,
"rfch":0,
Expand All @@ -344,18 +366,36 @@ Example (white-spaces, indentation and newlines added for readability):
"ipol":false,
"size":32,
"data":"H3P3N2i9qc4yt7rK7ldqoeCVJGBybzPY5h1Dd7P7p8v"
}
}}
```

``` json
{"txpk":{
"imme":true,
"freq":861.3,
"rfch":0,
"powe":12,
"modu":"FSK",
"datr":50000,
"fdev":3000,
"size":32,
"data":"H3P3N2i9qc4yt7rK7ldqoeCVJGBybzPY5h1Dd7P7p8v"
}}
```


7. Revisions
-------------

### v1.2 ###

* Added value of FSK bitrate for upstream.
* Added parameters for FSK bitrate and frequency deviation for downstream.

### v1.1 ###

* Added syntax for status report JSON object on upstream.

### v1.0 ###

* Initial version.

*EOF*
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0
1.4.0
26 changes: 24 additions & 2 deletions basic_pkt_fwd/cfg/global_conf.eu868.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"enable": true,
"freq": 868200000
},
"radio_1": {
"enable": true,
"freq": 869200000
},
"chan_multiSF_0": {
/* Lora MAC channel, 125kHz, all SF, 868.1 MHz */
"enable": true,
Expand All @@ -22,6 +26,24 @@
"radio": 0,
"if": 300000
},
"chan_multiSF_3": {
/* Lora MAC channel, 125kHz, all SF, 868.85 MHz */
"enable": true,
"radio": 1,
"if": -350000
},
"chan_multiSF_4": {
/* Lora MAC channel, 125kHz, all SF, 869.05 MHz */
"enable": true,
"radio": 1,
"if": -150000
},
"chan_multiSF_5": {
/* Lora MAC channel, 125kHz, all SF, 869.525 MHz */
"enable": true,
"radio": 1,
"if": 325000
},
"chan_Lora_std": {
/* Lora MAC channel, 250kHz, SF7, 868.3 MHz */
"enable": true,
Expand All @@ -31,12 +53,12 @@
"spread_factor": 7
},
"chan_FSK": {
/* FSK 100kbps channel, 868.3 MHz */
/* FSK 50kbps channel, 868.3 MHz */
"enable": true,
"radio": 0,
"if": 100000,
"bandwidth": 250000,
"datarate": 100000
"datarate": 50000
}
},
"gateway_conf": {
Expand Down
Loading

0 comments on commit 09a8861

Please sign in to comment.