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.
I want to precisely emulate a QEP sensor ABZ (or ABI) differential output using 28379D and would like this signal to externally feedback into a QEP conditioning circuit and ultimately back to the MCU. I would like the ability to change the output frequency during run-time and I want the index (Z, from now on) to be aligned with A exactly once per rotation. I believe using three ePWM modules (6 signals total) would be the easiest, but I am open to suggestions.
To generate A and B, I configure them as UpDown counters, link TBPRD and CMPA values and then add a TBPRD/2 phase delay to B. Whenever an output frequency change is desired, TBPRD, CMPA and TBPHS(B) are all updated.
I am finding the biggest challenge to be properly aligning the index when the PPR of the QEP is large (for now, I am using 512, but I'd like a flexible solution). Here are a few things that I have tinkered with, and some challenges that I have had:
QEP Position Interrupts (Janky McJankyPants)
Challenges here:
TBPRD Stretching (Queen of the Janks)
Challenges here:
To me, both suck, any suggestions?
Hi Wil,
I am finding the biggest challenge to be properly aligning the index when the PPR of the QEP is large (for now, I am using 512, but I'd like a flexible solution). Here are a few things that I have tinkered with, and some challenges that I have had:
What are your constraints for the PPRs? Min/Max? Have you tried syncing the PWM modules? How many encoders are you emulating? If you're only trying to emulate 1 encoder, then using 2 ePWM modules would seem to work since you have ePWM1A/B, and ePWM2A. ePWM1A could be used as your index strobe, and ePWM1B could be used as your eQEPA signal. ePWM2A could be used as your QEPB signal.
The reason behind using ePWM1A as index and ePWM1B as QEPA, is that they should be properly aligned since they are within the same ePWM module and using the same CLK.
Best,
Ryan Ma
My PPR is 512, I would like to up to 2048. I'm emulating one encoder but I would like the signals to be differential pairs to match the hardware inputs.
All of the PWM modules are sync'ed, that is not the issue. The issue is reasonably "gating" the index pulse with the other pulses (see Figure 17-3 in SPRUHM8).
Hi Wil,
I am working on this with another subject matter expert to see if we can provide an alternative suggestion than the ones you have provided. I will provide a response by end of day tomorrow.
Best,
Ryan Ma
Hi Will,
Can you clarify what you mean when you say that you want the signals to be differential pairs? The quadrature signals are typically single-ended. And since they're digital and not fast-switching, they're typically not particularly susceptible to common mode noise.
Do you instead mean that you want to ensure they are 90 deg offset?
Regards,
Peter
Peter,
In my experience, its not uncommon for motor shaft QEP sensors to send their signals in differential pairs. Here is an example of one, if interested.
With that said, I do not believe that differential is the issue. As I stated in the OP, I have A and B working fine (diff or not), that part is straight-forward. Gating Z is the part that I believe is tricky.
Hi Will,
In my experience, its not uncommon for motor shaft QEP sensors to send their signals in differential pairs. Here is an example of one, if interested.
Thanks for sending that link. Our EQEPs only support single ended QEP signals, so this is an interesting read and seems especially important in applications where the cable length will be quite long.
Moving over to your inquiry, I discussed this with Ryan and an implementation we have thought of would use the configurable logic block (CLB) IP on the C2000 device. This CLB has connections to the EPWM so one solution we thought of would be to pass the QEPA_P signal through the CLB and have the CLB count the number of incoming signals. The CLB has an internal counter which you can configure to count to a specific number and then output a pulse of a defined length onto a GPIO pin once that count value has been received. Inputs into the CLB can be filtered for rising edge and falling edge detects so the CLB peripheral accurately counts the number of pulses received from the EPWM module.
Regards,
Peter
Peter,
Sorry for being unclear, I have already handled the diff->single-ended conversion. This entire system is working in physical units with differential QEP inputs. This request is for creating an emulator of these large systems so I can better debug/development at my desk.
That CLB solution seems really clever! For some reason, I thought that the CLB counters could only count up to 16.
To summarize:
Instead of creating the Z signal with a GPIO pulse, would I be able use the CLB counter logic to trigger a One Shot on the PWM module that is configured for Z? This way the differential part would be handled simply (EPWMLINK for TBPRD and CMP).
Thanks again. Peter and Ryan!
Hi Wil,
The One shot on the PWM, are you meaning using the one shot trip zone configuration on PWM?
Best,
Ryan Ma
Hi Will,
That CLB solution seems really clever! For some reason, I thought that the CLB counters could only count up to 16.
Yes we actually have three independent 32-bit counters within the CLB so even with the single counter, you would be able to support even the highest resolution encoders (I've yet to hear of a 1 billion count encoder)
Instead of creating the Z signal with a GPIO pulse, would I be able use the CLB counter logic to trigger a One Shot on the PWM module that is configured for Z?
I don't believe this is a feature on our PWMs, but you should be able to use another independent counter to control the on-time of this index pulse being generated by the CLB. There is a CPU-CLB FIFO interface which you can use to send data to the CLB counter so you can dynamically update this on-time as you update the frequency of the QEP signals
Regards,
Peter
Hi Wil,
Sounds good, if any further questions come up feel free to post a new thread with your new question.
I will go ahead and close this thread.
Best,
Ryan Ma