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.
Hi,
I am using EPWM module in Immediate mode to update duty in to CMPA register at the peak of the carrier(TBCNTR Zero or TBCNTR Period).Duty calculations are happening in a timer-0 Isr(50e-6 sec),which is a high priority Isr.I tested in two cases.
Case-1:Duty values are updating in CMPA register which is executing in the EPWM isr. I am using DC values as duty to check the immediate mode functionality.I changed the duty like 0.1 to 0.9 at peak of triangle.However,Pulse width is not changing as per duty change instant.Some times half carrier or one carrier delay is coming to change the pulse as per new duty
case-2: Duty values are updating in to CMPA register ahead of 150e-6 sec Triangle peak occurance.Duty also updating in timer-0 isr(not in EPWM isr).In this case also pulse width is not changing at the same instant of duty update.Some times half carrier or one carrier delay is coming to change the pulse as per new duty.But shadow mode is working fine in this case.
Immediate Configuration:
1. EPwm1Regs.TBCTL.bit.PRDLD = 1; //1-Immediate Load
2.EPwm1Regs.CMPCTL.bit.SHDWAMODE = 1; //1-Immediate mode.
3. EPwm1Regs.AQCTL.bit.SHDWAQAMODE = 0; //0: Immediate mode
4.EPwm1Regs.DBCTL.bit.SHDWDBFEDMODE =0; //0: Immediate mode.
5.EPwm1Regs.DBCTL.bit.SHDWDBREDMODE =0; //0: Immediate mode.
will you suggest me to solve this issue?
Hi,
When you are using immediate mode - the timing of the register update becomes very critical.
It also depends on what value you are updating in the compare register and whether the Time Base counter has already passed the value or not.
So, there is a possibility of missing the event, resulting in a different output/duty than expected.
Could you check that you are updating the CMPx registers at the right instance and the events are not missed in the duty cycle?
Also, I suggest you use the shadow load mode if it's acceptable for your application so that you do not have to carefully manage the timing of the updates.
Dear Subrahmanya,
Thanks for your reply.Yesterday i observed the same thing what you said.We have to update the new duty before the TBCNTR reaches the old duty(CMPA).But at the peak of the triangle,duty updation in pwm isr missing some events.So,i updated the duty 0.1e-6 sec before the carrier peak in timer-0 isr.Then no events are missing. This is same like shadow mode.I also checked the shadow mode,it is working.I am working on Motor control side,so shadow mode is sufficient.But Line converter side,we are thinking to use immediate mode.
I have another doubt .Can we change pulse more than one time either in UP Count or Down Count in UP-DOWN Count mode?
Hi,
Good to know your issue resolved.
KATURI GUDARU VENKAIAH said:I have another doubt .Can we change pulse more than one time either in UP Count or Down Count in UP-DOWN Count mode?
I mean with out using period and zero events match. In Immediate mode,if we unable to update the duty before the old duty update,we will get pulse with old duty only. So,even if we update new duty also after old duty loaded,we will not get new pulse according to new duty.Hence,what I understood is that once one duty is loaded in either up count or down count,pulse will not change in the same direction(up or down count)unless we use zero or periods events match. For both shadow and immediate modes we have to update duty prior to carrier peak only.Then what is the meaning of immediate mode?
Hi,
In the immediate mode the duty value written to CMPx register will take effect immediately. - irrespective of the up or up-down count mode.
But, what you need to be aware is that the Counter value should not have passed the updated CMPx value. If the counter already exceeded the CMPx value updated, then the CMPx match event is missed and it will take effect in the following PWM cycle.