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.

LAUNCHXL-F28379D: Changing the switching of the ePWM3

Part Number: LAUNCHXL-F28379D

Hello,

I'm having some trouble using the ePWM Module. Here is what I need to do:

When the grid voltage is positive, ePWM3A must be equal to ePWM2A, but with one difference: ePWM3A has to reset a little bit earlier than the ePWM2A. This little time I called "x". Similar has to happen with ePWM3B: it has to be equal to ePWM2B, but reseting earlier (x).

When the grid voltage is negative, the oposite has to happen. ePWM3A sets with ePWM2B, but reset earlier. ePWM3B sets with ePWM2A, but reset earlier.

I have at all ePWMs, some dead time. I call this dead time "TM". I'm not using the deadband module. For this application, it doesn't fit. Both PWM are "up-down count mode". I'm reading the grid voltage with a sensor, in a ADC module.

At any moment, ePWM2A or B changes. It remais unaltered at all times. I'm sending a image to show you guys.

This is how I'm doing:

    if(grid > 0){
         EPwm3Regs.AQCTLA.bit.CAU = 1;       // Reset no CMPA
         EPwm3Regs.AQCTLA.bit.ZRO = 2;       // Set no zero
         EPwm3Regs.AQCTLB.bit.CBD = 1;       // Reset no CMPB
         EPwm3Regs.AQCTLB.bit.PRD = 2;       // Set no PRD
    }
    else if(grid < 0){
         EPwm3Regs.AQCTLB.bit.CAU = 1;       // Reset no CMPA
         EPwm3Regs.AQCTLB.bit.ZRO = 2;       // Set no zero
         EPwm3Regs.AQCTLA.bit.CBD = 1;       // Reset no CMPB
         EPwm3Regs.AQCTLA.bit.PRD = 2;       // Set no PRD
     }

But, I don't know why, it is not changing. I'm putting this settings inside a ADC interruption. When the grid changes polarity, this is what a get:

It's like the code is setting the eight instructions. Both PWM sets at 2 events, and reset at 2 events.

Yellow is ePWM2A, Blue is ePWM2B. Green and Purple is ePWM3A and B.

Can anyone help me? If there is any more details you should know, I can aswer it!

Thanks!

  • I’ll look at this for you.
  • I figure it out! I have to rewrite the previous registers so they can reset when the polarity of the signal changes.

    Here is the correct code:

    if(Grid > 0){
    // Undo previous commands
            EPwm3Regs.AQCTLB.bit.CAU = 1;       // Reset no CMPA
            EPwm3Regs.AQCTLB.bit.ZRO = 1;       // Reset no zero
            EPwm3Regs.AQCTLA.bit.CBD = 1;       // Reset no CMPB
            EPwm3Regs.AQCTLA.bit.PRD = 1;       // Reset no PRD
    // When the grid is positive
            EPwm3Regs.AQCTLA.bit.CAU = 1;       // Reset no CMPA
            EPwm3Regs.AQCTLA.bit.ZRO = 2;       // Set no zero
            EPwm3Regs.AQCTLB.bit.CBD = 1;       // Reset no CMPB
            EPwm3Regs.AQCTLB.bit.PRD = 2;       // Set no PRD
           }
           else if(Grid < 0){
    //  Undo previous commands
            EPwm3Regs.AQCTLA.bit.CAU = 1;       // Reset no CMPA
            EPwm3Regs.AQCTLA.bit.ZRO = 1;       // Reset no zero
            EPwm3Regs.AQCTLB.bit.CBD = 1;       // Reset no CMPB
            EPwm3Regs.AQCTLB.bit.PRD = 1;       // Reset no PRD
    // When the grid is negative
            EPwm3Regs.AQCTLB.bit.CAU = 1;       // Reset no CMPA
            EPwm3Regs.AQCTLB.bit.ZRO = 2;       // Set no zero
            EPwm3Regs.AQCTLA.bit.CBD = 1;       // Reset no CMPB
            EPwm3Regs.AQCTLA.bit.PRD = 2;       // Set no PRD
            }

    And this is what I got: