cancel
Showing results for 
Search instead for 
Did you mean: 

MCU doesnt wake up from standby with WKUP1 pin

CYesi.1
Associate II

Hello,

I am using STM32L073V8T .

I am trying wake up from standby with WKUP1 pin. It is PA0. According to techinical documents, low to high transition should wake MCU from standby. But, It doesnt work in my case.

Is there any special configuration what I missed ? Maybe a flag wich I shoud clean before standby ? Or GPIO configuration ?

My sleep function :

void wakeupWithPin(void)

{

// __HAL_PWR_WakeUpPinCmd(ENABLE);

dbg_printf("wakeup source is WKUP1 pin\n\r");

HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);

__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);

}

void pwr_lowPowermode(void)

{

 // RTC_AlarmConfig();

// wakeupWithRTC();

wakeupWithPin();

  dbg_printf("standby\n\r");

   HAL_PWR_EnterSTANDBYMode();

}

Related GPIO configuration:

 GPIO_InitStruct.Pin = WakeUp_Pin;

 GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 HAL_GPIO_Init(WakeUp_GPIO_PORT, &GPIO_InitStruct);

1 ACCEPTED SOLUTION

Accepted Solutions
CYesi.1
Associate II

My problem is solved.

In my application, Power reset is never happened. Because there is a backup battery for RTC. It results that PWR and RTC registers never reset. Somehow, my past configuration have blocked wake-up with WKUP pin. I reset RTC power. Than, my problem is solved. 

If anyone has same issue, he/she can try that power on reset including RTC part. (In my case, changing battery is enough) 

But, I didn't understand which configuration or which register blocks wake-up from standby with WKUP pin. I could not any information about this in reference manual.

View solution in original post

3 REPLIES 3
M.Hajji
Associate III

Hello CYesi.1

Here the sequence used in CubeMX repo example:

/* The Following Wakeup sequence is highly recommended prior to each Standby mode entry
    mainly when using more than one wakeup source this is to not miss any wakeup event.
     - Disable all used wakeup sources,
     - Clear all related wakeup flags, 
     - Re-enable all used wakeup sources,
     - Enter the Standby mode.
  */
 
  /* Disable all used wakeup sources: PWR_WAKEUP_PIN2 */
  HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN2);
 
  /* Clear all related wakeup flags*/
  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
  
  /* Enable WakeUp Pin PWR_WAKEUP_PIN2 connected to PC.13 */
  HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2);
 
  /* Enter the Standby mode */
  HAL_PWR_EnterSTANDBYMode();

Also I suggest to put your GPIO in PULL_DOWN, to ensure the transition from LOW to HIGH.

Regards,

Hajji.

Hello,

Thanks for reply,

Example is same as my application. According to manual : EWUP1 configuration forces pin in input pull down configuration.

"1: WKUP pin 1 is used for wakeup from Standby mode and forced in input pull down configuration (rising edge on WKUP pin 1 wakes-up the system from Standby mode)"

I checked this PWR_CSR register EWUP1 bit, it is 1 before going standby.

I really dont understand what is wrong.

CYesi.1
Associate II

My problem is solved.

In my application, Power reset is never happened. Because there is a backup battery for RTC. It results that PWR and RTC registers never reset. Somehow, my past configuration have blocked wake-up with WKUP pin. I reset RTC power. Than, my problem is solved. 

If anyone has same issue, he/she can try that power on reset including RTC part. (In my case, changing battery is enough) 

But, I didn't understand which configuration or which register blocks wake-up from standby with WKUP pin. I could not any information about this in reference manual.