Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/low_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,16 @@ void LowPower_stop(serial_t *obj)
{
__disable_irq();

/*
* Suspend Tick increment to prevent wakeup by Systick interrupt, as in
* LowPower_sleep(). In Stop mode SysTick normally halts with the core clock,
* but with DBGMCU DBG_STOP set (debugging) the clock keeps running and the
* 1 ms tick ends Stop mode immediately (a pending interrupt wakes WFI even
* with PRIMASK set). The tick is enabled again by
* SystemClock_ConfigFromStop() (HAL_RCC_ClockConfig() -> HAL_InitTick()).
*/
HAL_SuspendTick();

#if defined(UART_WKUP_SUPPORT)
if (WakeUpUart != NULL) {
HAL_UARTEx_EnableStopMode(WakeUpUart);
Expand Down
Loading