-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
examples/lorawan: add the possibility to use ABP activation procedure #11237
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to move this to the applications repo, not cluttering the examples anymore.
hi @aabadie Thanks for your efforts in LPM and LoRaWAN! I have some comments about the fundamentals of this PR:
What do you think? |
9264d67
to
e78a80f
Compare
Here you make the assumption that the board you are running provide non volatile storage which might not be the case all the time.
I think RTT would be more appropriate during TX and RX windows phases as it's more precise. And also when during STOP deep sleep phase (LPTIM is still active on STMs during STOP). For STANDBY, using RTC is fine during the sleep phase, like it's already done in the example. |
True. But in practice, boards in a real deployment should include non volatile retention mechanisms. Considering the consumption in STANDBY can be e.g 60% of STOP mode, IMO we should aim to have all LPM regardless of the activation mechanisms. If a board doesn't include a non-volatile storage, then it could still run with STOP mode. But I wouldn't block OTAA users if they want to run in STANDBY mode.
Yes, indeed.
The MAC can in theory run with only one timer, but we would need to patch a little bit the OnMacStateChekTimer function. I think that could help us in this direction. |
How big is the state? If it is less then ~80 bytes in total, maybe #11369 can be used to store it in RTC? |
I would say around 60 bytes. So yes, it could be an option |
e78a80f
to
6eba6ea
Compare
I removed the split in 2 separate applications and adapted the existing one to support ABP activation mode. This PR is also now based on #11310, #11359 and
Note that RTC initialization already uses the BKPOR register on L0/L1 CPU to determine if it must be reset or not after a standby wake-up. That would need some adaption as well. |
2a12c25
to
b16b2f9
Compare
b16b2f9
to
2fd6194
Compare
2fd6194
to
772c913
Compare
772c913
to
428c7d3
Compare
Both dependencies are now merged so this PR is now ready for review again :) |
428c7d3
to
96f0b6a
Compare
4e78148
to
f812f23
Compare
f812f23
to
b5938bb
Compare
I adapted the PR. Now STOP mode (for STM32) is enabled. On samd21 that shouldn't change. And it's not configurable unless one edit the Makefile. |
LGTM, do you remember what needed to be done on the |
There are 2 pins to measure IDD and we were directly wiring up the multimeter on them. |
But if I recall you had desoldered some resistors on your BOARD with which you tested low-power |
That was for when the board was running on the battery available on the back. To get low power in this case, on has to desolder a resistor between the programmer and the board otherwise there's current leak. But this makes it unflashable afterwards. |
We had to de-solder the resistors SB19, SB14 and SB17 and put some jumpers when not measuring current (otherwise you cannot flash the board). There we were able to get to low power. I have the hardware with me but I cannot test it until next Monday due to an internal deadline. If it's OK to wait until next week I can post the results back. |
b5938bb
to
b22370a
Compare
FYI: The CPU goes to lpm, but the radio oscillator consumers ~1.9 mA (see #11237 (comment)). But I guess that's not related to this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK!
Thanks for reviewing and testing @fjmolinas @jia200x ! This was one of my oldest opened PRs :) |
Contribution description
don't merge this PR: it is RFC and contains broken thingsThis PR splits the lorawan examples in 2 distinct applications:one showing the OTAA join procedure (as before)one showing the ABP join procudureThis PR adds the possibility to use ABP activation procedure to the existing application.
This PR also enables the low-power modes "manually". 2 different strategies are used depending on the activation procedure:
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.
Testing procedure
I did some functional testing with a b-l072z-lrwan1 on IoT-LAB without power consumption:
examples/lorawan_abp
with your LoRaWAN device/application parameters (if using TTN, ensure your frame counters are reset before):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.
examples/lorawan_otaa
with your LoRaWAN device/application parameters:You can observe that the activation is successful, the first message is sent with success (and received). But then, each time after waking-up, you get the message:
Cannot send message 'This is RIOT!', ret code: 11
. Return code11
, corresponds toSEMTECH_LORAMAC_DUTYCYCLE_RESTRICTED
.Issues/PRs references
Based on #11221This PR is now based on #11552 and #11541Now based on #14547 and #14551Now based on #17793