Skip to main content
Associate
July 1, 2026
Question

STM32N6 Power modes in Zephyr

  • July 1, 2026
  • 4 replies
  • 123 views

Cannot wake from Stop mode using LPTIM1
Board: STM32N6570-DK (STM32N657X0, Cortex-M55)

RTOS: Zephyr 4.4.0

Goal: Enter Stop mode and wake periodically via LPTIM1 auto-reload interrupt (~200ms)

What works:
Sleep mode (WFI without SLEEPDEEP) — enters and wakes correctly from GPIO EXTI and LPTIM
LPTIM1 initialization — confirmed running, ISR fires (verified via counter incrementing in HAL_LPTIM_AutoReloadMatchCallback)
LPTIM1 EXTI line 52 enabled — EXTI->IMR2 |= EXTI_IMR2_IM52 via __HAL_LPTIM_LPTIM1_EXTI_ENABLE_IT()
NVIC LPTIM1_IRQn enabled — interrupt registered and working in normal (non-Stop) operation
Clock restore after Stop — SystemClock_Restore() re-enables HSE, PLLs (PLL1/2/3), IC muxes back to 800 MHz
What does NOT work:
Stop mode entry → CPU never wakes. After HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFI), the MCU halts permanently. No interrupt wakes it.
LPTIM1 configuration:
__HAL_RCC_LPTIM1_CLK_ENABLE();

// Clock: LSI (~32 kHz)
RCC_PeriphCLKInitTypeDef pclk = {0};
pclk.PeriphClockSelection = RCC_PERIPHCLK_LPTIM1;
pclk.Lptim1ClockSelection = RCC_LPTIM1CLKSOURCE_LSI;
HAL_RCCEx_PeriphCLKConfig(&pclk);

hlptim1.Instance = LPTIM1;
hlptim1.Init.Clock.Source = LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC;
hlptim1.Init.Clock.Prescaler = LPTIM_PRESCALER_DIV1;
hlptim1.Init.Trigger.Source = LPTIM_TRIGSOURCE_SOFTWARE;
hlptim1.Init.UpdateMode = LPTIM_UPDATE_IMMEDIATE;
hlptim1.Init.CounterSource = LPTIM_COUNTERSOURCE_INTERNAL;
hlptim1.Init.Period = 6399;  // ~200ms
HAL_LPTIM_Init(&hlptim1);

// EXTI wakeup line
__HAL_LPTIM_LPTIM1_EXTI_ENABLE_IT();  // EXTI->IMR2 |= IM52

// NVIC
HAL_NVIC_SetPriority(LPTIM1_IRQn, 7, 0);
HAL_NVIC_EnableIRQ(LPTIM1_IRQn);

// Start counter
HAL_LPTIM_Counter_Start_IT(&hlptim1);
Stop mode entry:
HAL_SuspendTick();
HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFI);
// Never reaches here
Approaches tried:
Direct HAL call from thread context (video_sleep()) — LPTIM started, then HAL_PWR_EnterSTOPMode. Never wakes.

Via Zephyr PM framework (pm_state_set in idle thread) — same result. PM policy selects state, LPTIM started, Stop entered, never wakes.

HAL_PWR_EnterSLEEPMode instead — works perfectly. Both LPTIM and GPIO wake the CPU. Confirms the NVIC/EXTI path is correct for non-SLEEPDEEP WFI.

Verified EXTI IMR2 bit 52 set before Stop entry.

Verified NVIC LPTIM1_IRQn enabled before Stop entry.

Tried with/without HAL_SuspendTick() — no difference.

LSI confirmed running — LPTIM counter advances (verified by reading CNT register before Stop).

Questions:
On STM32N6, are there additional PWR registers that need to be configured for EXTI line 52 (LPTIM1) to wake from Stop? (e.g., PWR wakeup enable register specific to N6?)

Does LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC keep the LPTIM clocked during Stop, or should we use a different clock source setting?

Is there a known issue with Stop mode wakeup on the STM32N6570-DK with the current STM32Cube HAL v1.0?

Does the STM32N6 require the LPTIM to be in a specific mode (not counter mode) for Stop wakeup? The N6 reference manual mentions "timeout mode" for wakeup — is HAL_LPTIM_TimeOut_Start_IT required instead of HAL_LPTIM_Counter_Start_IT?

 

Please help.

4 replies

Associate II
July 2, 2026

AN4991 How to wake up an STM32 microcontroller from low-power mode with the USART or the LPUART

archanaAuthor
Associate
July 2, 2026

Thanks for the response. But I would like the mcu to wake up from the lptimer and not uart. Most of the time uart is not even connected. Could you please check the procedure and let me know what needs to be added?

Associate II
July 2, 2026

Please refer to AN5946 STM32N6 low-power feature and check Stop mode voltage scaling/SVOS is high or low

It could make the wake up process different

T_Hamdi
ST Employee
July 7, 2026

hello ​@archana 

My first analysis of the issue is related to the clock source used in Stop mode:

  • which LPTIM clock source is selected,
  • whether that source remains active in Stop,
  • whether the instance is configured in a mode intended for timeout/wakeup rather than plain counter operation,

Also, you can refer to the LPUART_WakeUpFromStop example and compare its mechanism with your application to understand how Stop mode is exited.

with regards,

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question.Hamdi Teyeb"