Skip to main content
Visitor II
April 7, 2025
Question

After STOP2 Mode Wake-Up

  • April 7, 2025
  • 1 reply
  • 381 views

STM32L496VET6 – EXTI Not Working After STOP2 Mode Wake-Up

1. Part Number

  • STM32L496VET6, LQFP100

  • Custom-designed hardware (not a development board)


2. Environment

  • IDE: STM32CubeIDE v1.15.0

  • STM32CubeMX: v6.11.0

  • HAL Driver Package: STM32CubeL4 v1.18.0

  • Toolchain: GCC Embedded

  • Debugger: ST-LINK V3

  • Host OS: Windows 11


3. Schematics

  • Pin PE0 is connected to a push-button with an external 10kΩ pull-up resistor to VDD.

  • PE0 is configured as a falling-edge EXTI input (GPIO_EXTI0).

  • Schematic is available if needed.


4. Details (Symptoms)

  • EXTI on PE0 (EXTI0) works correctly before entering STOP2 mode.

  • After entering STOP2 using HAL_PWREx_EnterSTOP2Mode(), the device does not wake up when the PE0 button is pressed.

  • No interrupt is triggered, and the MCU remains in low power mode.


5. Expected Behavior

  • A falling edge on PE0 should trigger an interrupt and wake the MCU from STOP2 mode.

  • The MCU should resume operation, restore clocks, and continue running code.


6. How to Reproduce

  1. Configure PE0 as GPIO_EXTI0 in CubeMX (falling edge, no pull).

  2. In code:

    • Enable SYSCFG and GPIOE clocks.

    • Set EXTI source with:

      c
      CopyEdit
      LL_SYSCFG_SetEXTISource(LL_SYSCFG_EXTI_PORTE, LL_SYSCFG_EXTI_LINE0);
    • Configure PE0 as falling-edge interrupt.

    • Enable EXTI0_IRQn interrupt.

    • Suspend SysTick and enter STOP2:

      c
      CopyEdit
      HAL_SuspendTick(); HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
    • After wake-up, call SystemClock_Config() and reinitialize GPIO and EXTI.

  3. Press the push-button connected to PE0 while in STOP2.


7. Occurrence

  • The issue is consistently reproducible.

  • The system wakes up and triggers EXTI correctly when not using STOP2.

  • The issue only occurs after entering STOP2.


8. Sanity Checks Performed

  • Verified EXTI0 interrupt handler is implemented correctly and functional.

  • Verified PE0 EXTI works perfectly before STOP2.

  • Clocks are properly restored after STOP2 using SystemClock_Config().

  • Re-initialized EXTI and GPIO after wake-up.

  • Ensured PE0 is not used by debug interface (no conflict with TRACECLK).

  • Tried using LL drivers directly for EXTI instead of HAL.

  • Added pull-up to PE0 for stable signal level.

  • Tested wake-up from PA0 using HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1), which works correctly.

void PowerDownUp(uint8_t Powermode)
{
//	HAL_SuspendTick();
//
//	PowerDown_GPIO_Deinit();
////		GPIO_InitTypeDef GPIO_InitStruct = {0};
////
//		__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF2);
////
////
////
////		HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2_HIGH);
////
//		HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
//
//
//
////================ Init Modules===================================================//
//
////	SystemReInit();
//		SystemClock_Config();
//
//		HAL_GPIO_WritePin(LED_RED_GPIO_Port, LED_RED_Pin, SET);
//		HAL_ResumeTick();

//	__HAL_RCC_SYSCFG_CLK_ENABLE();

 HAL_SuspendTick();


 __HAL_RCC_SYSCFG_CLK_ENABLE();

 // 2. Remap EXTI0 to PE0
 LL_SYSCFG_SetEXTISource(LL_SYSCFG_EXTI_PORTE, LL_SYSCFG_EXTI_LINE0);

 // 3. Re-init GPIO pin PE0
 GPIO_InitTypeDef GPIO_InitStruct = {0};
 GPIO_InitStruct.Pin = GPIO_PIN_0;
 GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
 GPIO_InitStruct.Pull = GPIO_PULLUP; // Optional: adds stability if PE0 is floating
 HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
// __HAL_RCC_LSECSS_EXTI_ENABLE_IT();
 HAL_GPIO_WritePin(LED_GREEN_GPIO_Port, LED_GREEN_Pin, RESET);
// HAL_RCC_LSICmd(ENABLE);
 NVIC_EnableIRQ(EXTI0_IRQn);
 HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);

 // Restore clocks
 SystemClock_Config();

 // Re-initialize GPIOs including EXTI pin
 SystemReInit(); // or reconfigure the EXTI pin here manually

 // Debug
 HAL_ResumeTick();
}
    This topic has been closed for replies.

    1 reply

    Technical Moderator
    April 10, 2025

    Hello @Chintu 

    Did you check this example please?

    If you still have the issue, please share your project if possible.