Skip to main content
dibs
Associate III
June 9, 2014
Question

STM32F4 - Quadrature + toggling

  • June 9, 2014
  • 3 replies
  • 728 views
Posted on June 10, 2014 at 00:33

Can you use a single timer to make a quadrature divider? What I mean by this is can you take in a quadrature signal, have the timer increase its CNT register and then toggle channels 3 & 4 based upon a particular CNT value?

 

This would require channels 1&2 acting as quadrature inputs and channels 3&4 acting as toggling outputs. If this is not possible, can you tell me why? My initial attempts at this failed, so I am trying to figure out if there is something about the peripheral that causes this to not be possible.

Thanks in advance,

#stm32f4 #toggling #quadrature #qei
This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
June 9, 2014
Posted on June 10, 2014 at 00:50

I would think that output compare and toggle modes would be viable on Ch 3 and 4, but honestly not something I've had cause to try.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
jpeacock2399
Associate III
June 10, 2014
Posted on June 10, 2014 at 15:59

In encoder mode the counter runs in both directions, depending on quadrature phase.  Then there's the edge jitter problem where the low bit of the counter oscillates if the encoder stops on an edge.  I imagine the output of a divider would have a strange waveform.

I can see where an encoder clock divider could be used as some form of tachometer output.  I use channel 3 on an encoder timer to capture the index pulse so no particular reason why you can't configure the extra channels for output.

  Jack Peacock
dibs
dibsAuthor
Associate III
June 11, 2014
Posted on June 11, 2014 at 18:42

Assuming a perfect input, I have tested that this does work.

A jittery input would indeed cause problems with this method. Any ideas on how to deal with this?