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.

11 REPLIES 11
AScha.3
Super User

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.

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

> 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.

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

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

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.

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).

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

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

dvescovi
Associate III

Slave mode set to Disable

I still stand by the fact that APB1 appears to be running at 125Mhz even though the clock diagram (see attached file) shows 250Mhz.

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

 

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