Skip to main content
Graduate II
February 5, 2024
Solved

MCU State changed or unchanged when waking up from stop mode

  • February 5, 2024
  • 3 replies
  • 1187 views

I am using F411 as the main controller of some DAC/ADC modules.

I need to put MCU in stop mode to reduce its power consumption.

I wonder whether or not I need to configure all the I2C, SPI, and UART interfaces when MCU wakes up from stop mode.

    This topic has been closed for replies.
    Best answer by Sarra.S

    Hello @HDaji.1 

    When the STM32F411 MCU wakes up from stop mode, it's necessary to reconfigure the clock.

    the need to reconfigure all the I2C, SPI, and UART depends on your specific configuration, if these interfaces are disabled or their configuration is altered during stop mode, you will need to reconfigure them upon wakeup. 

    3 replies

    Sarra.SAnswer
    ST Employee
    February 5, 2024

    Hello @HDaji.1 

    When the STM32F411 MCU wakes up from stop mode, it's necessary to reconfigure the clock.

    the need to reconfigure all the I2C, SPI, and UART depends on your specific configuration, if these interfaces are disabled or their configuration is altered during stop mode, you will need to reconfigure them upon wakeup. 

    HDaji.1Author
    Graduate II
    February 5, 2024

    thx, @Sarra.S 

    I saw a sample code, which uses RTC to wake up MCU:

     HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
     HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
     SystemClock_Config();
     HAL_ResumeTick();

     As you said, the 3rd line is to configure clock.

    I have 3 more questions to trouble you:

    1. What does HAL_ResumeTick do?
    2. If I want to reduce power consumption as much as possible, before MCU goes to stop mode, is it better to disable I2C, SPI, and UART?
    3. I don't understand why their configuration can be changed during stop mode. Could you give an example?
    ST Employee
    February 5, 2024

    >>What does HAL_ResumeTick do?The HAL_ResumeTick function is used to resume the SysTick interrupt, which is often disabled during low-power modes to prevent it from waking up the CPU every 1ms

    >>If I want to reduce power consumption as much as possible before MCU goes to stop mode, is it better to disable I2C, SPI, and UART?

    these peripherals can draw power even when they're not actively being used, so yes, it's better to disable them

    >>I don't understand why their configuration can be changed during stop mode. Could you give an example?

    some peripherals may have settings that are designed to change during low-power modes to further reduce power consumption. An example could be a peripheral that has a low-power mode of its own, which is automatically enabled when the MCU enters stop mode. This is not necessarily applicable in your case