cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_PWR_EnterSTANDBYMode() does not put uC into sleep mode.

Vu.Andy
Associate III
Posted on November 15, 2017 at 19:54

I am using STM32F042F6 uC.  I am not sure why this HAL_PWR_EnterSTANDBYMode() does not put the uC to sleep mode.  But the odd thing is in certain condition, it does go the Standby mode, but in some other boards, the uC does not go to standby mode. 

I would think this function is unconditionally put the uC to Standby mode.  Is there any condition in which the uC cannot be put into Standby mode?  Why would in some condition I can put uC in standby and in some I could not?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Nesrine M_O
Lead II
Posted on November 16, 2017 at 14:04

Hi

Vu.Andy

,

I recommend you to start from ready example under the

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef0.html

firmware package:

STM32Cube_FW_F0_V1.9.0\Projects\STM32072B_EVAL\Examples\PWR\PWR_STANDBY

-Nesrine-

View solution in original post

2 REPLIES 2
Nesrine M_O
Lead II
Posted on November 16, 2017 at 14:04

Hi

Vu.Andy

,

I recommend you to start from ready example under the

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef0.html

firmware package:

STM32Cube_FW_F0_V1.9.0\Projects\STM32072B_EVAL\Examples\PWR\PWR_STANDBY

-Nesrine-

Posted on November 16, 2017 at 20:07

 ,

 ,

Thank you.

After looking into the example, apparently I have to execute the following codes before going into standby mode.

I am using the IWDG to wake up so the Wakeup in is not needed.

 , __HAL_RCC_PWR_CLK_ENABLE(), , , ,

 , /* ♯ ♯ ♯ ♯ Disable all used wakeup sources: WKUP pin ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ */

 ,

 , HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1),

 ,

 ,

 ,

 , /* ♯ ♯ ♯ ♯ Clear all related wakeup flags ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ */

 ,

 , /* Clear PWR wake up Flag */

 ,

 , __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU),

 ,

 ,

 ,

 , /* Disable WKUP pin */

 ,

// , HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2),

 ,

 , ,  ,

 ,

 , ,  ,HAL_PWR_EnterSTANDBYMode(),