HAL_RCC_OscConfig takes too long (appx 170 μS), I need it to be <50 μS when waking from STOP

馋奶兔 提交于 2019-12-04 12:50:31

I do not know what is your PLL source right now, but HSI16 is recommended. All from the reference manual.

The HSI16 clock signal is generated from an internal 16 MHz RC oscillator. It can be used directly as a system clock or as PLL input.

The HSI16 clock can be used after wake-up from the Stop low-power mode, this ensure a smaller wake-up time than a wake-up using MSI clock.


If you can allow the slightly higher consumption, do not disable the internal regulator. It is a compromise: faster wake-up with higher consumption or slower while saving more energy, decide which is the more important.

When exiting Stop mode by issuing an interrupt or a wakeup event, the MSI or HSI16 RC oscillator is selected as system clock depending the bit STOPWUCK in the RCC_CFGR register.

When the voltage regulator operates in low-power mode, an additional startup delay is incurred when waking up from Stop mode. By keeping the internal regulator ON during Stop mode, the consumption is higher although the startup time is reduced.


Now I suppose using the PLL is a must, but then I am afraid apart from the above mentioned you cannot do really much about the startup time. The PLL needs a certain time to lock onto the input reference clock frequency. But first the input frequency must become stable (that's why it is recommended to use the HSI16).

Instead of the blocking wait (while loop) you can use an interrupt.

An interrupt can be generated when the PLL is ready if enabled in the RCC_CIER register (see Section 7.3.5).

And while the PLL is locking you can do some tasks on 16 MHz, and the tasks requiring the full-speed can be started when the interrupt is received (finish clock configuration in the ISR).

berendi - protesting

Well, the datasheet says PLL locking can take up to 160 μs, so the delay will be there as long as you are trying to use PLL.

Do you need PLL at all?

You can configure RCC to wake up with HSI already running at 16 MHz (see the RCC_CFGR_STOPWUCK bit). You get only half the speed, but it's up and running in 6 us.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!