How to change MSI frequency on the fly ?
Hi,
I am working on an STM32L476RCT6 and I use STM32CubeMX to configure the peripherals of the microcontroller.
Currently the microcontroller runs on MSI, whose frequency is set at 8 MHz. The clock configuration is as follows :
I want to use the USB interface of the microcontroller in Device Only mode. In such a case, I get two problems in the clock configuration menu, which you can see below :
CLK48 Clock Mux frequency needs to be 48 MHz, and HCLK needs to be > 14 MHz.
The USB interface will be rarely used and I need to maintain a low power consumption, I was thus thinking of switching clocks/frequencies only when USB is needed, and then go back to the initial clock configuration.
One solution could be to switch MSI frequency to 48 MHz, and then go back to 8 MHz. Which steps do I need to follow to make this change ?
I do not care about having to wait for clocks to stabilize, and I do not have an HSE on my card.
Is there a better solutionn, like using the PLL ?
Thanks.
