cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H563 clock at 250Mhz

dvescovi
Associate III

I was trying to get the most out of my H563 set up and run as fast as possible.

I am using the Nucleo-H563 board.

I reconfigured in CubeMX to use System clock mux to use HSE source mux, multipliers and dividers set correctly for 250MHZ operation. There are no errors shown in the setup and I am showing 250 Mhz as the SYSCLK. My AHB is /1, HCLK shows 250MHZ which is feeding the peripheral busses.

While the clock configuration APB1 shows 250Mhz it does not seem to be correct as when I set the timers and prescalers for such the timing is not correct... the bus seems to be running at 125mhz.

For my TMR1 to get 1us clock I have to set the divider to 124 which implies the internal clock is running at 125Mhz not 250 like the clock diagram shows. 

 

I have attached the Clock Configuration from CubeMX that shows no clock issues.

21 REPLIES 21
mƎALLEm
ST Employee

Hello @dvescovi ,

First, in next time better to attach your ioc file instead of a screenshot of your CubeMx config.

Second, as said previously you need to check MCO output.

Third, as you are using HSE in Bypass mode with the Nucleo-H563 board that embeds STLINKV3, the clock is generated from the STLINK. Did you update the STLINK to change the Clock output value? you need to have 8MHz like shown from the CubeProgrammer Firmware update menu:

mALLEm_0-1760524999800.png

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

To check the HSE, was the first thing , i wrote :

>

So if you have wrong core frequency, usually wrong HSE clock going to the CPU.

So check the real HSE frequency with a scope.

If you feel a post has answered your question, please click "Accept as Solution".

I know the HSE is correct. Its 8Mhz unaltered from the factory default. I have measured using the TP13 test point on the board it is a clean 8Mhz. The MCO1 output is configured to pin PA8 very high speed and it shows 1MHz which is correct according to the Clock Configuration MCO1 source mux output multiplier and divider. That is not the issue. Attached is the .ioc file. It clearly shows the SYSCLOCK at 250Mhz, the APB1 prescaller at /1 and APB1 timing at 250Mhz (which I do not believe) ... so I ask the question is the SYSCLK also wrong? As far as I can tell there is no way to directly measure the SYSCLOCK ... if there is please let me know.  My guess is APB1 is really running at 125Mhz (i.e. /2) as my testing with the TMR1 the clock prescaller needs 124 NOT 249 to get 1uS ticks.

Hello,

Try to toggle a pin with HAL_Delay() and check if it toggles at the same frequency you have defined. HAL_Delay() is using the system tick that has the same frequency input as the system clock with AHB div = 1.

mALLEm_0-1760543154881.png

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

So lets assume the SYSTEM Clock is correct 250Mhz. Is APB1 Timer clocks wrong?

setting a loop gpio loop with HAL_Delay(1) does show 1ms exactly but that does not mean much.

I can read SystemCoreClock via the API and it does return 250000000 so I guess that is the best I can do.

So what about the timer clock?  


@dvescovi wrote:

. so I ask the question is the SYSCLK also wrong? As far as I can tell there is no way to directly measure the SYSCLOCK ... if there is please let me know.  My guess is APB1 is really running at 125Mhz (i.e. /2) as my testing with the TMR1 the clock prescaller needs 124 NOT 249 to get 1uS ticks.


Use MCO2 instead / DIV10:

mALLEm_0-1760546085887.png

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

@dvescovi wrote:

So lets assume the SYSTEM Clock is correct 250Mhz. Is APB1 Timer clocks wrong?


I don't think so.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I just checked with my H563nucleo , using tim1 :

AScha3_0-1760546133075.png

+

starting it

  HAL_TIM_Base_Start(&htim1);
  HAL_TIM_OC_Start(&htim1, TIM_CHANNEL_1);

 

-> so 250M / 250 , toggle after 50 (should be = 50us);

scope shows on PE9 : 50us hi, 50 lo, doing what it should do.   Thats it.

 

If you feel a post has answered your question, please click "Accept as Solution".

@dvescovi wrote:

setting a loop gpio loop with HAL_Delay(1) does show 1ms exactly but that does not mean much.  


That does mean the system clock is correctly set at 250MHz. If the delay was different from 1ms that means Sys clock is different from 250MHz!

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.