[riot-notifications] [RIOT-OS/RIOT] stm32-common/spi: allow custom pin modes on spi to minimize power consumption (#11542)
notifications at github.com
Fri May 17 15:09:28 CEST 2019
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
### Contribution description
This PR is an attempt to provide a way to better optimize power consumption on STM32 by giving a finer control on the GPIO modes configured on each SPI pins (MOSI/MISO/SCLK).
All STM32 but STM32F1 support push-pull (GPIO_OUT) with a pull-up/pull-down configuration. In general, the default is to not use both at the same time but it appears that on STM32, not using pull-up/pull-down with push-pull results in higher power consumption.
Since the choice of pull-up/pull-down is highly correlated to the board configuration, this PR provides a way to configure this in the peripheral configuration struct for each configured SPI periph, for better flexibility. The feature is provided as an extension of `periph_spi` called `periph_spi_gpio_mode` (similiar `periph_gpio_int` with `periph_gpio`).
To avoid Activating this
As an example, it's applied to nucleo-l152re but maybe this could be applied to all nucleo boards. At least the current approach allows to add this progressively.
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes
### Testing procedure
Build and flash an application using SPI and verify that it still work. Another interesting test could be to measure power consumption of this application when the board goes to deep sleep. With this PR, the minimal power consumption is reached, with master, it's always noticeably greater.
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
### Issues/PRs references
Examples: Fixes #1234. See also #5678. Depends on PR #9876.
Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* stm32-common/spi: add customizable gpio modes for spi pins
* boards/nucleo-l152re: define custom spi pins mode
-- File Changes --
M boards/nucleo-l152re/Makefile.dep (3)
M boards/nucleo-l152re/Makefile.features (2)
M boards/nucleo-l152re/include/periph_conf.h (5)
M cpu/stm32_common/include/periph_cpu_common.h (5)
M cpu/stm32_common/periph/spi.c (16)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications