Skip to content

Commit

Permalink
samples: boards: stm32 power_mgt stdby and shutdown
Browse files Browse the repository at this point in the history
Polarit low is wrong : wakeup pin 2 is active low
so the wakeup must be detected on the rising edge
This is the default wakeup pin2 config.
Apply the recommended sequence to enter low power standby

Signed-off-by: Francois Ramu <francois.ramu@st.com>
  • Loading branch information
FRASTM committed Oct 8, 2024
1 parent 9655c2f commit 63c856c
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions samples/boards/st/power_mgmt/standby_shutdown/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,19 @@ static struct gpio_callback button_cb_data;

void config_wakeup_features(void)
{
/* Configure wake-up features */
/* WKUP2(PC13) only , - active low, pull-up */
/* Set pull-ups for standby modes */
LL_PWR_EnableGPIOPullUp(LL_PWR_GPIO_C, LL_PWR_GPIO_BIT_13);
LL_PWR_IsWakeUpPinPolarityLow(LL_PWR_WAKEUP_PIN2);
/* Enable pin pull up configurations and wakeup pins */
LL_PWR_EnablePUPDCfg();
/*
* Configure wake-up features : WKUP2(PC13) only
*
* The Following Wakeup sequence is highly recommended prior to each Standby mode entry
* mainly when using more than one wakeup source this is to not miss any wakeup event:
* - Disable all used wakeup sources,
* - Clear all related wakeup flags,
* - Re-enable all used wakeup sources,
* - Enter the Standby mode.
*/
LL_PWR_DisableWakeUpPin(LL_PWR_WAKEUP_PIN2);
LL_PWR_ClearFlag_WU(); /* Clear wakeup flags */
LL_PWR_EnableWakeUpPin(LL_PWR_WAKEUP_PIN2);
/* Clear wakeup flags */
LL_PWR_ClearFlag_WU();
}

void button_pressed(const struct device *dev, struct gpio_callback *cb,
Expand Down

0 comments on commit 63c856c

Please sign in to comment.