-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cpu/sam0_common: implement pm_off() #14999
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
Conversation
Overall looks good. SAMD21 is still the black sheep of SAM0 family but that's the life. |
I have a good one for you: SAML11 and SAML21 looks good so far. |
@dylad I don't have saml10 or sam21 to measure right now - did you see an improvement there? |
When I did these measurements, I did not see any regression for these families (unlike SAME54) but my amperemeter is not accurate enough to see improvement on a few uA. |
My only issue right now is with SAME54 family for this PR. |
The thing is, if this is no improvement over the status quo, I don't see why we should have it. |
aebecac
to
1d1f9d5
Compare
1d1f9d5
to
3a52bc6
Compare
I'm restoring this because there is an important difference between OFF mode and what we currently have: OFF mode will cut the output of all pins. |
PM->SLEEPCFG.bit.SLEEPMODE = PM_SLEEPCFG_SLEEPMODE_OFF; | ||
while (PM->SLEEPCFG.bit.SLEEPMODE != PM_SLEEPCFG_SLEEPMODE_OFF) {} | ||
|
||
cortexm_sleep(1); |
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.
Shouldn't we call sam0_cortexm_sleep
instead like we do in pm_set()
?
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.
Nah, this turns off everything with no way to wake up again, so no need to switch clocks are configure GPIOs.
3a52bc6
to
6a7bcea
Compare
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 can confirm that the GPIOs turn off with this power mode.
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 don't have the hardware to test this, but if you and HendrikVE tested it successfully, that is sufficient for me.
You can squash the changes directly.
2f4dba2
to
fea0e0f
Compare
Contribution description
Use the OFF mode instead of whatever lowest standby / hibernate mode was provided my
pm_set()
Testing procedure
pm off
should turn off the CPU.You can verify this in
tests/periph/gpio
:master
PB05 will stay HIGH
this PR
PB05 will become floating / LOW
Issues/PRs references