Skip to main content
Visitor II
May 29, 2025
Question

STM32H735 Wake Up pull configuration STANDBY mode

  • May 29, 2025
  • 2 replies
  • 375 views

I am configuring wakeup pin PA0 to WAKEUP1 by wirting 01 (pull-up) at WKUPPUPD (PWR_KUPEPR) as said at RefManual by using "HAL_PWREx_EnableWakeUpPin ".

 

PWREx_WakeupPinTypeDef sPinParams;

sPinParams.PinPolarity = PWR_PIN_POLARITY_LOW;

sPinParams.PinPull = PWR_PIN_PULL_UP;

sPinParams.WakeUpPin = PWR_WAKEUP_FLAG1;

HAL_PWREx_EnableWakeUpPin (&sPinParams);

 

After that i go to standby mode by using:

HAL_PWR_EnterSTANDBYMode();

 

Then at standby mode, there is no pull up at PA0.

At the manual it is said that the pull up config is kept at standby mode.

Do i have to do something else?

 

Thanks!!

 

 

    This topic has been closed for replies.

    2 replies

    ST Employee
    June 3, 2025

    Hello @amartin,

    The pull-up and pull-down resistors are activated depending on the value in the GPIOx_PUPDR register, have you set the associated GPIO port pull configuration? 

    amartinAuthor
    Visitor II
    June 3, 2025

    Hi @Sarra.S,

    When booting, pin PA0_C is configured as a GPIO input and used with no problem.

     

    // Configure PA0_C as GPIO input

    GPIO_InitStruct.Pin = E1_IN_Pin;

    GPIO_InitStruct.Mode = GPIO_MODE_INPUT;

    GPIO_InitStruct.Pull = GPIO_PULLUP;

    //GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

    HAL_GPIO_Init(E1_IN_GPIO_Port, &GPIO_InitStruct); //Here GPIOx_PUPDR is configured

     

    When going to standby mode, we want to use the pin as WakeUp pin but keeping the pullup when the system is at standby.

    At this moment we do:

     

    PWREx_WakeupPinTypeDef sPinParams;
    
    sPinParams.PinPolarity = PWR_PIN_POLARITY_LOW;
    
    sPinParams.PinPull = PWR_PIN_PULL_UP;
    
    sPinParams.WakeUpPin = PWR_WAKEUP_FLAG1;
    
    HAL_PWREx_EnableWakeUpPin (&sPinParams); //Configuring specific pull up for wake-up at PWR

     

    After that we go to standby mode by using:

    HAL_PWR_EnterSTANDBYMode();

     

     

     HAL_PWREx_EnableWakeUpPin writes 01 (pull-up) at WKUPPUPD (PWR_KUPEPR)

     
    HAL_PWREx_EnableWakeUpPin:
    
    /**
    
     * @brief Enable the Wake-up PINx functionality.
    
     * @param sPinParams : Pointer to a PWREx_WakeupPinTypeDef structure that
    
     * contains the configuration information for the wake-up
    
     * Pin.
    
     * @note For dual core devices, please ensure to configure the EXTI lines for
    
     * the different Cortex-Mx. All combination are allowed: wake up only
    
     * Cortex-M7, wake up only Cortex-M4 and wake up Cortex-M7 and
    
     * Cortex-M4.
    
     * @retval None.
    
     */
    
    void HAL_PWREx_EnableWakeUpPin (const PWREx_WakeupPinTypeDef *sPinParams)
    
    {
    
    uint32_t pinConfig;
    
    uint32_t regMask;
    
    const uint32_t pullMask = PWR_WKUPEPR_WKUPPUPD1;
    
    
    
    /* Check the parameters */
    
     assert_param (IS_PWR_WAKEUP_PIN (sPinParams->WakeUpPin));
    
     assert_param (IS_PWR_WAKEUP_PIN_POLARITY (sPinParams->PinPolarity));
    
     assert_param (IS_PWR_WAKEUP_PIN_PULL (sPinParams->PinPull));
    
    
    
     pinConfig = sPinParams->WakeUpPin | \
    
     (sPinParams->PinPolarity << ((POSITION_VAL(sPinParams->WakeUpPin) + PWR_WKUPEPR_WKUPP1_Pos) & 0x1FU)) | \
    
     (sPinParams->PinPull << (((POSITION_VAL(sPinParams->WakeUpPin) * PWR_WAKEUP_PINS_PULL_SHIFT_OFFSET) + PWR_WKUPEPR_WKUPPUPD1_Pos) & 0x1FU));
    
    
    
     regMask = sPinParams->WakeUpPin | \
    
     (PWR_WKUPEPR_WKUPP1 << (POSITION_VAL(sPinParams->WakeUpPin) & 0x1FU)) | \
    
     (pullMask << ((POSITION_VAL(sPinParams->WakeUpPin) * PWR_WAKEUP_PINS_PULL_SHIFT_OFFSET) & 0x1FU));
    
    
    
    /* Enable and Specify the Wake-Up pin polarity and the pull configuration
    
     for the event detection (rising or falling edge) */
    
     MODIFY_REG (PWR->WKUPEPR, regMask, pinConfig);
    
    #ifndef DUAL_CORE
    
    /* Configure the Wakeup Pin EXTI Line */
    
     MODIFY_REG (EXTI->IMR2, PWR_EXTI_WAKEUP_PINS_MASK, (sPinParams->WakeUpPin << EXTI_IMR2_IM55_Pos));
    
    #endif /* !DUAL_CORE */
    
    }

     

    ST Employee
    June 9, 2025

    Hello @amartin

    I cannot see an issue in the code you've shared, the problem lies elsewhere

    You're using the correct API: The configuration of wakeup pins is done with the HAL_PWREx_EnableWakeUpPin(sPinParams) function with:
    sPinParams: structure to enable and configure a wakeup pin:
    – WakeUpPin: Wakeup pin to be enabled
    – PinPolarity: Wakeup pin polarity (rising or falling edge)
    – PinPull: Wakeup pin pull (no pull, pull-up or pull-down)

    And the Wakeup pin pull configuration (in PWR_WKUPEPR) is kept in Standby mode