2020-07-03 08:12 AM
Are there some working hrtimer examples for STM32H7 floating around?
Solved! Go to Solution.
2020-07-03 11:39 PM
There are a couple in the CubeH7 distribution.
2020-07-03 11:39 PM
There are a couple in the CubeH7 distribution.
2020-07-04 01:55 AM
OK, I have found these and played around a bit and find an interesting discovery. According to the data sheet STM32H7 HRTIM clock is Sysclk (480MHz). However, there are reserved settings of clock prescaler in HRTIM_TIMXCR registers, which actually multiply HRTIM clk up to 6.4GHz ! I have tried it and it seems to be working. Perhaps there are some settings/modes where it does not work, so they cut it out from the datasheet?
2020-07-04 03:12 AM
How did you verify that the timer really works with 6.4GHz clock?
2020-07-04 04:45 AM
I programed it to generate squarewave with complementary outputs and deadtime and simply varied value of prescaler parameter while observing outputs with an oscilloscope.
2020-07-04 04:52 AM
Prescaler effectively divides the clock rate. Did you try anything with prescaler=0?
2020-07-04 05:43 AM
According to the datasheet, prescaler values below 5 (101) are reserved, but actually MULTIPLY hrtim clk by 2, 4, 8...
2020-07-04 05:56 AM
Ok. So what was the highest frequency you were able to generate (as seen on the scope)?
2020-07-06 12:24 AM
My scope goes up to 100MHz, so I can only see squarewaves up to ~30MHz. However, time resolution matches 6.4GHz clock - that is, if I program prescaler to 0 and period register to 3200, I can see 2MHz output signal. Then I programmed the other channel with period of 3201 and now these two channels are not in-sync anymore, since second channel period is longer for 156pS.
2020-07-06 12:40 AM
Actually, it's even better - I just realized that HRTIMSEL bit in CFGR was reset, so HRTIM was supplied with 200MHz clock. Now I set it to 1 (HRTIM base clock is now 400Mhz) and thing still works - calculated clock is now 12.8GHz !!!