Skip to main content
Visitor II
April 30, 2020
Question

wakeup from shutdown mode

  • April 30, 2020
  • 4 replies
  • 1420 views

Hi,

why does the stm32l496 waking up from shutdown mode using syswkup2 pin and pullup. When I am using an external pullup resistor, the cpu stays in shutdown mode until I set a low signal on syswkup2 pin.

best regards

Josef

    This topic has been closed for replies.

    4 replies

    Super User
    April 30, 2020

    The regular pullup doesn't work in shutdown mode. You need to enable it within PWR_PUCRx.

    josef2Author
    Visitor II
    April 30, 2020

    Hi TDK,

    I am using stm32l4xx_hal_pwr_ex.c for activating the pullup. But nevertheless the effect is as i described befor.

    Look at my code:

       HAL_GPIO_WritePin( VBatt_En_GPIO_Port, VBatt_En_Pin, GPIO_PIN_RESET );

       /* Clear wake up Flag */

       __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF2);

       HAL_PWREx_EnablePullUpPullDownConfig();

       HAL_PWREx_EnableGPIOPullUp( PWR_GPIO_C, PWR_GPIO_BIT_13 );

       HAL_PWR_EnableWakeUpPin( PWR_WAKEUP_PIN2_LOW );

       HAL_PWR_EnableWakeUpPin( PWR_WAKEUP_PIN5_LOW );

       HalTick = HAL_GetTick();

       while( (HAL_GetTick() - HalTick) < 500 );

       /* Enter shutdown mode */

       HAL_PWREx_EnterSHUTDOWNMode( );

    best regards

    Josef

    Super User
    April 30, 2020

    Is it possible the pull-up is not active until shutdown mode is active, causing it to kick out of shutdown immediately? Measure voltage levels prior to shutdown. Is a pullup on pin 5 not needed? Measuring them digitally (GPIOx->IDR) might be fine.

    Visitor II
    November 20, 2024

    Hi

     

    I know it is some time after this topic was risen but maybe my answer will help someone in the future.

    I faced the same issue as josef2 but using STM32G474 device and TDK's last answer gave me a hint so I just configured my wake up pin (WKUP5 which is on PC5 pin) also in GPIO register (I configured an internal pull up for it) just before going into shutdown and it helped and the device stopped waking up immediately after going into shutdown.

    So my guess is that earlier when PC5 was floating before going into shutdown the device just after going into shutdown, but before it applied pull up in shutdown (from PWR register), it was detecting change on wake up pin and thus was waking up the device.

    After I added pull up in GPIO register in run mode it started working as expected.

    But I also noticed strange behaviour when debugging the chip (with STLINK V3 in my case). When debugging then after first shutdown everything is ok but after every next the chip is waking up immediately.

    When I am not debugging then shutdown and wake up works as expected every time.