-
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
kinetis: Add LPM implementation #2605
Conversation
5511dfc
to
abbc9e0
Compare
Added a small bug fix for setting up the NVIC when initializing blocking mode. |
9f184dd
to
45554bf
Compare
Rebased since #2321 was merged. |
ping @jfischer-phytec-iot Ready for review |
I will adapt and test it on pba-d-01-kw2x. |
I should add a DSB instruction before the WFI. |
rebased, added DSB before WFI |
@gebart a0699b0 makes UART broken on the kw2x, the interrupts (from the uart) will be no longer triggered. If I comment out jnohlgard@a0699b0#diff-0f87a847fbd98c6b77134bcd0c723ee5R366 , uart interrupts works again. I still have not figured out why. |
693f583
to
fdaf098
Compare
@jfischer-phytec-iot can you try again with the newly rebased version? Did UART TX still work when you commented out the line you mentioned? |
@gebart Well, I will try during the day. |
KINETIS_LPM_EDGE_RISING = 0b01, | ||
/** Wake on falling edge */ | ||
KINETIS_LPM_EDGE_FALLING = 0b10, | ||
/** Wake on any logic change */ |
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.
over-commented, the identifiers are self-explanatory
@gebart I've implemented a lpm command (lpm [sleep, powerdown, off]) for the shell and now I see that without proper power manager, we will not get anywhere. |
I managed to get everything down to 100 µA in VLPS, and around 50 µA in LLS, using the hello-world example (so no processes are running except for the LPTMR overflow ISR handler every 2 seconds). To get low power I had to add initialization code for some of the on-board devices (flash memory and radio transceiver) to trigger low power modes during boot. It does not seem to affect the device initialization performed by the at86rf231 driver. @jfischer-phytec-iot Do you have any opinions on this method? Hard coding small init sequences for on board devices inside the @jfischer-phytec-iot I looked at your suggestion, it was something like that I had in mind when I opened #2927. I like it, do you think we should merge this first and then do a separate PR for the power manager, or do the power manager first, or combine the two in one PR? I think this one (#2605) is pretty close to being mergable, but we will still have to rewrite it when we introduce the power manager. |
- Use IRQ for normal TX. - Inhibit low power modes while transmitting. - Inhibit low power modes while receiving. - Disable LLS mode if receiving callback is set.
2fb2abe
to
adf1556
Compare
@gebart Ping. A kind reminder for rebase. |
on hold until xtimer catches up |
With #6160 merged: Is this still relevant? |
Guess it's outdated. Will close with memo label set. @gebart please reopen if I'm mistaken. |
This PR is still referred to from the |
This PR depends on the atomic counters in #2321- mergedAdd support for Kinetis power modes: WAIT, STOP, VLPS, LLS.
Also included is a refactoring of the UART driver to allow low power modes while still being responsive to RX bytes and prevent deep sleep modes when the last TX byte has not yet been transmitted on the line. This requires using TX interrupts to detect when a transmission is done.
The deepest possible hardware sleep mode will be dynamically selected when lpm_set(LPM_IDLE).
Missing power modes:
Tested on: