cancel
Showing results for 
Search instead for 
Did you mean: 

Which is the best way count over 1G with a 16-bit timer ?

hdemi.1
Associate III

I need to count over 1G with a 16-bit timer, measurement accuracy is very important to me. I had to do it using a single timer, do you have any suggestions? I am using stm32f0 ant timer1

Thank you

1 REPLY 1

You need to combine the TIM1_CNT with some "upper-bits" counter.

Either use master-slave (TRGO-TRGI) connection to other timer, master generating TRGO upon Update, and slave being set to external clock mode; or simply in Update interrupt of TIM1 increment a variable which represents the uppermost bits of your "combined counter".

In any case, when reading out the value, as there's no native way to read both parts of the "combined counter" at the exactly same time, you have to use the usual "read upper 1 - read lower - read upper 2 - if upper1 != upper2 repeat all" procedure.

JW