STOP2 Mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-04 12:14 AM - last edited on ‎2025-04-04 12:53 AM by Andrew Neil
HLO
I am using STOP2 Mode in my controller is stm32l496 series it entering the stop2 mode but it's not coming out for waking up i use external interrupt .
interrupt is generating before entering stop2 mode but it not generated after the stop2 mode.
what is the problem.
HAL_SuspendTick();
// Optional: clear EXTI pending bit
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0); // Replace with your EXTI pin
// Go to STOP2
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
// Restore clocks
SystemClock_Config();
// Re-initialize GPIOs including EXTI pin
SystemReInit(); // or reconfigure the EXTI pin here manually
HAL_GPIO_WritePin(LED_RED_GPIO_Port, LED_RED_Pin, SET); // Debug
HAL_ResumeTick();
void EXTI0_IRQHandler(void)
{
/* USER CODE BEGIN EXTI0_IRQn 0 */
/* USER CODE END EXTI0_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0);
/* USER CODE BEGIN EXTI0_IRQn 1 */
/* USER CODE END EXTI0_IRQn 1 */
}
Code formatting applied - please see How to insert source code for future reference.
- Labels:
-
GPIO-EXTI
-
Power
-
STM32L4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-04 1:03 AM
Welcome to the forum.
For best results (including how to properly post source code), please see: How to write your question to maximize your chances to find a solution.
@Chintu wrote:interrupt is generating before entering stop2 mode but it not generated after the stop2 mode.
what is the problem.
Have you enabled the pin in STOP2 ?
https://www.st.com/resource/en/datasheet/stm32l496ag.pdf#page=34
via: https://www.st.com/en/microcontrollers-microprocessors/stm32l496ag.html#documentation
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-04 1:43 AM
Have you enabled the pin in STOP2 ?
yes i did.
/*Configure GPIO pin : PE0 */
GPIO_InitStruct.Pin = GPIO_PIN_0;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-04 2:02 AM
please see How to insert source code
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-04 2:09 AM - last edited on ‎2025-04-04 2:22 AM by Andrew Neil
Merged from separate thread.
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();
// Optional: clear EXTI pending bit
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0); // Replace with your EXTI pin
EXTI->IMR1 |= EXTI_IMR1_IM0;
// Go to STOP2
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
// Restore clocks
SystemClock_Config();
// Re-initialize GPIOs including EXTI pin
SystemReInit(); // or reconfigure the EXTI pin here manually
HAL_GPIO_WritePin(LED_RED_GPIO_Port, LED_RED_Pin, SET); // Debug
HAL_ResumeTick();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-04 2:13 AM
I can t give you full source code did i miss any things.
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();
// Optional: clear EXTI pending bit
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0); // Replace with your EXTI pin
EXTI->IMR1 |= EXTI_IMR1_IM0;
// Go to STOP2
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
// Restore clocks
SystemClock_Config();
// Re-initialize GPIOs including EXTI pin
SystemReInit(); // or reconfigure the EXTI pin here manually
HAL_GPIO_WritePin(LED_RED_GPIO_Port, LED_RED_Pin, SET); // Debug
HAL_ResumeTick();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-04 2:15 AM
if you have any sample code wake-up from stop2mode please provide.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-04 2:17 AM - edited ‎2025-04-04 2:18 AM
Hello @Chintu and welcome to the community,
You posted your thread in the wrong forum (I've moved it to STM32 MCU products forum board).
Could you please provide details on your issue?
See how to post a thread in the community: How to write your question to maximize your chances to find a solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-04 2:20 AM - edited ‎2025-04-04 2:23 AM
@Chintu wrote:if you have any sample code wake-up from stop2mode please provide.
Have you looked at the samples available via CubeIDE?
ie, the examples in the STM32CubeL4 pack ?
Try a search for "power" on the Product Page 'Documentation' Tab:
https://www.st.com/en/microcontrollers-microprocessors/stm32l496ag.html#documentation
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-04 2:47 AM
stm32l496zgt6
STM32CubeIDE
development board
Not coming out from stop2mode though external interrupt GPIO PE0 interrupt generating before entering's stop2mode but not in stop2mode what is the process to follow the wake up the controller stop2mode to normal mode.
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();
// Optional: clear EXTI pending bit
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0); // Replace with your EXTI pin
EXTI->IMR1 |= EXTI_IMR1_IM0;
// Go to STOP2
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
// Restore clocks
SystemClock_Config();
// Re-initialize GPIOs including EXTI pin
SystemReInit(); // or reconfigure the EXTI pin here manually
HAL_GPIO_WritePin(LED_RED_GPIO_Port, LED_RED_Pin, SET); // Debug
HAL_ResumeTick();
}
