cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 unwanted wakeup PA0

Kuikui
Associate III
Posted on June 18, 2017 at 15:07

Hi,

Using an STM32F446.

I setup PA0 to exit from standby mode.

The first time I enter StandbyMode, it works well, and I can exit from standby mode by using PA0.

But the next time entering standby mode, the STM32 automatically wakes-up from standby without any action on PA0 ( stays at 0 ).

How can this be ?

The code I use for entering standby mode is :

RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);

PWR_BackupAccessCmd(ENABLE);

RCC_BackupResetCmd(ENABLE);

RCC_BackupResetCmd(DISABLE);

PWR_WakeUpPinCmd(PWR_WakeUp_Pin1, DISABLE);

PWR_ClearFlag(PWR_FLAG_WU);

/* Check if the StandBy flag is set */

if (PWR_GetFlagStatus(PWR_FLAG_SB) != RESET)

{

/* Clear StandBy flag */

PWR_ClearFlag(PWR_FLAG_SB);

}

PWR_WakeUpPinCmd(PWR_WakeUp_Pin1, ENABLE);

PWR_EnterSTANDBYMode();

Thanks for help.

Best regards,

Vincent.

#stm32f4-wakeup
1 REPLY 1
Kuikui
Associate III
Posted on June 19, 2017 at 11:20

ok, I got the point.

There's a mistake in SPL library :

void PWR_ClearFlag(uint32_t PWR_FLAG)

{

/* Check the parameters */

assert_param(IS_PWR_CLEAR_FLAG(PWR_FLAG));

#if defined (STM32F427_437xx) || defined (STM32F429_439xx)

if (PWR_FLAG != PWR_FLAG_UDRDY)

{

PWR->CR |= PWR_FLAG << 2;

}

else

{

PWR->CSR |= PWR_FLAG_UDRDY;

}

#endif /* STM32F427_437xx || STM32F429_439xx */

#if defined (STM32F40_41xxx) || defined (STM32F401xx) || defined (STM32F410xx) || defined (STM32F411xE) || defined(STM32F412xG)

PWR->CR |= PWR_FLAG << 2;

#endif /* STM32F40_41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F412xG */

}

STM32F446 users like me have been forgotten !!

So I've done it manually : PWR->CSR |= 0x0000000C; <= to clear WU and SB flags