AnsweredAssumed Answered

Problem entering Standby mode STM32L051

Question asked by JaiMadafaca on Nov 18, 2016
Latest reply on Nov 21, 2016 by JaiMadafaca

Hi all,
I have an odd behavior on my STM32L051 trying to enter in STANDBY mode.  I would be pleased if you could help me. 

My program repeat endless cycles activity and Standby.
Once the firmware boot and after some activity, I program de RTC to wakeup with RTC (alarm A), then I go to STANDBY mode.

It seems to work fine, but after some cycles working well, the system doesn’t enter in Standby mode.  

The extract of my code is: 

HAL_Init();
SystemClock_Config();
SystemPower_Config();  /* Check and handle if the system was resumed from StandBy mode */
 if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
   {__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);}/* Clear Standby flag */

Applicacion activity..
Program RTC ..

//GO TO STANDBY
HAL_RTCEx_DeactivateWakeUpTimer(&RTCHandle);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); /*Clear all related wakeup flags*/
HAL_PWR_EnterSTANDBYMode();/*Enter the Standby mode*/
while (1)
  {Led_GREEN_on();}

 Sometimes I see the led green is ON.  How is could be possible if previous instruction is to enter in Standby?

As I told before, it only fails (green ON) in some cases. I don’t know why. 

Do you know any condition for doesn’t enter in Standby mode after  HAL_PWR_EnterSTANDBYMode instruction? 

I’m using HAL drivers V1.4.0.
I have downloaded v1.7.0 but on release notes I didn’t see any mention to that. 

Thank you.
Jai

Outcomes