2
\$\begingroup\$

I'm using an STM32F746VGT6 microcontroller configured from STM32CubeMX for all the clocks and I'm getting roughly 220% higher clock rates when compiled.

For instance I have an HSE crystal at 11.2896MHz with the following main PLL settings:

  • PLLM /11
  • PLLN *234
  • PLLP /2
  • PLLQ /5

I have selected HSE for PLL source and PLLCLK as System Clock Source. Doing that in STM32CubeMX yields 120.080291MHz.

However, after SystemClock_Config(), SystemCoreClock = 265909059.

Due to that discrepancy, the microcontroller thinks it's working 220% faster than it actually is so all my timings are off by that much.

Has anyone else seen this issue and what could be the problem here? Thanks for any insight.

\$\endgroup\$
  • \$\begingroup\$ A screenshot of the clock tree page in STM32CubeMX, and the generated SystemClock_Config() would be helpful. \$\endgroup\$ – berendi Oct 25 '17 at 18:47
2
\$\begingroup\$

I speculate that STM32CubeMX does not know the frequency of your oscillator and assumes it is 25 MHz, as happens to be on at least some of the STM32F7 Discovery boards. 265909059 * 2 / 234 * 11 = 24999997, according to my calculator.

\$\endgroup\$
  • \$\begingroup\$ Indeed you are correct. It was using 25MHz as it's computation. I use VisualGDB with Visual Studio. They generated a conf as well and while I removed it from the solution, it was still being compiled (with HSE set to 25MHz instead of 11.2896). Only when I used find all references did I find the other file still being used. \$\endgroup\$ – Jeremy Oct 25 '17 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.