Anyone who has read motor rpm with QEI and Timer in Edge Count mode may have realised that QEI sampling frequency is lower than the latter. Can anyone tell me how to increase the effeciency of QEI?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Anyone who has read motor rpm with QEI and Timer in Edge Count mode may have realised that QEI sampling frequency is lower than the latter. Can anyone tell me how to increase the effeciency of QEI?
Morning Amit,
As you know - firm/I work w/multiple ARM MCUs from several vendors. And - in general - I agree w/poster - some timing penalty is imposed by the MCU's internal QEI resolution implementation. (this is noted upon multiple vendor's offerings - not just yours)
Now - for a more "in-depth" & educational method - 2 or 3 "spare" MCU GPIOs - set-up as outputs - could be programmed as "pseudo QEI" and fed - in parallel - to (both) the QEI phase inputs AND an MCU's Timer. In this manner - any difference between QEI & Timer would "Quickly/Easily" reveal.
As "What's Unclear" post nears 26K "views/visits" (highest ever, this forum) I've suggested an App Note detailing the programming of a TM4C to realize this "pseudo QEI" capability. (in the past - we simulated "Hall Sensor" signaling - both @ 120 & 60° (electrical) - via a far simpler, 8 bit MCU!)
Better understanding always flows from "better tools and/or methods" - be they physical or software. Believe this "points" in that direction...
Follows a general MCU procedure to generate, "QEI style" outputs - 90° out of phase - for introduction into an (internal) or external QEI decoder.
Assumed is a 90° phase shift, 50% duty cycle - use of a single, MCU Timer, and the presence of 2 GPIO pins configured as outputs. (3rd required should QEI Index be required)
Now class - who can tell us why, "360 was chosen as the number of degrees w/in a circle?" (ANS: 360 is the smallest integer which is evenly divisible by "so many" other integers... i.e. by 2, 3, 4, (even 5!), 6, (not 7), 8, 9, 10, 12, (15 surprisingly), 16, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90...)
So we begin by choosing some integral multiple of 360 to serve as our "Phase A, QEI frequency generator. (i.e. 3,600, 36,000 both fit w/in a 16 bit counter)
Normally this will yield an acceptable Quadrature output. The detection of those four, critical timer values may be handled w/in an interrupt - that same interrupt may be "reloaded" w/"next critical timer count" values.
Via use of that Timer's Pre-scaler and/or injection of an external frequency signal - this "pseudo QEI Generator's" frequency may be selected.
I do not pretend nor offer that this method achieves the highest degree of accuracy - refinements are possible - yet this should prove, "Good for Gov't Work." (if you like your QEI - you can keep your QEI! ... ... (maybe... sometimes...) Use - as forum "boilerplate states" - is at your risk...
Hopefully you avoided the freezing rain. I drove through some 8 hours of that over the holidays. Accumulated nearly a cm of ice on the front of the car
Robert
ApparentlyI read the last question wrong.
Bonjour Monsieur,
Unfortunately freezing rain & horizontal snow was my plight. Tried to, "get a jump" on next week - accomplished that - but quadrupled commute time on return.
Prior to seeing your (latest... Apparently...) post I was going to note:
Dear Forum readers (landing here)
Poster Robert provides an "auxiliary means to "help" the MCU decode & process a QEI signal.
Poster cb1 (i.e. this guy) provides a method to program your MCU (any MCU) to generate a "pseudo QEI" output pulse train - which can then be routed into the MCU's QEI inputs. The merit of this approach is that, "Everyone (then) tests/verifies from a common (and known) beginning. Goal is to reduce the burden upon Amit.
One hopes the general code approach will see (few) implementations via DRM!
Merci et bon chance my friend, Ishan.
In closing, "KISS" = API = "Faster, Easier, Better" Program Code. Did we say "Far more robust, too?"
Managed to, "Stay on the icy road" (due to the API). Noted multiple others, (sideways - in ditches) - each flying, "Viva DRM" as their "Rescue pennant..." (rumor has it (apologies to Adele) that AAA and Amit's, "rescue hot-line" were both, "Off the hook busy...")