cancel
Showing results for 
Search instead for 
Did you mean: 

Not waking up from stop3 mode immediately after Programming STM32 controller

mohan-ltts
Associate II

I am working with STM32 U575/U5A5 series of STM32 controllers in low power mode. I have programmed the controller to enter into Stop 3 mode and wake from stop3 mode based on wakeup Pin(High on PF2). With this implementation issue what we observed is once immediately flashing hex file into controller using STlink programmer, Controller is entering in stop3 mode but it is not waking up from stop3 mode even after low to high transistion on wakeUp pin(PF2). If I remove the power and connect it back, it is working as expected enterning into stop mode 3 and waking up from stop mode 3 on low to high transistion on wakeUp pin(PF2) all the time. 

The question here is why for the first time after flashing hex file into controller, entering into stop3 mode but not waking up from stop3 mode and requires power reset?

low power mode is configured as follows:

void LowPowerInit()
{    
    LL_RCC_SetClkAfterWakeFromStop(RCC_STOP_WAKEUPCLOCK_SELECTED);
    __HAL_RCC_PWR_CLK_ENABLE();    
    HAL_PWREx_EnableUltraLowPowerMode();
 
    //Selecting USB select pin(PF2) as wakeup source.
    HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN8_HIGH_0);
 
    NVIC_ClearPendingIRQ(EXTI2_IRQn);
    HAL_NVIC_SetPriority(EXTI2_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(EXTI2_IRQn);
 
    EnterStop3Mode();
}
 
void EnterStop3Mode()
{     
    HAL_PWREx_EnterSTOP3Mode(PWR_STOPENTRY_WFI);    
    SystemClockConfig();
 
    LL_LPM_DisableSleepOnExit();
    LL_PWR_ClearFlag_WU();
    LL_PWR_ClearFlag_STOP();
    LL_PWR_ClearFlag_SB();
    irq_unlock(0);
}
7 REPLIES 7
Imen.D
ST Employee

Hello @mohan-ltts ,

Did you suspend the SysTick interrupt before entering STOP mode?

To wake-up the system from Stop 3 low-power mode, you should redefine PWR_S3WU_IRQHandler (From NVIC table) to handle the interrupt request, then clearing wake-up flags.

Check also the wakeup source selection :

ImenD_1-1729866111695.png

According to the RM0456 (section: 10.7.9 Stop 3 mode), you can exit the STOP 3 mode using WKUPx pin edge, RTC/TAMP event/interrupt, NRST pin external reset, IWDG reset, BOR reset. 

ImenD_0-1729865753669.png

I advise you to review the example provided in STM32CubeU5 :

STM32CubeU5/Projects/NUCLEO-U575ZI-Q/Examples/PWR/PWR_LPMODE_RTC at main · STMicroelectronics/STM32CubeU5 (github.com).

Hope this helps you!

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hello @Imen.D 

Code is working fine after power cycle the hardware, but why first time after flashing the code power cycle is required?

Tried suspending the SysTick interrupt before entering STOP mode, but still didn't help. Still it requires power cycle to work as expected

Actually our hardware has power backup capacitor, so to power cycle the board we need to remove input power supply as well as need to discharge the power backup capacitor which we can't do every time.

Thanks,

Mohan

Hello @Imen.D ,

In above code just i replaced "HAL_PWREx_EnterSTOP3Mode(PWR_STOPENTRY_WFI)" call with "HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI)" to check the behaviour of STOP2 mode. But still behaviour is same first time after flashing code it requires power cycle then only it is working as expected otherwise it is not waking up from STOP2 mode. So problem is not with handling PWR_S3WU_IRQHandler since it is required only for STOP3 mode and not for STOP2.

This exercise i performed to verify problem is with handling PWR_S3WU_IRQHandler or not. 

mohan-ltts
Associate II

Any update on this issue?

Hello @mohan-ltts 

We have tested the scenario on our side and were unable to reproduce the problem. The MCU successfully enters STOP3 mode and wakes up without requiring a power reset.

To assist you more effectively, we kindly request that you share your project with us. This will enable us to provide you with the most accurate support.

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

Hi, 

Is there any difference between STMCubeProgrammer version v2.12.0 and v2.17.0?

If we flash the code using version 2.12.0 then power cycle is required, but if we flash the code using version 2.17.0 power cycle is not required.

any reason for this behaviour?

Thanks,

Mohanraj D

Hello @mohan-ltts 

 

For assistance with the STM32Cube programmer, please post your question on the STM32Cube programmer forum.

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar