2016-08-04 05:19 AM
Hi,
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.Thanks,Sunny #msi #stm32l4 #rcc #clockconfig2016-08-04 06:11 AM
So is there any graceful way to bump up the PLL clocks on the fly i.e. after the SystemClock_Config() is called.
In my experience no, you have to turn off the PLL to change the parameters, and you can't randomly change the input to the PLL. So you have to go through a sequence of switching to another source, turn it off, reconfigure, and come back. Suggest you start by configuring at 48 MHz and get to a slower SYSCLK (AHB/APB) by dividing the clock source down. And then using the dividers to gear the clocking up/down.2016-08-05 12:09 AM
Hi Clive,
Thank you for the pointer.I am able to configure the MSI and PLL clocks on the fly now.For reference, below are the steps:Since I am using MSI as PLL source, and PLLCLK as SYSCLK, we cannot directly change PLL Parameters (Refer Reference Manual -> RCC Chapter -> Clocks -> PLL).