-
Notifications
You must be signed in to change notification settings - Fork 211
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
Remove lengthy interrupt disables #524
Comments
@altishchenko Just curious if are taking over this repository? This particular issue breaks quite a few boards, and I think @terrillmoore was going to work on a fix. I've got a handful of issues I've reported that are related to this issue as well that prevent using OTAA and ADR. I'm happy to work with you for a fix. |
@czuvich Clay, I didn't really think about that, I am new to this community and, I am afraid, I won't be able to give a repository of such popularity required amount of attention in the long run. I don't know why @terrillmoore is not with us for some time now, probably busy on another more important project. As for the list of most important problems, I will summarize them as questions, because for some of them I don't have good convincing (me) reasons:
These questions are biased towards our project and do not reflect 90% of standard use cases. Like, we don't need packaged functionality to schedule arbitrary timed jobs, we have it in another place, so the jobs that run in os_runloop_once() are only the ones scheduled by the library itself. For the whole, I have it running pretty stable now - nearly a week without reset or rejoin, low power works fine and does not affect the data exchange, ADR works, OTAA works, race lockups or resets didn't happen for a good while, it does not now affect performance of the other project components. But again, all of this is very project specific, I just don't have these Arduino boards to try out the examples :) Cheers, |
@altishchenko Wow this is incredible feedback! You've put in way more effort than I have... I ended up punting to ABP without ADR since my use case is fairly simple and being prototyped. In terms of response to those questions, I really only have a little... and yes I'd love to connect with you via email. I'll be sending it from czuvich@gmail.com.
LMIC from what I could tell does a good job keeping the radio asleep when not in use (I read 1.6uA on my custom board using nRF52840). To add onto that, I would like to see an example that saves off all of the necessary information which allows you to power cycle the mCU without doing a rejoin (perhaps this falls under low power possibilities you mentioned earlier). I've scoured the forums for a good solution, but it just gets bounced around. My mCU power cycles after a deep sleep wake-up which is another reason why I use ABP. Anyways... I'll shoot an email to you and maybe we can at a minimum collaborate our findings. Again.. thanks for the very detailed explanations! |
Hi @czuvich |
@JackGruber Thank you! This is perfect. |
@JackGruber Nice article. As for the note at the end of your article concerning micros() - this is one my concerns too, which I outlined in question 7 above. The MCU I work with has real time calendar module, (and ESP32 has one too), but its precision is milliseconds. The same story applies to Zero line of Arduinos, which are based on SAMD21. Fortunately for my case (STM32) and for the Zero line (SAMD21), SLEEPDEEP does not perform Reset on exit and RAM contents is preserved in power down, comparing to ESP32 which loses CPU context unless you are running from high speed RTC RAM. Duty cycles are definitely millisecond/seconds precision, so they can be managed by RTC calendar clock base. The problem stems from the fact that the same clock base in the library is used to calculate receive window timing and keep track of regular jobs lengthy jobs. This is my main concern at the moment as I am trying to decouple TOA and RX window calculation from usual house keeping which can be RTC-millisecond based. |
@JackGruber Forgot to mention. One of the quick solutions I used was to have a flag that gets set in os_setCallback/os_setTimedCallback pair and gets reset in os_runloop_once() in place of hal_sleep(), it is taken into account when going low power decision is made. TX duty cycles are managed outside LMIC in my case, as soon as I succeed with LMIC+RTC, I will let LMIC manage them. |
The primary purpose of this PR is to fix #524, allowing the LMIC to run without disabling interrupts at all, and without requiring any changes to underlying BSPs. When configured for interrupts, interrupts simply cause the current time stamp to be captured. The secondary ISR is run as part of os_runloop_once(). This should also fix #503, and address #528, #558, #548, and others. In addition, since we're updating the radio driver, I addressed #524. In testing, I discovered a subtle bug with one of our applications that uses LMIC_sendAlive() -- there was a path when sending piggybacked MAC data with a poll that would result in trying to take the port 0 path instead. This caused problems with ChirpStack and TTN, at least. (This is #570.) Finally, updated to use Arduino IDE 1.8.12 in test. Version of library changes to v3.1.0.20.
On some BSPs "interrupts disabled" stop the clock from advancing properly.
hal_waitUntil()
hangs inos_init()
because time is not advancing. See #523 and #521.Various BSPs handle time differently when interrupts are disabled, and start up with different interrupt enabled/disabled state. The MCCI BSPs all have the property that time advances even when interrupts are disabled. But many BSPs do not.
The LMIC needs to be reworked to remove all the interrupt enable/disable logic that's presently there, as I am certain that there's no need for extended interrupt disables. Thanks @aparcar and @JackGruber for finding the root cause.
The text was updated successfully, but these errors were encountered: