I'm currently using TIM2 on an STM32F373 as a 32bit quadrature encoder interface, however I need to extend this to 64 bits. Can I cascade a second 32bit counter (e.g. TIM5) as a slave whilst still maintaining the ability to count up & down ? Thanks
Thanks JW. I can see you've used unsigned integers throughout and I think this is where I am getting confused as I would need the function to return a signed 64 bit result which could run positive and negative either side of zero.
I've been trying to develop a function to do what you suggest and read the TIM2 CNT register at a regular fast rate and extend its 32 bit value into 64 bits whilst coping with rollovers in both the up and down directions. The code I have so far is sh...