Skip to main content
Graduate
October 13, 2025
Solved

STM32H563 clock at 250Mhz

  • October 13, 2025
  • 6 replies
  • 1172 views

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.

    This topic has been closed for replies.
    Best answer by TDK

    If the timer is set up to toggle on match, you should see a square wave with half the frequency of the timer update frequency. A square wave. The term "50us waveform" is ambiguous here. Can you show a scope output when prescaler is 124 and ARR is 50? (Should actually be 49).

    6 replies

    Super User
    October 13, 2025

    I have a nucleo H563 also running at 250 MHz.

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

    So check the real HSE frequency with a scope.

    To check the internal frequency, use the MCO output, set it in Cube and then check with scope.

    dvescoviAuthor
    Graduate
    October 13, 2025

    first of all, you cannot directly check the system frequency using the MCO1 out pin as far as I can tell.

    You can only see the HSE frequency x8 with the MCO1 pin.

    With HSE fixed at the 8Mhz on this board the MCO1 pin shows 64Mhz no matter how you configure its divider and multiplier.

    If you change the divider to /1 the multiplier gets changed to x8. If divider is changed to /8 the multiplier gets changed to x1.

    64Mhz does show on the scope output for MCO1 out. but since the clock diagram is lying to me about the other frequencies I do not trust the fact that it may be running at 250mhz

    Super User
    October 15, 2025

    Come on...see here, core at 200M , mco /10 , so 20M to check outside:

    AScha3_0-1760524413754.png

    And set pin speed high...otherwise maybe see nothing.

    ...and mco has to be enabled:

    AScha3_0-1760525094430.png

     

    Super User
    October 13, 2025

    > For my TMR1 to get 1us clock

    Glossing over a lot of details there. How are you assessing the timer has a "1us clock"? Is the CPU involved? How is the timer configured? Toggling a timer pin will appear at half the timer update frequency.

    dvescoviAuthor
    Graduate
    October 14, 2025

    I am using the TIM1 with clock source set to Internal Clock.

    I am using it in Counter Mode Up.

    Internal Clock Division (CKD) - No Division

    I am periodically loading the ARR register the value I desire in micro seconds.

    on rollover I toggle output.

    I have to set prescaler to 124 to get the output in microseconds on the scope.

    ex: load 50 into ARR to get 50us on scope.

    but if the APB1 is truely running at 250mhz, like the diagram shows, I would assume I would need to set the prescaler to 249 NOT 124 to get 50us waveform with an ARR load value of 50.

    TDKAnswer
    Super User
    October 14, 2025

    If the timer is set up to toggle on match, you should see a square wave with half the frequency of the timer update frequency. A square wave. The term "50us waveform" is ambiguous here. Can you show a scope output when prescaler is 124 and ARR is 50? (Should actually be 49).

    dvescoviAuthor
    Graduate
    October 14, 2025

    the timer interrupt is set for period elapsed with the HAL_TIM_PeriodElapsedCallback used.

    dvescoviAuthor
    Graduate
    October 14, 2025

    Slave mode set to Disable

    Technical Moderator
    October 15, 2025

    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

     

    Super User
    October 15, 2025

    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.

    dvescoviAuthor
    Graduate
    October 15, 2025

    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.

    Super User
    October 15, 2025

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

    On the contrary, a loop with HAL_Delay(1) will do 2 ms delays, not 1 ms delays. If it's showing 1ms that suggests clock is not configured correctly.

    Would be a better test if you did HAL_Delay(1000).