Wake up from standby using wake-up pins STM32C5
Hi,
I’m seeing some odd behavior on the STM32C5 when waking the uC up using the wake-up pins from standby mode.
TLDR:
The uC seems to ignore the configured wake-up pin polarity and wakes up on any edge. Is this a known issue with the STM32C5 controller?
In STM32CubeMX2 I configured the PWR peripheral low power mode to standby with wake-up pins 4 and 5 as wake-up sources. The signal on these pins are default high and I need the uC to wake up on a falling-edge on either pins (configuration images / generated code below).
To enter the standby mode in my application I call the following two functions and the controller goes to standby successfully:
HAL_PWR_LP_CleanWakeupSource(HAL_PWR_WAKEUP_SOURCE_ALL);
mx_pwr_enter_low_power();Now I expect the uC to only wake up on the falling-edge trigger so I tried:
- Wake-pin was HIGH, put uC to standby, pulled wake-pin LOW and the uC woke-up as expected.
- Wake-pin was LOW, put uC to standby, pulled wake-pin HIGH and the uC woke-up. This is unexpected as it is configured to only wake-up on a falling edge.
I measured the signal on the scope (see image below). Yellow is the voltage on wake-pin 4 and Red is a gpio I set after the uC boots to indicate the controlles has woken-up. I checked the signal for glitches that might have woken up the uC but the signal is stable.



/**
******************************************************************************
* @file : mx_pwr.c
* @brief : PWR Peripheral initialization
******************************************************************************
* @attention
*
* Copyright (c) 2026 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the mx_stm32c5xx_hal_drivers_license.md file
* in the same directory as the generated code.
* If no mx_stm32c5xx_hal_drivers_license.md file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "mx_pwr.h"
#include "mx_rcc.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private functions prototype------------------------------------------------*/
/******************************************************************************/
/* Exported functions for PWR in HAL layer */
/******************************************************************************/
system_status_t mx_pwr_init(void)
{
hal_pwr_wakeup_pin_config_t wkup_config;
/****************************************************************************/
/* Wakeup Pins Configurations */
/****************************************************************************/
/* Configuration of selected Wakeup pins with pull NO and LOW polarity */
wkup_config.polarity = HAL_PWR_WAKEUP_PIN_POLARITY_LOW;
wkup_config.pull = HAL_PWR_WAKEUP_PIN_PULL_NO;
if (HAL_PWR_LP_SetConfigWakeupPin(HAL_PWR_WAKEUP_PIN_4 | HAL_PWR_WAKEUP_PIN_5, &wkup_config) != HAL_OK)
{
return SYSTEM_POWER_ERROR;
}
/****************************************************************************/
/* Enable all configured Wakeup Pins */
/****************************************************************************/
HAL_PWR_LP_EnableWakeupPin(HAL_PWR_WAKEUP_PIN_4 | HAL_PWR_WAKEUP_PIN_5);
return SYSTEM_OK;
}
system_status_t mx_pwr_deinit(void)
{
/****************************************************************************/
/* Disable all configured Wakeup Pins */
/****************************************************************************/
HAL_PWR_LP_DisableWakeupPin(HAL_PWR_WAKEUP_PIN_4 | HAL_PWR_WAKEUP_PIN_5);
return SYSTEM_OK;
}
/******************************************************************************/
/* Runtime APIs */
/******************************************************************************/
system_status_t mx_pwr_enter_low_power(void)
{
/* Clear both standby and stop flags */
HAL_PWR_CleanPreviousSystemPowerMode();
/* Enter the MCU in standby mode */
HAL_PWR_EnterStandbyMode();
/* Execution will never reach this point */
return SYSTEM_OK;
}
system_status_t mx_pwr_exit_low_power(void)
{
/* This API is the runtime API generated by RCC module */
return (mx_rcc_init());
}
uint32_t mx_pwr_system_was_low_power(void)
{
return ((HAL_PWR_GetPreviousSystemPowerMode() == HAL_PWR_SYSTEM_STANDBY_MODE) ? 1 : 0);
}
Kind regards,
Dennis
