AnsweredAssumed Answered

[STM32L4] [RCC] Re-configure MSI Clock once SystemClock_Config() is done

Question asked by bhayani.sunny on Aug 4, 2016
Latest reply on Aug 5, 2016 by bhayani.sunny

I am trying to run my system at 4 MHz SYSCLK having PLLCLK as source.
PLL has MSI as Source configured at 4 MHz.

This configuration is done in SystemClock_Config() in main().

Now, I am trying to re-configure the clocks of the PLL so that the SYSCLK has 48 MHz and SDMMC1 and USB has 48 MHz via PLLQ, since I want to run the the SDCard and USB in Device Mode.

I am able to reconfigure the clocks, oscillators and peripheral clocks by calling the HAL_RCCEx_DisableMSIPLLMode().

But my USB is not getting enumerated. I am getting USB unrecognized.

So is there any graceful way to bump up the PLL clocks on the fly i.e. after the SystemClock_Config() is called.

I read the Reference Manual and it is mentioned that on System Reset, MSI is selected as Default Source and I confirmed that the same thing is done in the code.

But then how can I update my PLL block parameters if I want to keep MSI as clock source for PLLCLK and PLLCLK as source for SYSCLK.