Question
How can I exit from standby mode using wakeup pin ?
Posted on October 08, 2014 at 17:48
Hi,
I'm using an stm32f401 mcu, mounted above Discovery platform, trying to understand how can I correctly use the standby low power mode; for this reason, I use the PA0 wake up to exit from this low power mode, but it doesn't work. The PA0, for my project, is setted as external interrupt, but when I use the standby mode, I configure it using the HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1) function that sets the EWUP bit in power control/status register, but when the mcu enter in standby mode and I push the button linked with PA0 pin, the mcu instead of restart code after the enter standby mode instruction, it resets. This is my code (only the code to enter/exit of standby mode):if
(f_EnterStdbyMode)
{
blink(3);
/* Set PDDS in power control register */
PWR->CR |= (uint32_t) 0x00000002;
/* Clear flaf wake up */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
while
((PWR->CSR & (uint32_t) 0x00000001)!=0);
//attesa che il WUF si azzeri (via HW)
/* Enable PA0 wake-up functionalities */
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
HAL_PWR_EnterSTANDBYMode();
//<- qui il codice si ferma
HAL_GPIO_TogglePin(debugPin.port, debugPin.pin);
//<- qui il codice riprende la sua esecuzione
HAL_GPIO_TogglePin(debugPin.port, debugPin.pin);
/* Disable PA0 wake-up functionalities */
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
f_EnterStdbyMode =
false
;
blink(3);
} Please, can anyone tell me what's going on ?
Regards