Hi:
I have BEI encoders which make waveforms which look like:
N-1 N 0 1 2 3 4 5 ...
______ ______ ______ ______
B: ______ ______ ______ ______
___ ______ ______ ______ ___
A: ______ ______ ______ ______
______
Z: __________________ ________________________
Now the thing is, that because the signals are generated by an
opto-mechanical interruptor, one cannot be certain that the edges which
appear to line up between the Z pulse and the B pulse train, really are
occurring before or after each other.
So a proper logic design to decode the signals into a count that is
accurate on a 1/4-cycle basis and can recalibrate itself to an absolute
zero position using the Z pulse when running either forward or backward
would involve a state machine that resets to zero at some defined
condition such as having both A and B high when the Z is high. Then it
won't matter if the direction is forward or backward, the count will
always become zero within the correct 1/4 cycle, and it also won't
matter if the edges of B vs. Z lead or lag each other slightly.
Well I would have thought this is how things would work with the F2812
QEP circuit, because that's what it says it can do. But it doesn't
work. 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: _______________ ________________
But as far as I know (only having experience with BEI encoders) is that
most encoders produce Z pulses that are a full half-cycle wide, and look
like my first diagram above (with the mentioned edge timing uncertainty).
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:
Let's say I have a 12 position encoder. My counts should be in the set
{0, 1, 2,..., 11}. But I'd get a brief forward count of 12 with this
situation, but reverse would be OK (after an initial forward pass):
FWD: 5 6 7 8 9 10 11 12 0 1 2 3 4
REV: 5 6 7 8 9 10 11 0 1 2 3 4
________ ___________ ________
B: ________ __________ ________
____ _________ __________ ____
A: ________ __________ ________
__
Z: __________________________________ _________________
I'd say this is not good!
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?
Has anybody found this to actually work correctly?
I'll be sending them an inquiry about this tomorrow.
Good night!
--
_______________________________________________________________________
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.
Broken quadrature encoder circuit on TI F281x DSPs?
Started by ●August 24, 2005
Reply by ●August 24, 20052005-08-24
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: __________________ ________________________ > > > > > Now the thing is, that because the signals are generated by an > opto-mechanical interruptor, one cannot be certain that the edges which > appear to line up between the Z pulse and the B pulse train, really are > occurring before or after each other. > > So a proper logic design to decode the signals into a count that is > accurate on a 1/4-cycle basis and can recalibrate itself to an absolute > zero position using the Z pulse when running either forward or backward > would involve a state machine that resets to zero at some defined > condition such as having both A and B high when the Z is high. Then it > won't matter if the direction is forward or backward, the count will > always become zero within the correct 1/4 cycle, and it also won't > matter if the edges of B vs. Z lead or lag each other slightly. > > Well I would have thought this is how things would work with the F2812 > QEP circuit, because that's what it says it can do. But it doesn't > work. 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: _______________ ________________ > > > But as far as I know (only having experience with BEI encoders) is that > most encoders produce Z pulses that are a full half-cycle wide, and look > like my first diagram above (with the mentioned edge timing uncertainty). > > 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: > > Let's say I have a 12 position encoder. My counts should be in the set > {0, 1, 2,..., 11}. But I'd get a brief forward count of 12 with this > situation, but reverse would be OK (after an initial forward pass): > > FWD: 5 6 7 8 9 10 11 12 0 1 2 3 4 > REV: 5 6 7 8 9 10 11 0 1 2 3 4 > ________ ___________ ________ > B: ________ __________ ________ > ____ _________ __________ ____ > A: ________ __________ ________ > __ > Z: __________________________________ _________________ > > > I'd say this is not good! > > 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? > > Has anybody found this to actually work correctly? > > I'll be sending them an inquiry about this tomorrow.Read over United States Patent 4300039, then we'll correspond further. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●August 24, 20052005-08-24
Chris Carlen wrote:> > I have BEI encoders which make waveforms which look like: > > N-1 N 0 1 2 3 4 5 ... > ______ ______ ______ ______ > B: ______ ______ ______ ______ > ___ ______ ______ ______ ___ > A: ______ ______ ______ ______ > ______ > Z: __________________ ________________________ >Your waveforms would make more sense if you used a fixed width font. -- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson
Reply by ●August 25, 20052005-08-25
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: __________________ ________________________ > > > > > Now the thing is, that because the signals are generated by an > opto-mechanical interruptor, one cannot be certain that the edges which > appear to line up between the Z pulse and the B pulse train, really are > occurring before or after each other. >the above looks correct to me. depending on how you want to do it. (B) input is good for counting on the raising edge because (Z) follows it. (A) can be used to determine the direction you are going when (B) raises. looks simple to me. Real Programmers Do things like this. http://webpages.charter.net/jamie_5
Reply by ●August 25, 20052005-08-25
Jamie 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: __________________ ________________________ >> >> >> >> >> Now the thing is, that because the signals are generated by an >> opto-mechanical interruptor, one cannot be certain that the edges >> which appear to line up between the Z pulse and the B pulse train, >> really are occurring before or after each other. >> > the above looks correct to me. > depending on how you want to do it. > (B) input is good for counting on the raising > edge because (Z) follows it. > (A) can be used to determine the direction > you are going when (B) raises. > > looks simple to me.It's not quite so simple. Consider what happens when the encoder oscillates back and forth across a B transition without A changing at all. The old solution is a state machine. The new solution (mine) with hardware uses two XOR gates and yields double or quadruple the basic resolution of the wheel. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●August 25, 20052005-08-25
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.> 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 ? ] -jg
Reply by ●August 25, 20052005-08-25
Jerry Avins wrote:> It's not quite so simple. Consider what happens when the encoder > oscillates back and forth across a B transition without A changing at > all. The old solution is a state machine. The new solution (mine) with > hardware uses two XOR gates and yields double or quadruple the basic > resolution of the wheel. > > JerryNot sure I'd call Nov 10 1981 'new' ? XOR based quad solutions have been around a very long time : You need either a pulse generator ( hard in an ASIC, or FPGA) or some FF's, and a faster clock, to do effectively the same thing. In today's digital fabric, the FF's are cheaper, and simulate correctly, and avoid issues with clock domain crossing... to . -jg
Reply by ●August 25, 20052005-08-25
I read in sci.electronics.design that CBFalconer <cbfalconer@yahoo.com> wrote (in <430D2747.537864EF@yahoo.com>) about 'Broken quadrature encoder circuit on TI F281x DSPs?', on Thu, 25 Aug 2005:>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? -- 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
Reply by ●August 25, 20052005-08-25
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. -- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson
Reply by ●August 25, 20052005-08-25
On Wed, 24 Aug 2005 22:11:22 -0400, Jerry Avins <jya@ieee.org> wroth:>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: __________________ ________________________ >>................bunch of stuff clipped...............>> >> I'll be sending them an inquiry about this tomorrow. > >Read over United States Patent 4300039, then we'll correspond further. > >JerryDear Jerry, It is seldom necessary to quote an entire message filled with timing diagrams and diatribes simply to add a one line reply. Jim






