2016-10-04 12:47 AM
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? #stm32f42016-10-04 02:17 AM
Hello,
Review RCC example under STM32F4 DSP and standard peripherals library, this help you on RCC configuration: STM32F4xx_DSP_StdPeriph_Lib_V1.7.1\Project\STM32F4xx_StdPeriph_Examples\RCC\RCC_ExampleRegards2016-10-04 04:12 AM
And what is the real system clock (eg. as output and measured at a MCO pin)?
131250000/84MHz = 25/16 If you are sure the system clock is indeed 84MHz, your software might think you are running from a 25MHz clock. Check the relevant RCC registers (concentrating on RCC_PLLCFGR) after setting them; if you find them to be as expected then it's either library, or a library-usage issue. JW2016-10-04 05:01 AM
Majerle Tilen did a good informative page regarding F4 clockspeeds
http://stm32f4-discovery.net/2015/01/properly-set-clock-speed-stm32f4xx-devices/
HTH