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.

f2808 epwm Immediate Load Mode

Hi all,

Has anyone used the epwm Immediate Load Mode in f2808, I recently used it to generate a pwm signal with 50% duty cycle and frequency of 20KHz, the duty cycle is updated every 2.5us, but once in a while, the duty cycle changed to 100% which cannot be explained. This problem does not appear in shadow mode

Is there any examples from ti teaching how to use this mode?

What is the consequence if I use the  Immediate Load Mode instead of the shadow mode to update the epwm?

 

Thanks!

 

  • Immediate load will create issues if you are trying to generate a PWM signal. The compare value will be modified whenever you write to the register and depending on the timer count the effect will be different. You may get 100% ... you may also get no action for one full cycle, you may have other situations depending on timer count mode, counter value, compare value etc etc. The best way to create a glitch free PWM is to use shadow mode so that the system can make transition from one compare to another compare value without any unpredictable consequence. I don't think I ever used immediate loading for any power conversion system but I am curious to know your application where you need to use immediate load mode.

  • Hi,

    Thanks for the reply!

    Is there any difference between update on  counter either equal to 0 or period value (update twice in a pwm period) and only update once when counter equal to 0 using shadow mode?

    will it also cause some undesirable consequences?

     

    Thanks!

  • Updating twice will reduce your latency by 50% but in general for a motor control application it is not needed. Updating twice will help you mainly in a high band-width system like digital power supply type of application. Majority of power conversion applications will most likely be okay with updating once at counter equal to zero.

  • Hi billstrong

    My moto is "Do not optimize if it is not needed. Even if you know what you are doing" and I can agree with Arefeen that in most applications updating once a period is enough.

    Though with ePWM module you still have to be careful when you update, especially if you are updating multiple synchronized channels. (e.g. if you have configured all ePWMs to update when timer(s) is zero you have to be sure that between the moment you are updating first channel and moment you are updating last channel, timer(s) did not go through zero, otherwise on channel will be updated one period earlier than the other.)

    Regards, Mitja

  •  

    I don't know if anyone is still following this thread!

     

    One application I can think of in power conversion where you would want to have a faster update rate is for very low switching frequencies at high power levels. The one sample or half sample delay can become quite significant. Since the PWM frequency and ISR rate are slower on these systems, you can compute the new period values very early in the period. Having to wait to the end can degrade performance. 

     

    I am surprised the epwm module cannot handle writes to the compare value in immediate load mode. I have implemented this functionality before in an FPGA and its just a matter of using a two phase clock and a synchronous compare. Writes happen on one phase, and the compare can happen on the other.

     

    BTW does this still apply to the 2802x family? Some issues like 0 to 100% duty cycle have been improved pm the 2802x over the 280x family. 

     

    Jason

  • Hello Jason,

    Do you have any news about your post of last year? Have you found any way of implementing the immediate update of the compare registers?

    I am working in a power converter and the phase margin of the loop is severely affected by this delay. I agree with you that it would be easy to solve by hardware.

    I am thinking on a workaround by software, but I would like to know if anybody has implemented something already. It´s not very easy to test if there are missed PWM cycles unless you close the loop with power.

    Thanks,

    Max

  • The only option that I know about is to update at period and zero. This can cut the delay in half.

    I had problems with an immediate update (no shadow) but you get glitches appearing in the PWM. 

    Having made my own PWM compare counters in an FPGA that did not have this issues (dual clocking) I find this extremely frustrating. 

  • Thanks for the response Jason.

    Yes, I have it configured to give a 1/2 cycle delay (up-down count, update at zero and period). But my loop needs more speed. I believe that there is a way to avoid the glitches by using the 2 comparators CMPA and CMPB and some code.

    I also find this a little frustrating, as well as the PWM synchronization method that is unreliable and the high resolution PWM that has too many limitations. They are things to improve in future devices.

  • I'm using the Piccolo 28027 and 28031. Both are a slight improvement over the 280x family in that they can produce 0 to 100% duty cycle PWM. 

    The comment above about motor control not needing the fast update rate is false. 

    In higher power converter, the switching frequency can be quite low 5KHz down to 500Hz. A one cycle delay in the PWM has a huge impact on the current loop performance. 

    The placement of the sampling of the current feedback does as well. In the worst case, you update the PWM at only period or zero. It does not get clocked out till the next ISR. Then you don't see the effects of the PWM change until the next ISR after that.  In some cases your hardware will let you sample at a different point which can help with this problem.

    Max, are you running low switching frequencies? 

  • Jason,

    Yes, I agree that the above statement is not totally correct.

    My current application is a switching power supply (50kHz switching), and to have a fast response (similar to an analog controller), updating once or twice a period adds too much delay. I'm calculating the loop (with the CLA) at 400k but the PWM gets updated only at 100kHz.

    I would rephrase the motor control statement by saying that updating once a period is enough in applications where the transient response doesn't need to be optimized to the maximum limits of the power stage (which are achievable with analog controllers).

    I've implemented motor controllers and updating once a period wasn't an issue, but it was because the PWM was 10 to 20kHz and the motor dynamics were much slower than that.

    It would be good if somebody from TI told us if they are considering an improvement in this area or they have found a software workaround for it.

    Max