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.

Implementing PFM using the ePWM peripheral

Other Parts Discussed in Thread: TMS320F2808

I'm using a  TMS320F2808 to drive a SEMIKRON IGBT module. I use the three legs of the inverter section as three parallel buck converters, operating 120* apart. The three IGBTs are driven directly by ePWM1, 2, and 3.

The buck converter performs acceptably using the standard PWM method.

Our application often runs the buck converter at a very low duty ratio and I want to implement Pulse Frequency Modulation (PFM) to slow the switching rate at low duty cycles to reduce power losses. My investigation so far leads me to believe that the following would be the best way to do it:

  1. Each time the CMP value is adjusted (and therefore the duty ratio changed), a check is made to see if a change in frequency is necessary. If so then,
  2. all ePWM modules are brought down with SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0,
  3. the frequency of all three ePWM modules is changed one by one using EPwmxRegs.TBCTL.bit.CLKDIV = TB_DIVx;
  4. all ePWM modules are brought back up with SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1.

Does this sound like a reasonable way to proceed? In our application we must guarantee that the IGBTs will not stop switching for more than about 10ms, so bringing them down in code makes me a little nervous. But if I protect that part of the code, I think we should be safe.

 

  • Hi Heath.

    I usually solve this problem by setting a limit on minimal duty cycle. If the desired duty cycle (output of current/voltage controller) is smaller than limit value I do not switch for one period. If next period desired duty cycle is still smaller than limit value I still do not switch. This scheme basically results in a smooth PWM/PFM transition, using only one controller (and one set of controller parameters). The only drawback is that PFM operates only at multiples of original switching period.

    In your case you could add a counter to count how long (how many PWM switching periods) you held output in one state and if this time is/was to long you could take appropriate action

    Regards, Mitja

  • Thanks for the reply Mitja. That is the way I was originally going to implement it but it would require running code every switching period. At present the controller only calculates a new duty every 100 switching cycles. I was concerned about the load on the processor if I was to fire an ISR at the end of every cycle (10kHz). This would be a neat way to do it though, since only the master ePWM module need fire an ISR, and a quick check could be made to see if the CMP values for all three ePWM modules needs to be zeroed for a period or two, or doubled/tripled to make up for skipped cycles.

    The method I suggested in the original post however (if it works), does have the advantage of being able to arbitrarily change frequency up and down without needing to keep track of cycles missed.

  • Hi Heat,

    If I learned anything during my years of programing is that never ever optimize your code without specific reason. If you study literature in this field you will see that I am not the first one to learn this, there were many many before me. And if you do want to optimize, first measure what is the main cause of problems (execution time, code size, ...), then optimize only the necessary part.

    It is better to have your code clean and less complex as it easier to maintain. (you'll probably say: yeah but I'll need this code just for a couple of months). Anything you write has a tendency to stay active much longer than you anticipated.

    If you need any references I can give them, but I don't know what is TI policy of posting (and praising) materials that are not published/sponsored by TI.

    Just my 2 cents on the subject.

    Mitja