AnsweredAssumed Answered

Problems setting up clocks, STM32F401RE

Question asked by Paulstrom.Bjorn on Oct 4, 2016
Latest reply on Oct 4, 2016 by barton.michael
Hello I am using a nucleoboard and am trying to set up all the clocks using this:

     RCC_ClocksTypeDef RCC_Clocks;
     RCC_HSICmd(ENABLE);
     RCC_HCLKConfig(RCC_SYSCLK_Div1);
     RCC_PCLK2Config(RCC_HCLK_Div1);
     RCC_PCLK1Config(RCC_HCLK_Div2);
     RCC_PLLConfig(RCC_PLLSource_HSI, 16, 336, 4, 2);
     RCC_PLLCmd(ENABLE);
     while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
     RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
     while (RCC_GetSYSCLKSource() != 0x08);
     RCC_GetClocksFreq(&RCC_Clocks);


     uint32_t clock = RCC_Clocks.SYSCLK_Frequency;

However clock is not the 84MHz I expected, it is 131250000. What am I doing wrong?

Outcomes