AnsweredAssumed Answered

STM32F4 having trouble into SLEEP mode

Question asked by Tian.Yiran on Mar 24, 2017
Latest reply on Mar 24, 2017 by Nesrine M

Hello there,

 

Currently I'm using a STM32F407VG discovery board to testing the stm32 low power features. STM32CubeMX was used to generate a simple demo. However, it seems always not able to enter sleep mode (standby mode tested, same story). 

 

Its a simple program, all peripherals and clock are remain in reset state. The main function looks like this:

 

 int main(void)

{

    HAL_Init();

    SystemClock_Config();

 

    HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);

 

   while(1)

   {

   }

}

 

Its for sure code will goes to while(1) segment and not enter SLEEP mode. I've done some readings and say Systick can cause the problem. So I add code below right before calling HAL_PWR_EnterSLEEPMode();

 

// disable SysTick

SysTick->CTRL = 0x00000004;

 

And most of time MCU can get into low power mode, but still, miss one or two shot out of few tests. 

 

So my questions are as below:

1. Do I have to close SysTick before WFI? If not, which part have I missed?

2. Datasheet saying that any pending/activated interrupt will cause not able to into SLEEP mode. However I'm running this code in main(), not IRQ handler. In that case nothing could block me from entering SLEEP mode correct?

3. Same story entering STANDBY mode as SLEEP. What have I missed?

4. I've tried put HAL_PWR_EnterSLEEP() into while(1) block. Without disable SysTick, it never trigger SLEEPMODE.

 

Appreciate for your reply in advance!! Really looking forward to get response soon

 

Regards,

Tien 

Outcomes