-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
STM32: configure wake-up pins with GPIOs from devicetree for exiting Poweroff #73058
STM32: configure wake-up pins with GPIOs from devicetree for exiting Poweroff #73058
Conversation
@nandojve ^^ |
16a250e
to
e825ab6
Compare
Additional context: this PR introduced a STM32 custom GPIO flag, |
Hi @bjarki-trackunit, I would appreciate your feedback, thanks! |
Add DT binding for stm32 PWR peripheral that controlls wake-up pins. This binding primarily introduces wake-up pins configuration in a unifed way that takes into consideration the variations between STM32 SoC series & facilitates the association of GPIO pins with their corresponding wake-up pins. Signed-off-by: Abderrahmane Jarmouni <[email protected]>
Add devicetree node of stm32 PWR peripheral that controlls wake-up pins. The new node includes child nodes for wake-up pins configuration. We only add these nodes for STM32 SoC series that support Poweroff. Signed-off-by: Abderrahmane Jarmouni <[email protected]>
e825ab6
to
4235e22
Compare
Rebase |
4235e22
to
601e1de
Compare
Moving assignee from @galak to @henrikbrixandersen as the owner of the next impacted subsystem (GPIO) |
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.
Otherwise LGTM in the general lines.
Hi, @ajarmouni-st , I am not quite sure to discuss an issue here about your implementation. I just tested wake up pin sample you implemented in your repo: https://github.com/ajarmouni-st/zephyr_dev/tree/dev_stm32_wkup_pins_gpios on the stm32u575zq dev board. Before powering the system off, current consumption: ~ 12mA After powering the system off, current consumption: 14uA I was expecting less than 500 nA of consumption in shutdown mode: So, I was wondering if I was following up on the correct repo and steps? And any ideas? |
Hi @zafersn, was it a
Just to verify quickly that the system actually goes into shutdown mode, LED 1 will be turned off. Will try to verify current consumption on |
Thanks for quick reply @ajarmouni-st : I see the differences now that you have |
@zafersn I got 1 uA but I don't know if it's the real consu. or it's bcz my ammeter cannot go lower. In any case, feel free to open an issue regarding current consumption in shutdown mode on STM32U575 & we can continue the discussion there. |
a404168
to
5007045
Compare
Ok thanks for this information. BTW, I also tried to get reset cause information.
cause return with 0 after waking up from LL_PWR_SHUTDOWN_MODE |
@zafersn I had it in the PR previously but decided to remove it cz I couldn't get consistent results on all boards, see https://github.com/zephyrproject-rtos/zephyr/compare/4235e22f6c855f3c58386a04812f57ce084618a0..601e1ded1dc99273ab9ce6c4b253fdfd4363279a |
Implement GPIO pins configuration as sources for STM32 PWR wake-up pins behind the scenes exclusively from devicetree information for all series using the public stm32_pwr_wkup_pin_cfg_gpio() function. Introduce macros for parsing & storing DT wake-up pins config in C structs. Introduce user-configurable STM32_WKUP_PINS Kconfig flag. Signed-off-by: Abderrahmane Jarmouni <[email protected]>
Introduce public functions for GPIO pins configuration as sources for STM32 PWR wake-up pins, in stm32 drivers & routines such gpio_stm32 & poweroff. Signed-off-by: Abderrahmane Jarmouni <[email protected]>
Introduce a custom STM32_GPIO_WKUP GPIO flag. Use the newly introduced stm32_pwr_wkup_pin_cfg_gpio() public function to configure GPIO pins, that have the STM32_GPIO_WKUP flag in DT, as sources for STM32 PWR wake-up pins, on the condition that there is a wake-up pin that corresponds to each of them. These GPIO pins can then be used to power on the system after Poweroff like a reset pin. Signed-off-by: Abderrahmane Jarmouni <[email protected]>
Complete wake-up pins configuration before powering off the system when the CONFIG_STM32_WKUP_PINS flag is enabled. Signed-off-by: Abderrahmane Jarmouni <[email protected]>
This sample demonstrates how gpio pins can be used to power on the system after a Poweroff, just like a reset pin. The user only needs to add the STM32_GPIO_WKUP flag to the gpio pin in "gpios" property of a DT device such a button or a sensor. The samples Powers off the system after a delay then the user can power it on with the user button that has the STM32_GPIO_WKUP flag in DT. Only works on STM32 boards that support Zephyr POWEROFF (U5, WL, WB, & L4 SoC series), & also have a user button whose GPIO pin is associated with a wake-up pin (see PWR node in SoC dtsi file). Signed-off-by: Abderrahmane Jarmouni <[email protected]>
5007045
to
6f0ab3d
Compare
This PR implements end-to-end configuration of GPIO pins as sources for STM32 PWR wake-up pins behind the scenes exclusively from devicetree information for all series using a newly introduced public
stm32_pwr_wkup_pin_cfg_gpio()
function insidegpio_stm32.c
driver during initial GPIO pin configuration.For this, we add a devicetree binding for the STM32 power contoller (PWR) peripheral which manages all device power supplies and power modes transitions, including the control of wake-up pins. We note that this initial PWR binding is focused on wake-up pins.
We also introduce a STM32 specific sample application that demonstrates how GPIO pins can be used to power on the system after a Poweroff, just like a reset pin.
The user only needs to add the
STM32_GPIO_WKUP
custom GPIO flag to the GPIO pin in "gpios" property of a DT device, such as a button or a sensor.The sample powers off the system after a delay then the user can power it on again with the user button that has the
STM32_GPIO_WKUP
flag in DT.Will only work on STM32 boards that support Zephyr POWEROFF (U5, WL, WB, & L4 SoC series), & also happen to have a user button whose GPIO pin is associated with a wake-up pin (see PWR node in SoC dtsi file).
For more information about how wake-up pins are managed & configured on a given STM32 SoC, please refer to the "Power control (PWR)" section in the Reference Manual. Information about GPIOs associated with wake-up pins can be found in the "pinouts and pin description" section in the datasheet.