cpu/stm32l1: optimize power consumption #11832
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
This PR is based on previous work in #8403 & #10052. On start-up it configures all GPIO's as AIN.
On other boards of the STM32 family (L0 & L4) this is done by default. In #11758 this was done for STM32F0-7, with #11830 that solves #11820, it can now be done for STM32L1.
As stated in this AN, doing this saves the consumption of the input Schmitt trigger. The only case where this shouldn't be done is when the pin is connected to an external driver that has a pull-up or pull-down setting, this should be handled by pertinent drivers.
Testing procedure
Supply voltage for all the below measurement was 3.3V. ASupply was measured directly threw the IDD pin either with a multi meter or NUCLEO-LPM01A power measurement extension.
As of know when entering STOP mode consumption on stm32l1 is around 500uA, with this PR it drops to 1.5uA (datasheet typ 1.4uA for l152re). To test run:
make BOARD=nucleo-l152re -C tests/periph_pm/ flash
Issues/PRs references
Depends on #11830 and #11489
Closes #11359 & #10052