Skip to main content
Visitor II
May 27, 2024
Question

Standby mode and wakeup issues using wakeup pin

  • May 27, 2024
  • 2 replies
  • 1822 views

Hi i am working with stm32l051c8t6 , i am using wakeup pin 1 to wakeup from standby mode, weather is that possible to make the wakeup pin should act as wakeup pin and also as external interrupt, it should wakeup when an external interrupt is detected on wakeup pin, and make that as count and store in EEPROM for later use, how can i achieve this, guide me to sort out the above requirment 

    This topic has been closed for replies.

    2 replies

    ST Employee
    May 27, 2024

    Hello @sreedharan1196 

    Yes, it is possible to configure a pin as a wakeup PIN and EXTI at the same time 

    However, there are some considerations to keep in mind, there may be a need for some delay in the code to allow for the configuration change from EXTI to wakeup pin and back...

    >>and make that as count and store in EEPROM for later use 

    In the EXTI interrupt handler, increment a counter each time the interrupt is triggered and store the updated count value in the EEPROM

     

    Visitor II
    May 27, 2024

    In my project, I am using PA0 as an wakeup pin , can u please help me to achieve the functionality,  how to make the configurations

    ST Employee
    May 27, 2024

    Hello @sreedharan1196 

    In HAL_GPIO_EXTI_Callback, before entering standby mode, add:

    EEPROM_Write(wakeup_count_address, wakeup_count);

    and in the void Enter_Standby_Mode add:

    void Enter_Standby_Mode(void)
    { 
     wakeup_count = EEPROM_Read(wakeup_count_address);
    
     __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
     __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
     HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
     HAL_PWR_EnterSTANDBYMode();
    }

     

    Visitor II
    May 27, 2024

    sorry, my current issues, is when is going to standby mode, when the wakeup pin raised up its not waking up and printing the wakeup pin, guid me to short out this issues