2017-10-25 09:38 AM
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 *234PLLP /2PLLQ /5I 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.
#stm32f746 #stm32cubemxSolved! Go to Solution.
2017-10-25 02:29 PM
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.
2017-10-25 09:45 AM
Does HSE_VALUE get set to something appropriate? stm32f7xx_hal_conf.h ??
#define HSE_VALUE
11289600 // rather than 8000000 or 25000000
2017-10-25 11:48 AM
Math works as if it uses 25 MHz for speed computations.
2017-10-25 02:20 PM
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.
2017-10-25 02:27 PM
Not using F7 + CubeMX in this context, would suggest grepping for HSE_VALUE in the source, probably used in RCC macros or source in computation of bus clocks, etc. In Keil you can mouse over things and see value in given source.
In some contexts can be pulled as a command-line define, but if conf.h is pulled it would redefine.
2017-10-25 02:29 PM
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.