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.
Hello,
I've been trying to get familiar with the TRREM register to use High-Resolution Phase-Shift control in a project I'm working on. I've gotten the deadband example working as I would like it, but I don't completely understand the behavior of the TRREM register. I've modified the deadband example to manipulate solely the TRREM register and observe the phase shift on an oscilloscope.
The first thing I'd like to understand: when TRREM is 0, the phase shift is greater than when TRREM = 1.
When TRREM = 0:
When TRREM = 1:
I've found that the phase shift at TRREM=0 is approximately equal to the value at TRREM = 512. What is the significance of this when TRREM is supposed to be an 11-bit register?
TRREM=0 producing the same result as TRREM = 512 would make me think the value just wraps around at 10 bits, but I've found that it goes much further than that, which I will now describe as well.
The value at which TRREM seems to wrap is 768. When I try to write a value higher than 767 (binary value 1011111111), the register wraps around to 256, and higher values wrap when TRREM reaches 768 again (so in steps of 512):
and again at 1280 (binary value 10100000000)
and 1792 (binary value 11100000000)
Then the final wrap at 2048, which makes sense because TRREM is described as an 11-bit register, but it also breaks the pattern because it's only 256 from the previous wrap instead of 512.
Interestingly during this wrapping, the phase shift continues to increase as expected without wrapping, only wrapping around at 2048 (although it wraps to 0, which has the weird behavior shown in the oscilloscope screenshots).
I would appreciate it if some of this behavior could be explained by someone with more knowledge about this register.
And as a side note, in the project I'm trying to implement high-resolution phase shift, when TRREM wraps for the first time at 767, the phase shift behaves differently from the example, despite the ePWM configuration being identical. It seems to wrap at the same time as TRREM to a lower phase shift value, but also jitters forward frequently:
Similarly I've found that near the max value of TRREM (2048), this jittering occurs as well:
I'll look into the differences between my program and the example separately, but if the issue is apparent, I would appreciate some insight there as well.
Thanks.
Hi Stephen,
Firstly, I'd like to ask you a few questions so I don't make assumptions about your configuration:
- How much are you deviating from the example? Are you also changing the period?
- Is HRPE bit enabled? If not, then TBPHSHR is okay to use
- Are you writing anything into TBPHS?
- What is the counter mode?
Best Regards,
Marlyn
- I've copied the HRPWM configuration exactly, but I'm not changing the period like they do in the example. I may be writing the same period repetitively to the TBPRD register (not HR), but not changing it while changing phase.
- The HRPE bit is enabled, I saw a separate thread about the usage of TBPHSHR, but simply setting HRPE=0 didn't seem to enable TBPHSHR functionality, and I was having acceptable results with the TRREM register while HRPE is enabled, so I stuck with that
- I am writing 0 to TBPHS for the screenshots in my original post. I write to it to experiment with larger phase shifts to see how accurately I could reach 10 degrees, for example. And for the project I'm working on, we'll be using almost the full range (0-180 deg). Is this an issue?
- The counter mode is up-down
Thanks
Hi Stephen,
Thank you for the responses. I am looking into this issue at the moment, and will respond back when I know more.
Best Regards,
Marlyn