2022-09-29 01:13 AM
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
2022-09-29 01:39 AM
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