[riot-notifications] [RIOT-OS/RIOT] [WIP] gnrc_lorawan: add initial support for gnrc based LoRaWAN stack (v2) (#11022)

José Alamos notifications at github.com
Fri Feb 15 14:42:59 CET 2019


<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

### Contribution description
This PR adds a full LoRaWAN stack to RIOT originally based on the work with @fjmolinas in https://github.com/RIOT-OS/RIOT/pull/6645 . Compared to the Semtech pkg, this offers some advantages:
- Integrated to GNRC
- Tickless MAC (low power friendly)
- Lightweight (~4-5 kb less ROM, ~1.5 kb less RAM with proper GNRC_PKTBUF_SIZE value)
- Asynchronous send and receive.
- Notifications from the MAC layer

Implemented features:
- EU868 region
- Class A
- Join via OTAA and ABP
- Link Check commands

To be implemented
- Indication to know when to receive
- Duty Cycle restrictions
- Compliance Fopts
- Class C
- Other regions
- RTC support for true low power support.


This PR adds (WIP) an IEEE-like MAC with MCPS (Mac Common Part Sublayer) and MLME (Mac Layer Management Entity) for handling data and all kind of management (set keys, request link check, etc). Compared to other MACs this one is request-confirmation based and there's a bidirectional communication between the MAC and higher layers.

Higher layers can:
- Request to send data (the MAC can either send it right now or wait until it's possible to send) end receive an asynchronous confirmation to that Request (e.g couldn't receive ACK from the network server, etc)
- Request a MAC management operation (set a key, join the network, ask for connectivity status, etc). Same as before, this is confirmed asynchronously

MAC layer can:
- Indicate the upper layer that data was received and pass all metadata (pkt, port, rssi, etc)
- Indicate the upper layer about an interesting event (join was successful, a sub-band is free to be used again, etc)

This IEEE MAC layer is very useful in scenarios like Tisch or connection oriented MAC layers.


<!--
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes
-->


### Testing procedure
In its current WIP state, use `tests/gnrc_lorawan` test. Keys are hardcoded and commands are very basic, but they show how to perform common LoRaWAN duties.
<!--
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
-->


### Issues/PRs references

<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/11022

-- Commit Summary --

  * add lorawan thread to auto_init
  * add NETOPT_JOIN option
  * add NETOPT variables
  * add lorawan headers
  * add gnrc_netif_lorawan file
  * add lorawan component to netif
  * replace include header
  * add netopts to driver
  * add lorawan component variables
  * add required NETOPTs
  * add gnrc_lorawan files
  * change event callback
  * remove old comments
  * working :)
  * move coding rate to _init
  * implement datarates
  * add joined variable
  * rename internal function
  * move functions
  * add event_tx_complete function
  * add join logic
  * import hdr file from old gnrc_lorawan
  * adapt mic to new hdr format
  * implement join request with helpers
  * implement pktbuf logic in join request
  * move syncword set to _init
  * add gnrc_lorawan example
  * custom payload
  * initial adoption of pkt snips
  * merge packet snips from payload
  * remove payload pktsnip after no longer needed
  * add gnrc_pktbuf_cmd to test
  * remove old comments
  * release packet on send
  * fix leak in pkt reception
  * add join accept header
  * use lorawan_join_accept_t struct
  * fix unaligned pkt
  * remove old PKT macros
  * factor-out rx window configuration
  * add abp support
  * remove callback from driver
  * add gnrc lorawan timeout event
  * add states
  * add downlink support
  * move llc logic to different file
  * add confirmed messages
  * fix wrong join_accept struct
  * add NETOPT_RX2_DATARATE support
  * add datarate variable to descriptor
  * add RX1 offset support
  * implement basic channel hopping
  * add CFList support
  * implement proper channel picking
  * add rx delay
  * fix crypto functions
  * add port and options support
  * add nwkskey encryption
  * add fopts support
  * move fopts to dedicated file
  * finish fopts and payload
  * print payload when received
  * move process functions to separate file
  * improve downlink process function
  * refactor basecode
  * refactor again
  * add lorawan nettype
  * fix netreg
  * add netreg support
  * change counters to 32 bit
  * add _pass_on_pkt
  * netdev/rx_info: add SNR field
  * remove sx127x from netif
  * add ACK to build_hdr function
  * add confirmed downlink support
  * add gnrc_lorawan_reset function
  * fix bug with channels
  * implement mlme requests
  * implement link check with mlme
  * add mlme confirm
  * implement send with MCPS
  * implement port with MCPS
  * implement mlme link check with MLME commands
  * remove unused command
  * add datarate in MCPS request
  * implement ABP with MLME
  * implement mcps confirm and indication
  * remove calculate_pkt_mic
  * re-factor to MCPS events
  * move counter increment to MCPS handler
  * implement retransmission procedure
  * move retrans to mcps event
  * move functions to gnrc_lorawan.c
  * remove joining variable
  * move mcps and mlme to dedicated files
  * refactor send
  * move retransmission logic to mcps
  * move mlme flags outside of gnrc_lorawan.c
  * add TODO
  * sx127x: fix RX_TIMEOUT function
  * fix timing issues
  * add timer labels and simplify timers
  * add RX2 config params
  * reject mcps request on port 0
  * implement tx command
  * move pkt tagging to mcps
  * receive packet in mcps indication
  * remove return from pkt handlers
  * drop packet if port is 0
  * add dr to join request
  * implement fcnt_down
  * move indication and confirm in recv function
  * implement frame pending
  * add region regulations
  * reset frame counters in gnrc_lorawan_reset
  * add check for dev addr
  * set mhdr to 0
  * fix rx info
  * add time on air
  * remove print message
  * change toa to static
  * remove re-set of syncword
  * merge tx_config functions into one
  * merge rx_window_config functions
  * merge all config functions
  * move tx configuration to send function
  * add toa variable to struct
  * add backoff timer
  * add busy MAC state
  * simplify options
  * refactor to init functions
  * add xtimer64 to backoff
  * improve backoff timer logic
  * refactor fopts
  * remove mlme flags
  * sort struct members to save some bytes
  * move members between structs
  * add proper indications
  * add mlme confirm status code
  * add proper error codes to mcps confirm
  * remove puts
  * just remove pkt snip instead of reverse
  * add error codes to requests
  * remove _send_mcps function

-- File Changes --

    M drivers/include/net/netdev.h (1)
    M drivers/sx127x/sx127x.c (5)
    M drivers/sx127x/sx127x_netdev.c (23)
    M sys/auto_init/netif/auto_init_sx127x.c (4)
    A sys/include/net/gnrc/lorawan/lorawan.h (167)
    A sys/include/net/gnrc/lorawan/region.h (23)
    M sys/include/net/gnrc/netif.h (6)
    A sys/include/net/gnrc/netif/lorawan.h (156)
    A sys/include/net/gnrc/netif/lorawan_base.h (49)
    M sys/include/net/gnrc/netreg.h (8)
    M sys/include/net/gnrc/nettype.h (1)
    A sys/include/net/lorawan/hdr.h (164)
    M sys/include/net/netopt.h (39)
    M sys/net/gnrc/Makefile (3)
    A sys/net/gnrc/link_layer/gnrc_lorawan/Makefile (3)
    A sys/net/gnrc/link_layer/gnrc_lorawan/gnrc_lorawan.c (258)
    A sys/net/gnrc/link_layer/gnrc_lorawan/gnrc_lorawan_crypto.c (136)
    A sys/net/gnrc/link_layer/gnrc_lorawan/gnrc_lorawan_mcps.c (282)
    A sys/net/gnrc/link_layer/gnrc_lorawan/gnrc_lorawan_mlme.c (256)
    A sys/net/gnrc/link_layer/gnrc_lorawan/gnrc_lorawan_region.c (84)
    A sys/net/gnrc/netif/gnrc_netif_lorawan.c (193)
    A tests/gnrc_lorawan/Makefile (32)
    A tests/gnrc_lorawan/main.c (230)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/11022.patch
https://github.com/RIOT-OS/RIOT/pull/11022.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11022
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190215/17b115ec/attachment-0001.html>


More information about the notifications mailing list