cancel
Showing results for 
Search instead for 
Did you mean: 

SysClock change during operation

markgilson9
Associate II
Posted on March 20, 2012 at 20:26

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-control
1 REPLY 1
alok472
Associate II
Posted on March 24, 2012 at 04:32

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 */