cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 timer is too slow

mosamasa
Associate II

Hi,

I'm using STM32H755 Nucleo board and I'm trying to use TIM2 to trigger Dual ADC conversion. M7 core is running FREERTOS and M4 is bare metal. ADC is controlled by M4 core. DMA is used to transfer data to M7 and then M7 is using ethernet to transfer data further. Sampling rate of my ADC is 1.92MSPS (12bit). I try to use TIM2 to trigger ADC. This should happen with rate of 60Hz. Every 16.67ms (60Hz), I would like to collect 2x2048 samples.

For some reason my TIM2 interrupt occurs every 52ms. It sounds like my clock rate is not 200MHz as shown in .ioc, but it is 64MHz. What might explain the problem?

clock.PNGTIM2.PNG

6 REPLIES 6

Isn't your primary clock source 8MHz instead of 25MHz?

JW

That would match with 52ms vs 16.67ms, but according to my understanding my clock source is 25MHz HSE and APB1 timer clock is 200MHz.

If we talking about 

NUCLEO-H755ZI-Q

see circuit:

AScha3_0-1743521412635.png

so clock from st-link: 8M . (not 25M, or 25/3 ~ 8.33M , depends on st-linkV3 setting on update)

AScha3_1-1743521508357.png

 

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

waclawekjan_0-1743521659102.png

JW

That would explain the problem. All the settings seems to be correct, but as my clock is not 25MHz, everything is has 25/8 error. I was measuring master clock output (HSE) with /10 and I was measuring 800kHz. NUCLEO-H755ZI-Q board should have 25MHz clock, but it seems not running by default. Is it possible to use this external clock with st-link?

Sure - if you connect a 25M crystal. Look at your board: what is fitted or empty places :

AScha3_0-1743523773658.png

So if nothing there, but you want it - you have to put the missing parts to the board and 

AScha3_1-1743523950908.png

-> SB72 off , SB3+4 ON ; add X2 , C74, 76 ; 25MHz + 2 x 5.6 pF .

But this will change/improve nothing, if you set in CubeMx the actual 8M clock as HSE bypass, all your clocks are correct then. Try it.

AScha3_2-1743524339144.png

 

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