Skip to main content
Associate II
Nov 11, 2026 7:07 AM UTC
Question

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

3 replies

ST Technical Moderator
Nov 17, 2026 10:52 AM UTC

Hello ​@DEs 

Thank you for bringing this issue to our attention.

I reported this internally.

Internal ticket number: CDM0067559 (This is an internal tracking number and is not accessible or usable by customers).

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
ST Technical Moderator
Nov 19, 2026 3:19 PM UTC

Hello ​@DEs 

Could you please provide a few more details about your hardware setup?

How are you generating the rising and falling edges on wake-up pins 4 and 5? Are you using a GPIO from another microcontroller, a signal generator, or a manually operated switch?
Are there any external pull-up or pull-down resistors on the wake-up pins?

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
DEsAuthor
Associate II
Nov 19, 2026 3:37 PM UTC

Hi ​@Saket_Om,

Yes I can, see the images below. The intended use is to detect te presence of the external power supply (+5V_ISO). When this voltage is present the signal IO_PWR_DET is pulled low by the optocoupler. When the external power supply is not connected the IO_PWR_DET signal is pulled high by a 10K resistor (R404).