2021-11-04 08:34 AM
I am updating legacy firmware running on an STM32L151QEhx to the HAL libraries. Our current firmware changes the PLL (which supplies sysclk) configuration's multiplier and divider and the voltage scaling whenever a USB is connection is detected or terminated. This is done without restarting the device.
The legacy code lacks documentation as to the rationale for the steps taken when updating the clock, so I am looking for any application notes, examples, or documentation that can describe best practices for changing system clock configurations while the device is still running.
I have looked through the knowledge base and application notes already, but my search terms may not have been sufficient as this is the first time I've had cause to dynamically change clocks.
Thank you very much for your time,
Brian
2021-11-04 08:47 AM
The reference manual will tell you what is allowed. In general, this is taken care of correctly with the appropriate HAL calls. For example, it will increase wait states prior to the change but decrease them after the change.