[riot-notifications] [RIOT-OS/RIOT] examples/lorawan: split in 2 examples, one using OTAA, one using ABP (#11237)

Alexandre Abadie notifications at github.com
Fri Mar 22 10:28:11 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

**don't merge this PR**: it is RFC and contains broken things

This PR splits the lorawan examples in 2 distinct applications:
- one showing the OTAA join procedure (as before)
- one showing the ABP join procudure

This PR also enables the low-power modes "manually". 2 different strategies are used depending on the activation procedure:
- OTAA: use STOP mode (well I'm targetting STM32 here) because it provides RAM retention while sleeping, keeping the loramac state when waking up.
- ABP: use STANDBY mode + EEPROM storage. This allows very low power consumption + no need for RAM retention since session keys and device address are already known.

With OTAA + STOP mode, I was expecting an issue with duty-cycle (which is managed internally by the MAC): when the device go to sleep, the duty-cycle timer is still running and when it wakes-up, the counter value is in the same state as it was just before going to sleep. This results in impossible sending, except if duty-cycle is disabled, which is possible but require modification in the mac adaption code.

For the moment, I have no idea of the real power consumption during the sleep phase: the CPU is sleeping for sure but maybe the radio must be shutdown manually as well to reach maximum power saving.

cc'ing @fjmolinas who might be interested by this.

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

I did some functional testing with a b-l072z-lrwan1 on IoT-LAB without power consumption:
- Start an experiment on the testbed
$ iotlab-experiment submit -n lorawan -d 120 -l saclay,st-lrwan1,25
$ iotlab-experiment wait
- Ensure no previous LoRaWAN parameters are stored on the device:
$ make IOTLAB_NODE=auto-ssh -C tests/pkg_semtech-loramac/ flash term
> loramac erase
- Flash `examples/lorawan_abp` with your LoRaWAN device/application parameters (if using TTN, ensure your frame counters are reset before):
$ make': make DEVADDR=<your devaddr> NWKSKEY=<your nwkskey> APPSKEY=<your appskey> IOTLAB_NODE=auto-ssh -C examples/lorawan_abp flash term
You should see the device rebooting every 20 seconds and a message sent to the backend. In between each reboot, the device is going to STANDBY deep-sleep mode.
- Flash `examples/lorawan_otaa` with your LoRaWAN device/application parameters:
$ make DEVEUI=<your deveui> APPEUI=<your appeui> APPKEY=<your appkey> IOTLAB_NODE=auto-ssh -C examples/lorawan_otaa/ flash term
You can observe that the activation is successful, the first message is sent with success (are received). But then, each time after waking-up, you get the message: `Cannot send message 'This is RIOT!', ret code: 11`. Return code `11`, corresponds to `SEMTECH_LORAMAC_DUTYCYCLE_RESTRICTED`.

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:


-- Commit Summary --

  * stm32_common/uart: don't block STOP mode by default
  * examples/lorawan: rename to lorawan_otaa + add pm
  * examples/lorawan_abp: add ABP example + standby pm enabled

-- File Changes --

    M cpu/stm32_common/periph/uart.c (10)
    A examples/lorawan_abp/Makefile (45)
    A examples/lorawan_abp/README.md (38)
    A examples/lorawan_abp/main.c (161)
    R examples/lorawan_otaa/Makefile (0)
    R examples/lorawan_otaa/README.md (6)
    R examples/lorawan_otaa/main.c (17)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190322/0285838b/attachment-0001.html>

More information about the notifications mailing list