Skip to main content
Visitor II
October 25, 2024
Solved

Not waking up from stop3 mode immediately after Programming STM32 controller

  • October 25, 2024
  • 7 replies
  • 5302 views

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);
}
    This topic has been closed for replies.
    Best answer by ASEHST

    Hello @mohan-ltts,

    Could you please try to implement the attached files in your project?

    These files include our modifications, which work as expected. You can compare them with your implementation.

     

    With Regards,

    7 replies

    Technical Moderator
    October 25, 2024

    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!

    Visitor II
    October 25, 2024

    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

    Visitor II
    October 29, 2024

    Any update on this issue?

    Technical Moderator
    October 30, 2024

    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.

    Visitor II
    November 4, 2024

    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

    ST Employee
    December 19, 2024

    Hello @mohan-ltts,

    Using this ST example STM32CubeU5/Projects/NUCLEO-U575ZI-Q/Examples/PWR/PWR_LPMODE_RTC at main · STMicroelectronics/STM32CubeU5 with your configuration does not cause the issue you mentioned. It works fine without the need for a reset.

    As mentioned by @Imen.D, please redefine the PWR_S3WU_IRQHandler to wake up the system as shown below.

    image (3).png

    This scenario was tested with IAR, STM32Cube programmer v1.17.0 and STM32Cube programmer v1.18.0.

    Please try to use the newer versions as they are more up-to-date and can help avoid any potential issues.

     

    With Regards,

    Visitor II
    December 24, 2024

    Hello @ASEHST 

    Thanks for your reply.

    Not sure why you are not able to reproduce this issue, i'm able to reproduce this issue every time with STMcubeprogrammer v2.12.0.

    As per my understanding some bit is set or cleared in some register after flashing the code because of which intruppt is not getting triggered. But after power cycle, register might be set to default values or configured properly so it is working as expected. So i wanted to know which registers and all we need to check before entering into stop mode so that we will not get this issue.

    I verified WUCR1, WUSR and SR registers and i don't see any issues.

    mohanltts_0-1735020870721.png

    Thanks,

    Mohan

    ST Employee
    December 24, 2024

    Hello @mohan-ltts,

    Using the NUCLEO-U575ZI-Q and updating our example PWR_LPMODE_RTC with your code, we were unable to reproduce the issue.

    To assist you more effectively, could you please provide us with your project? Additionally, please specify the board you are using.

     

    With Regards,

    Visitor II
    December 27, 2024

    Hello @ASEHST 

     

    Can you please flash the attached binary in NUCLEO-U575ZI-Q board using STMcubeprogrammer v2.11.0 and STMcubeprogrammer v2.17.0 and share me your observation?

    Binary is generated from PWR_LPMODE_RTC example and SYSTEM_STOP3_MODE is enabled.

    If you flash the code using STMcubeprogrammer v2.11.0, you can see LED is Turn ON continuously which means it is not entering into STOP3 mode and it will work as expected if you power cycle once after flashing. This behaviour you will not see when you flash the code using STMcubeprogrammer v2.17.0.

    Can you please try and let me know your observation?

    Thanks,

    Mohan

    ST Employee
    December 27, 2024

    Hello, 

    Please ensure that you suspend the SysTick interrupt before entering STOP mode as shown below:

    ASEHST_0-1735317272389.png

    With Regards,

    Visitor II
    December 27, 2024

    SysTick is suspended and binary is generated from PWR_LPMODE_RTC example only, so it is already taken care in that example.

     

    Thanks,

    Mohan 

    ASEHSTAnswer
    ST Employee
    December 30, 2024

    Hello @mohan-ltts,

    Could you please try to implement the attached files in your project?

    These files include our modifications, which work as expected. You can compare them with your implementation.

     

    With Regards,

    ST Employee
    January 20, 2025

    Hello everyone, 

    I’ve moved the last comment of @mohan-ltts which wasn’t directly related to the initial post (Separate thread link: Issue to wake up from stop 3 mode when migrating fr... - STMicroelectronics Community

    However, to conclude this discussion, the issue is resolved when suspending SysTick before entering stop 3 mode.

    Explorer
    July 29, 2025

    Hello @mohan-ltts @devfwtest , do you have any updates? I'm facing a similar issue on a customized PCB with STM32U585 mcu. In particular, RTC WakeUp Pin (PWR_WAKEUP_PIN7_HIGH_3) seems not to work properly without a power reset after programming MCU. After correctly setting RTC Alarm B and HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN7_HIGH_3), MCU does not wake up without brown out reset first.

    Visitor II
    July 30, 2025

    Hello,

    In our case resetting of Debug standby mode (making it to 0) resolved the issue. As I remember, zephyr version which we were using in that DBG clock was disabled. With DBG clock disabled and Standby mode bit set it was creating issue in MCU wakeup from sleep (PM) mode.

    If in case it does not help, I would suggest checking with appropriate version of ST cube examples. That may give some pointer.

    Good luck!

     

    Explorer
    July 31, 2025

    I'm currently using FreeRTOS, and I'm wondering if PWR->WUSCR = PWR_WUSCR_CWUF followed by HAL_DBGMCU_DisableDBGStopMode() could be useful, since what I've seen is that just RTC Wake Up pin did not wake up our MCU from Stop3 mode; other wake up pins (exti lines) correctly waked up MCU.