tests/periph_pm: use button as a wake-up source #12710
Merged
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
To test if GPIO interrupts can wake the CPU from sleep, configure BTN0 (if available) as a wake-up source.
Pressing the buttong should wake up the CPU.
Testing procedure
On
samr21-xpro
enterset 0
to enter the deepest sleep mode.You will find that the CPU does not react to UART input anymore.
Press the button on the board.
A
Button pressed.
message should be printed and the CPU should return to the previous operation mode.Issues/PRs references
During #12615 it was discussed why GCLK0 wasn't used for the EIC controller. My speculation for the use of the 32kHz clock was that it might still work in deep sleep mode.
This tests confirms that assumption.
With
the CPU won't wake up from Deep Sleep when the button is pressed.
A drawback of the slow clock is that fast interrupts are lost. This is a real problem I observed with the
at86rf215
driver.A solution would be to switch the EIC clock to GCLK2 when entering Deep Sleep.