STMicroelectronics/STM32CubeF7

PWR_STOP_RTC example doesn't work

oscarhou opened this issue · 4 comments

Describe the set-up
STM32F769I_EVAL
STM32CubeIDE 1.7.0

Describe the bug
PWR_STOP_RTC immediately exits STOP mode after entering.
https://github.com/STMicroelectronics/STM32CubeF7/tree/master/Projects/STM32F769I_EVAL/Examples/PWR/PWR_STOP_RTC

This issue is probably not restricted to the STM32F769I_EVAL example

How To Reproduce

  1. In STM32CubeIDE use "Open Project From File System" to open the PWR_STOP_RTC example.
  2. Build and run the code.
  3. Observe that LED1 stays on instead of staying on for 5 seconds and turning off for ~20 seconds

The modules that you suspect to be the cause of the problem (Driver, BSP, MW ...).
Systick not being suspended before entering STOP mode.

The use case that generates the problem.
Running the example

How we can reproduce the problem.
Follow the reproduction steps above.

Hi @oscarhou,

Thank you for this report. We will get back to you with a feedback as soon as possible. Please excuse the delay it may take us sometimes to reply. Thank you for your comprehension.

With regards,

Hi @oscarhou,

We confirm the abnormal behavior you reported. It has been reported to our development teams for deeper analysis. We will get back to you as soon we have updates.

With regards,

ST Internal Reference: 132752

Hi @oscarhou,

I hope you are fine. Back to you about this topic. Actually, the behaviour you are observing is not a bug. Below the details.

As indicated in the readme.txt file, this example cannot be run while debug mode is enabled.

@note This example can not be used in DEBUG mode, this is due to the fact
that the Cortex-M7 core is no longer clocked during low power mode
so debugging features are disabled.

Root cause of the observed behaviour

The behaviour you observed is due to the fact that you ran the example most likely in debug mode. Indeed, as explained in the reference manual RM0385 Rev.8 pp. 1689-1690, for the debugger to keep connection to the core while in some low-power mode:

[The] debugger host must first set some debug configuration registers to change the low-power mode behavior.
In Stop mode, the bit DBG_STOP must be previously set by the debugger. This will enable the internal RC oscillator clock to feed FCLK and HCLK in STOP mode.

Said otherwise, while in debug mode, the core is not allowed to enter the stop mode.

Running the example in Release mode using CubeIDE

stcommunity_cubeide_switch_to_release_mode

Source = community.st.com.

Possible solutions while in debug mode

  • In case you inadvertently ran the example in debug mode, exit the debug mode simply by unplugging then plugging again the power supply cable of your board. Notice a simple push on the board's reset button is not sufficient.
  • In case you would like to run the example in debug mode, you can force clearing the bit DBG_STOP by calling function HAL_DBGMCU_DisableDBGStopMode() just before entering the stop mode.
    void HAL_DBGMCU_DisableDBGStopMode(void)
    {
    CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
    }

The Systick timer and the STOP mode

Regarding the solution you suggested, we tested it and observed indeed that the examples started running correctly after the Systick timer has been suspended. However, always according to the reference manual RM0385 Rev.8 pp. 112, the Systick timer is not available in STOP mode.

stm32f7_rm0385_p112_extract

Hence, although suspending the Systick timer seemed to cause the example to run correctly, it could be not adopted as the solution.

I hope my reply helped clarify this point and provided useful info. Do not hesitate if you have other questions related. Please allow me to close this thread.

With regards,