I am trying to change the STM32F407 system core clock to be 100 MHz. To do this, I need to set the source of the PLL to be HSE, and configure the PLL coefficient so as to get the right value of SYSCLK.
Here is a screenshot of the STMCube that shows the right values of PLL M, N, P, Q:
Here is my function
// function to configure the rc clk for running on HSE : sysclk at 100 MHz
void rcc_clk_config()
{
// sysclck to 100 MHz, systick to 12.5 MHz
RCC_PLLConfig(RCC_PLLSource_HSE, 4, 200, 4, 4);
RCC_HCLKConfig(RCC_SYSCLK_Div1);
RCC_PCLK1Config(RCC_HCLK_Div4);
RCC_PCLK2Config(RCC_HCLK_Div2);
do {
RCC_HSEConfig(RCC_HSE_ON);
} while(RCC_GetFlagStatus(RCC_FLAG_HSERDY) != SET);
do {
RCC_PLLCmd(ENABLE);
} while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) != SET);
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
SystemCoreClockUpdate();
}
In the debug session, I get SystemCoreClock = 57.600.000.