DSPRelated.com
Forums
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →

Broken quadrature encoder circuit on TI F281x DSPs?

Started by Chris Carlen ●August 24, 2005
I read in sci.electronics.design that CBFalconer <cbfalconer@yahoo.com> 
wrote (in <430DABB3.37318F57@yahoo.com>) about 'Broken quadrature 
encoder circuit on TI F281x DSPs?', on Thu, 25 Aug 2005:
>John Woodgate wrote: >> CBFalconer <cbfalconer@yahoo.com> wrote >> >>> Your waveforms would make more sense if you used a fixed width font. >> >> Isn't the font set by your e-mailer, not by the message? > >Yes, but the result then doesn't match what you saw when you wrote it. >The vast majority of e-mail and netnews are displayed in fixed font. >The result is that waveform edges are displaced from what you drew. >Even if the receiver used a variable width font, there is absolutely no >guarantee that his spacing matches yours. With a fixed width font >there is such a guarantee.
The diagram seemed to make sense to me when displayed in Courier New. So I have no reason to assume that the OP used a proportional font. YMMV, I suppose. -- Regards, John Woodgate, OOO - Own Opinions Only. If everything has been designed, a god designed evolution by natural selection. http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
jmeyer@nowhere.net wrote:
> Dear Jerry, > It is seldom necessary to quote an entire message filled with timing > diagrams and diatribes simply to add a one line reply.
Interesting combination huh, "timing diagrams and diatribes." :-D -- _______________________________________________________________________ Christopher R. Carlen Principal Laser/Optical Technologist Sandia National Laboratories CA USA crcarleRemoveThis@BOGUSsandia.gov NOTE, delete texts: "RemoveThis" and "BOGUS" from email address to reply.
Jim Granville wrote:
> Chris Carlen wrote: > >> Hi: >> >> I have BEI encoders which make waveforms which look like: >> >> >> N-1 N 0 1 2 3 4 5 ... >> ______ ______ ______ ______ >> B: ______ ______ ______ ______ >> ___ ______ ______ ______ ___ >> A: ______ ______ ______ ______ >> ______ >> Z: __________________ ________________________ >> > <snip> >> It only resets the count to zero (when the EXTCONx.QEPIQUAL bit is >> set) when the Z pulse happens clearly *within* the 1/4 cycle in which >> A and B are both high. Ie, the rising edge of Z must occur after A = >> B = 1. It is edge sensitive to Z rather than condition sensitive of >> A=B=Z. >> >> That means, the only way Z resets is if my pulses look like this: >> >> ____ _____ ____ ____ >> A: ____ ____ ____ ____ >> __ ____ _____ ____ __ >> B: ____ ____ ____ ____ >> _ >> Z: _______________ ________________ >> >> Thus, the TI QEP circuit is bungled because if I did somehow have an >> encoder that produced pulses like this, I would get an extra count in >> the forward direction: > > But you are about to reset, so all you are talking about is a one count > skew in the MAX possible number, just before reset.
Yes. But actually it is Ok, because there is a period register for the timer that will ensure it can't ever count beyond the encoder resolution. Thus, the if the Z pulse lags and the first revolution starts with an under-count, then the Z pulse will reset things the first time and be ignored thereafter. The only deficiency is that it cannot reset in the reverse direction. Since our application is mainly one-directional, this isn't a serious problem. Nor it's more of a disappointment. There are times when we will want to manually move our shaft forward and backward over the zero point for alignment purposes, so it is actually essential that we can maintain accurate 1/4 cycle counting throughout. It seems that is possible, as long as one forward pass is first made through Z. Also, I will have to guarantee that Z rising edge occurs after the two phases are high. That is what really bugs me. The correct implementation would be a condition sensitive reset, when A=B=Z=1. But they have Z edge sensitive instead, which also contradicts what they say in the documentation.
>> There is another mode if the EXTCONx.QEPIQUAL bit is not set in which >> the counter resets to zero whenever there's a rising Z edge, >> regardless of the state of the phases. In this case, I'd get a 1/4 >> cycle error between the two directions (with a real BEI encoder >> waveform): >> >> FWD: 6 7 8 9 10 11 0 1 2 3 4 5 >> REV: 5 6 7 8 9 10 11 0 1 2 3 4 >> ________ ___________ ________ >> B: ________ __________ ________ >> ____ _________ __________ ____ >> A: ________ __________ ________ >> ___________ >> Z: __________________________ _________________ >> >> >> Oh, but actually things could be much worse because if the Z edges lag >> B, then I get extra glitch counts again! >> >> Ugh! >> >> >> How could TI do it this way? > > At least they gave a RESET, and gave you a choice on the mode :) > > Sounds like they tried to "cover the bases", and the first option is > preferrable, if the encoder allows; if it has a wide Z, then you need > 2nd option, but as you say, that can have Zero exit errors, but as > long as the edges swallowed inside Z are stable, you should get > stable counts on either side, again with a small +/- 1 error on > 'absolute' location. > Normally, you use much finer quad steps, than your system needs, so > this level of detail should not be a practical issue. > > [ Level sense on Z would probably have been better design, but > maybe they wanted to avoid wide/unknown dead-bands ? ]
Yeah, perhaps. Are there wide variations in the implementation of index signals on encoders throughout the industry? Unfortunately, I only have worked with BEI. Oh actually, we had an older brand that we've since replaced which also worked just like BEI. Z pulse was fairly in line with a single pulse of one phase. Good day! -- _______________________________________________________________________ Christopher R. Carlen Principal Laser/Optical Technologist Sandia National Laboratories CA USA crcarleRemoveThis@BOGUSsandia.gov NOTE, delete texts: "RemoveThis" and "BOGUS" from email address to reply.
Jerry Avins wrote:
> Read over United States Patent 4300039, then we'll correspond further. > > Jerry
Thanks for the input Jerry. I am aware of such methods. I wish to avoid building my own quadrature decode hardware. I could do it if I want, and would probably do it with a state machine in a FPGA that I plan to have nearby the DSP for misc. logic tasks. But the reason I want to rely on the F281x QEP circuitry is that I will be using the compare match function as well. Also period interrupts. Of course, all this can be done as well with the PLD, but if I can make the DSP's circuitry work, then that's the most straightforward path. It turns out that while I think they did blow it in terms of the most sensible implementation, I can get working results with just a minor external hardware trick. If I simply can guarantee that the Z rising edge occurs after the condition A=B=1 is satisfied, as well as setting the counter period to the encoder's max count, then actually I can't ever get an extra count. The only deficiency is that it can only sync to absolute position in one direction. But that is fortunately not a bog problem in this application. Good day! -- _______________________________________________________________________ Christopher R. Carlen Principal Laser/Optical Technologist Sandia National Laboratories CA USA crcarleRemoveThis@BOGUSsandia.gov NOTE, delete texts: "RemoveThis" and "BOGUS" from email address to reply.
On Thu, 25 Aug 2005 14:18:32 +0100, John Woodgate
<jmw@jmwa.demon.contraspam.yuk> wrote:

><snip> >The diagram seemed to make sense to me when displayed in Courier New. So >I have no reason to assume that the OP used a proportional font. YMMV, I >suppose.
I'm using Lucida Console 10, also a fixed spaced font, and it doesn't look good, at all. So I switched over to Courier New to re-examine the output. No better. I think it must have originally been drawn in a variable pitch font. Jon
Jonathan Kirwan wrote:
> On Thu, 25 Aug 2005 14:18:32 +0100, John Woodgate > <jmw@jmwa.demon.contraspam.yuk> wrote: > >><snip> >>The diagram seemed to make sense to me when displayed in Courier New. So >>I have no reason to assume that the OP used a proportional font. YMMV, I >>suppose. > > I'm using Lucida Console 10, also a fixed spaced font, and it doesn't > look good, at all. So I switched over to Courier New to re-examine > the output. No better. I think it must have originally been drawn in > a variable pitch font. > > Jon
Nope. Very fixed width here in my Mozilla Mail composer using text mode. Interestingly, my mail config has a place to select whether to compose in HTML, I have that unchecked. Then there is a place to select which font to use for HTML message compositions. That was set to variable. However, I am not composing in HTML so it should not apply. furthermore, the mail I am composing now, just as the one with the timings, was very clearly fixed width, as evidenced by the fact that the characters of all lines form straight vertical columns on nmy screen. So things like this look right: N-1 N 0 1 2 3 4 5 ... ______ ______ ______ ______ B: ______ ______ ______ ______ ___ ______ ______ ______ ___ A: ______ ______ ______ ______ ______ Z: __________________ ________________________ The edges of B and Z waveforms line up vertically, and the numbers above are centered within 1/4 cycles of the waveform. But thanks for trying to look at my post. Good day! -- _______________________________________________________________________ Christopher R. Carlen Principal Laser/Optical Technologist Sandia National Laboratories CA USA crcarleRemoveThis@BOGUSsandia.gov NOTE, delete texts: "RemoveThis" and "BOGUS" from email address to reply.
On Thu, 25 Aug 2005 10:17:05 -0700, Chris Carlen
<crcarleRemoveThis@BOGUSsandia.gov> wrote:

[...]
>So things like this look right: > > N-1 N 0 1 2 3 4 5 ... > ______ ______ ______ ______ >B: ______ ______ ______ ______ > ___ ______ ______ ______ ___ >A: ______ ______ ______ ______ > ______ >Z: __________________ ________________________
Almost, but not quite lined up when it got here. It looks like either the upper lines gained a space, or the lower ones lost one. If I make a minor correction, I get:
> N-1 N 0 1 2 3 4 5 ... > ______ ______ ______ ______ >B: ______ ______ ______ ______ > ___ ______ ______ ______ ___ >A: ______ ______ ______ ______ > ______ >Z: __________________ ________________________
Which at least appears correct on my system. FWIW, if I were drawing it, I'd put in the vertical markers, and try to line the numbers up on them, e.g.
> N-1 N 0 1 2 3 4 5 ... > _____ _____ _____ ______ >B: _____| |_____| |_____| |_____| > __ _____ _____ _____ ___ >A: |_____| |_____| |_____| |_____| > _____ >Z: _________________| |________________________ >
This would have made it easier for me to follow, anyway... Regards, -=Dave -- Change is inevitable, progress is not.
How petty.. it si a QUADRATURE encoder. The waveforms are all the same.. If
you've seen one.


"Dave Hansen" <iddw@hotmail.com> wrote in message
news:430e0365.1128979453@news.ispnetbilling.com...
> On Thu, 25 Aug 2005 10:17:05 -0700, Chris Carlen > <crcarleRemoveThis@BOGUSsandia.gov> wrote: > > [...] > >So things like this look right: > > > > N-1 N 0 1 2 3 4 5 ... > > ______ ______ ______ ______ > >B: ______ ______ ______ ______ > > ___ ______ ______ ______ ___ > >A: ______ ______ ______ ______ > > ______ > >Z: __________________ ________________________ > > Almost, but not quite lined up when it got here. It looks like either > the upper lines gained a space, or the lower ones lost one. If I make > a minor correction, I get: > > > N-1 N 0 1 2 3 4 5 ... > > ______ ______ ______ ______ > >B: ______ ______ ______ ______ > > ___ ______ ______ ______ ___ > >A: ______ ______ ______ ______ > > ______ > >Z: __________________ ________________________ > > Which at least appears correct on my system. FWIW, if I were drawing > it, I'd put in the vertical markers, and try to line the numbers up on > them, e.g. > > > N-1 N 0 1 2 3 4 5 ... > > _____ _____ _____ ______ > >B: _____| |_____| |_____| |_____| > > __ _____ _____ _____ ___ > >A: |_____| |_____| |_____| |_____| > > _____ > >Z: _________________| |________________________ > > > > This would have made it easier for me to follow, anyway... > > Regards, > > -=Dave > -- > Change is inevitable, progress is not.
On Thu, 25 Aug 2005 17:52:23 GMT, iddw@hotmail.com (Dave Hansen)
wrote:

>On Thu, 25 Aug 2005 10:17:05 -0700, Chris Carlen ><crcarleRemoveThis@BOGUSsandia.gov> wrote: > >[...] >>So things like this look right: >> >> N-1 N 0 1 2 3 4 5 ... >> ______ ______ ______ ______ >>B: ______ ______ ______ ______ >> ___ ______ ______ ______ ___ >>A: ______ ______ ______ ______ >> ______ >>Z: __________________ ________________________ > >Almost, but not quite lined up when it got here. It looks like either >the upper lines gained a space, or the lower ones lost one. If I make >a minor correction, I get: > >> N-1 N 0 1 2 3 4 5 ... >> ______ ______ ______ ______ >>B: ______ ______ ______ ______ >> ___ ______ ______ ______ ___ >>A: ______ ______ ______ ______ >> ______ >>Z: __________________ ________________________
Exactly correct. Now it looks right. You've identified the issue, I think.
>Which at least appears correct on my system. FWIW, if I were drawing >it, I'd put in the vertical markers, and try to line the numbers up on >them, e.g. > >> N-1 N 0 1 2 3 4 5 ... >> _____ _____ _____ ______ >>B: _____| |_____| |_____| |_____| >> __ _____ _____ _____ ___ >>A: |_____| |_____| |_____| |_____| >> _____ >>Z: _________________| |________________________ >> > >This would have made it easier for me to follow, anyway...
Neat. I like it much better, too. Jon
Dave Hansen escreveu:
> On Thu, 25 Aug 2005 10:17:05 -0700, Chris Carlen > <crcarleRemoveThis@BOGUSsandia.gov> wrote:
<snip>
>> N-1 N 0 1 2 3 4 5 ... >> ______ ______ ______ ______ >>B: ______ ______ ______ ______ >> ___ ______ ______ ______ ___ >>A: ______ ______ ______ ______ >> ______ >>Z: __________________ ________________________ > >
This looks right here. <snip>
>> N-1 N 0 1 2 3 4 5 ... >> ______ ______ ______ ______ >>B: ______ ______ ______ ______ >> ___ ______ ______ ______ ___ >>A: ______ ______ ______ ______ >> ______ >>Z: __________________ ________________________ > >
<snip> This doesn't(it's one char too few in the upper line). Ricardo