2013-02-06 06:43 AM
Im using a quadrature encoder hooked up to TIM3-CH1/2 and it works fine, counting both edges, up and down.
First question is how to read the TIM3-counter values from within a regular (50 us) ISR. Using TIM_GetCounter(TIM3) will cause a problem because the counter-value may be read at a time where it is being updated (written) and therefore generating a corrupt value. How to do this and make sure the value read is a correct (non corrupted) one ?Second question is about using a index-pulse coming from my encoder. This index-pulse should be used for checking the encoder counter value to make sure it is not drifting over one revolution. I cannot use any interrupts to do this.Is it possible to having the index-pulse generating a capture of the TIM3-counter and also transfer this (using double-buffered DMA) to a variable in memory ?The index-pulse is coming into TIM3-CH3, but since TIM3 is already setup in encoder-count mode, would it even be possible to have the TIM3-CH3 to trigger a capture of the counter as well as initating a DMA-transfer ?Thanks for any help with this! #encoder-index-quadrature-tim32013-02-08 01:21 AM
Well it is not NAMED ''Quadrature'' Encoder Interface, but it definitely is more powerful than the Microchip counterpart of the standard dsPIC33 series.
(For some things you need some calculation effort, but as you can additionally use all the capture and compare stuff for this counter, you can do extremely powerful things with it. Of course STM32F4 has no direct velocity indication or so - but this you really can also program quite well - this from my point of view is not crucial for such an Encoder interface). (concerning literature I am frightened there is nothing - application support for STM32F4 really is very poor. STM32F4 has so many possibilities that it really gets hard with all this detailed application support, I understand this principally, but I think motor market really is a very big market, and they could spend an application note for state of the art QEI readout with their encoder interface).2013-02-08 06:19 AM
Just a PS
I have never used the mcrochip and did not mention it for any othre reason than to indicate thet I was not the only one seeing the need for HARDWARE decode of quadrature Erik