2015-11-02 01:56 AM
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
2015-11-02 08:28 AM
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.
2015-11-04 01:57 AM
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,2015-11-06 02:08 AM
It may not be relevant but scoping the wakeup pin line a see a short pulse occurring at the reset.
2015-11-12 01:25 AM
This is the same across several boards, I've still got no idea what is causing this issue.
2015-11-12 02:51 AM
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?2015-11-13 08:14 AM
I'm not sure which flags I should be checking to find that out? I can't see anything obvious in the datasheet.
2015-11-13 10:46 AM
Take a look at the following registers:
RCC_CSR PWR_CR PWR_CSR2015-11-19 04:20 AM
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 0x8683By 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?2015-11-19 07:20 AM
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]