cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F437 exiting standby incorrectly

georgeclarkson5
Associate II
Posted on November 02, 2015 at 10:56

Hi there,

I'm currently having some issues with the STM32F437 package going into standby, whenever I send the instruction to go into standby the device goes to sleep but then almost immediately wakes back up again. The code I'm using to send the device to standby is:

/*## Disable all wakeup sources #####################################*/
/* Disable Wake-up pin */
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
/* Disable RTC Alarm */
HAL_RTC_DeactivateAlarm(&hrtc, RTC_ALARM_A);
HAL_RTC_DeactivateAlarm(&hrtc, RTC_ALARM_B);
/*## Clear all related wakeup flags ######################################*/
/* Clear PWR wake up Flag */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/* Clear the Alarm Flag */
__HAL_RTC_ALARM_CLEAR_FLAG(&hrtc, RTC_FLAG_ALRAF);
__HAL_RTC_ALARM_CLEAR_FLAG(&hrtc, RTC_FLAG_ALRBF);
/*## Re-enable all used wakeup sources ###################################*/
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
HAL_PWR_EnterSTANDBYMode();

Am I missing anything here? #pwr #standby
19 REPLIES 19
Amel NASRI
ST Employee
Posted on November 02, 2015 at 17:28

Hi Deamonata,

Is the power clock enabled?

__HAL_RCC_PWR_CLK_ENABLE();

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

georgeclarkson5
Associate II
Posted on November 04, 2015 at 10:57

Hi Mayla,

Thanks for replying, I think it was already enabled elsewhere but I added it to my shutdown feature just incase, but unfortunately it didn't fix the issue, the device still restarts as soon as it shuts down,

georgeclarkson5
Associate II
Posted on November 06, 2015 at 11:08

It may not be relevant but scoping the wakeup pin line a see a short pulse occurring at the reset. 

georgeclarkson5
Associate II
Posted on November 12, 2015 at 10:25

This is the same across several boards, I've still got no idea what is causing this issue.

Posted on November 12, 2015 at 11:51

I've still got no idea what is causing this issue.

Are the flags in the core indicative of the what caused the reset out of standby?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
georgeclarkson5
Associate II
Posted on November 13, 2015 at 17:14

I'm not sure which flags I should be checking to find that out? I can't see anything obvious in the datasheet.

Posted on November 13, 2015 at 19:46

Take a look at the following registers:

RCC_CSR

PWR_CR

PWR_CSR

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
georgeclarkson5
Associate II
Posted on November 19, 2015 at 13:20

Ok I checked those registers

PWR_CRS comes back as 0x102, which means the standby flag is set and the WKUP pin is enabled.

PWR_CR comes back as 0xc000  which is just setting the PLS bits (BIT 1& 2)

RCC_CR comes back as 0x8683

By my understanding these registers seem to suggest I was in the low power mode and the only way I could wake up would be from the wakeup pin? 

ftiti
Associate II
Posted on November 19, 2015 at 16:20

Hello,

Is you code is entering and exiting standby mode more than one time ?

I think that it is your case.

Anyway, you should clear the standby flag (PWR_FLAG_SB) in addition to to all used wakeup sources' flags.

__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);

[All for one and one for all]