cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4: Waking from sleep, can't get HSE/PLL running

Peter Mather
Associate III

I'm toggling an I/O in the SYSTICK interrupt every 0.5 seconds with the processor running at 168MHz and using an RTC interrupt to wake the CPU from sleep. This all works well and the processor wakes up after the programmed interval. As per the HAL manual, the CPU is running on HSI (16MHz) after waking from sleep. Whatever I do I can't seem to get the clock changed back to HSE/PLL. I've tried all variants of explicitly turning PLL off, running the full clock configuration, and running the Cube example code but whatever I do the I/O toggles at 5 seconds rather than 0.5 (168/16 * 0.5) after the wake from sleep.

I've got similar code running perfectly on the L4 chips.

All ideas appreciated

3 REPLIES 3

Hi

For Sleep mode the clock source after wakeup is the same as before entering Sleep mode.

STM32L4 family has different power modes than STM32F4 family like Low Power Sleep.

Peter Mather
Associate III

Sorry my question was imprecise, I used sleep when I intended to use stop.

From the F4 HAL manual

"In Stop mode, all I/O pins keep the same state as in Run

mode.

 When exiting Stop mode by issuing an interrupt or a wake-up

event, the HSI RC oscillator is selected as system clock."

If you use HAL functions HAL_InitTick, HAL_SetTickFreq, have in mind that SystemCoreClock variable must have been updated first by calling SystemCoreClockUpdate.