Skip to main content
Jeremy Vance_2
Associate II
October 25, 2017
Solved

STM32F746 CubeMX clock not reporting correctly?

  • October 25, 2017
  • 1 reply
  • 1228 views
Posted on October 25, 2017 at 18:38

I'm using an STM32F746VGT6 microcontroller configured from STM32CubeMX for all the clocks and I'm getting roughly 220% higher clock rates reported for SystemCoreClock 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.

My first clue was when I configured SAI_BlockA1 and measured MCLK to be double than expected.  Then testing an output with HAL_Delay(50) gave me actual delay of 110ms.

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

0690X00000608kWQAQ.png

#stm32f746 #stm32cubemx
This topic has been closed for replies.
Best answer by Jeremy Vance_2
Posted on October 25, 2017 at 21:29

Okay, I figured it out.  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 (HSE set to 25MHz).  Only when I used find all references did I find the other file still being used.

Thanks Clive.  Your 25MHz note helped me find this.

1 reply

Tesla DeLorean
Guru
October 25, 2017
Posted on October 25, 2017 at 18:45

Does HSE_VALUE get set to something appropriate? stm32f7xx_hal_conf.h ??

#define HSE_VALUE 

11289600 // rather than 8000000 or 25000000

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
October 25, 2017
Posted on October 25, 2017 at 18:48

Math works as if it uses 25 MHz for speed computations.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Jeremy Vance_2
Associate II
October 25, 2017
Posted on October 25, 2017 at 21:20

Straight from stm32f7xx_hal_conf.h:

♯ if !defined (HSE_VALUE)

♯ define HSE_VALUE ((uint32_t)11289600U) /*!< Value of the External oscillator in Hz */

♯ endif /* HSE_VALUE */

So, yes.  It is set.  You're right though.  Put in 25MHz and it does indeed come out to the same frequency it is reporting as SystemClock.

Is there another place this value could be overwritten (not that a define can be overwritten) with?  This program is straight from CubeMX.