cpu/kinetis: implement Low-Leakage Wakeup Unit and add support to UART #14377
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
Split out of #11789 and originally partly from #7897, this PR adds support for the Kinetis LLWU peripheral (which is used by other peripherals to wake from the lowest power mode) and adds UART support to make use of it.
This allows sleeping all the way down to the lowest power mode (~5uA) while retaining a working LEUART or even UART by waking on a pin interrupt instead of waking via the UART hardware.
Testing procedure
Compile with
CFLAGS=-DPM_BLOCKER_INITIAL=0x0 make
to unblock all modes by default and confirm that the shell remains working.It should remain working either (depending on the baud rate and board clock configuration) because the correct power mode has been blocked to keep the UART clocked or because it is able to wake via LLWU or GPIO interrupt, but in any case it should "automatically" remain working for any baud and board configuration.
Currently there are bugs preventing GPIO interrupts from working properly on Kinetis. This is fixed in #14376.
There also may be an issue with some boards working at baud rates below 115200 which appears to be reproducible on master.
Issues/PRs references
This PR needs #14376 for GPIO interrupt bugfixes.