cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L073RZT6 Wake Up Pin (PWR_CSR_EWUP1 , PWR_CSR_EWUP2 , PWR_CSR_EWUP3)

Myada.1
Associate II

Hi,

I am using STM32L073RZT6 board, i am use the wakeup pin PA0 and PC13 together on the standby mode but in the standby mode, PA0 wakeup pin is not working. I am enable both the pin before go to standby mode. The power Control Status Register are

PA0 = PWR_CSR_EWUP1 and PC13 = PWR_CSR_EWUP2.

  1. Is it working together in the stm32l073 board?
  2. How to work it? which flag is set or reset? and how to configure the wakeup pin from stm32CubeMX?

Piece of code to enable the wakeup pin and go to standby mode:

   RCC->APB1ENR |= RCC_APB1ENR_PWREN;

 

  PWR->CSR &= ~PWR_CSR_EWUP2;

  PWR->CSR &= ~PWR_CSR_EWUP1;

  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

 

  PWR->CSR |= PWR_CSR_EWUP2;

  PWR->CSR |= PWR_CSR_EWUP1;

 

  PWR->CR |= PWR_CR_CWUF;

  PWR->CR |= PWR_CR_ULP;

HAL_PWR_EnterSTANDBYMode();

/*Standby Defination*/

void HAL_PWR_EnterSTANDBYMode(void)

{

 /* Select Standby mode */

 SET_BIT(PWR->CR, PWR_CR_PDDS);

 /* Set SLEEPDEEP bit of Cortex System Control Register */

 SET_BIT(SCB->SCR, SCB_SCR_SLEEPDEEP_Msk);

 SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk;

 /* This option is used to ensure that store operations are completed */

#if defined ( __CC_ARM)

 __force_stores();

#endif

 /* Request Wait For Interrupt */

 __WFI();

}

Thank You

0 REPLIES 0