2012-03-20 12:26 PM
If there's another post which addresses my question, please direct me there. I'm looking for a general idea as to how to change the system clock of the STM32F4 device while in operation. I'd like to switch to a ''low'' power mode by reducing the clock down from 168MHz to, say, 2 MHz, and vice versa. I'm pretty sure this requires me momentarily switching over to the internal oscillator or some other clock source to do so, but was just wondering if there was a firmware function call for this or if this was a bit more manual. Any input is welcome. Thanks in advance.
#msi #clock-control2012-03-23 08:32 PM
Not used STM32F4 yet, however similar technique was used on STM32L as below....Switched to MSI clock and switched OFF the PLL...Hope it helps...
// Following Code Enables the MSI=4.2MHz Then Disables the HSI=16Mhz RCC_MSICmd(ENABLE); while (RCC_GetFlagStatus(RCC_FLAG_MSIRDY) == RESET) {} RCC_MSIRangeConfig(RCC_MSIRange_6); // MSI clock is around 4.2MHz RCC_PCLK1Config(RCC_HCLK_Div1); RCC_SYSCLKConfig(RCC_SYSCLKSource_MSI); //select MSI as Clock source while (RCC_GetSYSCLKSource() != 0x00) {} // 0x00: MSI used as system clock RCC_PLLCmd(DISABLE); /* Disables the PLL */ RCC_HSICmd(DISABLE) ; /* Disables the HSI Clock */