Part Number:TMS320F28379D
Hello all,
I’m trying to capture encoder edge timing using the eQEP timer capture unit and am noticing some inconsistent behavior.
I’ve got the eQEP configured in Quadrature count mode, with PCRM mode 1. I’ve got the Unit Timer enabled with the QEP capture mode set to latch on position read by CPU, (QCLM = 0).
The eQEP is running in quadrature mode and the capture unit is running with default values:
CPPS = 0, UPPS = 0
I’ve got a single interrupt running that allows me to read the eQEP position register every 100usec, along with the eQEP status register.
My reference encoder line frequency approximately 22.5k lines/sec. This equates to approx. 9 counts every interrupt. Since my encoder frequency is not exact, I expect, (and see), that most times the number of counts captured every interrupt is 9 with the fractional part left over adding up over time to produce the occasional 10 counts/interrupt.
I am also monitoring the captured timer value each interrupt, (the value simultaneously latched by the position read), and when things are in a working state, when the frame containing 10 counts is read, the timer value is always very close to being the interrupt period value, (that is what I expect since the extra count just squeeked in before the position read). When things aren’t in a working state. The frame containing the 10 counts occasionally comes one frame AFTER the large timer value. The only difference between the two conditions is a power cycle of my test board. Is there something I’m missing?
Note: I’ve got the qualifications of the eQEP pins set to 6 periods of 2 clocks each. I’ve also looked at the eQEP status on every frame, to see if possibly I got a direction change, (the direction error flag was never set). Since the output of the Quadrature decoder unit feeds both the QCAP and the PCCU, the only thing I can think of is that either the timer value is latched a clock or two AFTER the position is actually read, OR the position count and timer are latched simultaneously BUT the qualified edge information takes longer to be processed by the quadrature decoder unit.
This will happen at any encoder frequency and can only be removed by a power cycle. (code is running from flash)
Any ideas?