Skip to content

Commit 2663367

Browse files
committed
[NUCLEO_L152RE] Remove timer update interrupt in sleep
Otherwise the first update interruption will wake-up the MCU.
1 parent 3fba65b commit 2663367

File tree

1 file changed

+8
-1
lines changed
  • libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE

1 file changed

+8
-1
lines changed

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/sleep.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,17 @@ static void SetSysClock_HSI(void)
102102
// MCU SLEEP mode
103103
void sleep(void)
104104
{
105+
// Disable us_ticker update interrupt
106+
TIM_ITConfig(TIM9, TIM_IT_Update, DISABLE);
107+
105108
// Enable PWR clock
106109
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
110+
107111
// Request to enter SLEEP mode with regulator ON
108-
PWR_EnterSleepMode(PWR_Regulator_ON, PWR_SLEEPEntry_WFI);
112+
PWR_EnterSleepMode(PWR_Regulator_ON, PWR_SLEEPEntry_WFI);
113+
114+
// Re-ensable us_ticker update interrupt
115+
TIM_ITConfig(TIM9, TIM_IT_Update, ENABLE);
109116
}
110117

111118
// MCU STOP mode (Regulator in LP mode, LSI, HSI and HSE OFF)

0 commit comments

Comments
 (0)