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.

TMS320F28035: Is high-resolution control of the PSFB phase possible?



The documentation on the ePWM and HRPWM modules indicate that it is, but I can't get it to go.

The digital power library does not use high-resolution phase control in its example.

The first sign of trouble is that the SFO() call in my initialization routine leaves the HRMSTEP register zeroed and the variable MEP_ScaleFactor set to 0x7FFF.  That's definitely not right.

My init routine looks like this:

#define PWMPERIOD (Uint16)((60000000UL + 100000UL / 2) / 100000UL)

#define DEADBAND 14

void InitializePWM(void)

{

// Initialize ePWM 1 and 2 as above.

EPwm1Regs.TBCTL.all = 0x801B;

EPwm1Regs.TBPRDM.all = (Uint32)(PWMPERIOD - 1) << 16;

EPwm1Regs.TBCTL.bit.PRDLD = 0;

EPwm1Regs.TBPRDM.all = (Uint32)(PWMPERIOD - 1) << 16;

EPwm1Regs.CMPCTL.all = 0x0010;

EPwm1Regs.CMPA.all = (Uint32)(PWMPERIOD / 2) << 16;

EPwm1Regs.CMPCTL.bit.SHDWAMODE = 0;

EPwm1Regs.CMPA.all = (Uint32)(PWMPERIOD / 2) << 16;

EPwm1Regs.AQCTLA.all = 0x0012;

EPwm1Regs.DBRED = DEADBAND;

EPwm1Regs.DBFED = DEADBAND;

EPwm1Regs.DBCTL.all = 0x800B;

EPwm1Regs.ETSEL.all = 0x0009;

EPwm1Regs.ETPS.all = 0x0001;

EPwm2Regs.TBCTL.all = 0x800F;

EPwm2Regs.TBPRDM.all = (Uint32)(PWMPERIOD - 1) << 16;

EPwm2Regs.TBCTL.bit.PRDLD = 0;

EPwm2Regs.TBPRDM.all = (Uint32)(PWMPERIOD - 1) << 16;

EPwm2Regs.TBPHS.all = (Uint32)(PWMPERIOD - 1) << 16;

EPwm2Regs.CMPCTL.all = 0x0010;

EPwm2Regs.CMPA.all = (Uint32)(PWMPERIOD / 2) << 16;

EPwm2Regs.CMPCTL.bit.SHDWAMODE = 0;

EPwm2Regs.CMPA.all = (Uint32)(PWMPERIOD / 2) << 16;

EPwm2Regs.AQCTLA.all = 0x0012;

EPwm2Regs.DBRED = DEADBAND;

EPwm2Regs.DBFED = DEADBAND;

EPwm2Regs.DBCTL.all = 0x800B;

EPwm2Regs.TBCTL.all = 0x8004;

EPwm1Regs.TBCTL.all = 0x8010;

// Apply high-resolution control to the ePWM 2 phase.

EALLOW;

EPwm1Regs.HRCNFG.all = 0x0047;

EPwm1Regs.HRPCTL.all = 0x0001;

EPwm2Regs.HRCNFG.all = 0x0047;

EPwm2Regs.HRPCTL.all = 0x0005;

// Give ePWM 1 and 2 their A and B output pins.

GpioCtrlRegs.GPAMUX1.all =

GpioCtrlRegs.GPAMUX1.all & 0xFFFFFF00UL | 0x00000055UL;

// Set up our 'scope trigger pulse output.

GpioDataRegs.GPBSET.bit.GPIO34 = 1;

GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1;

GpioCtrlRegs.GPBPUD.bit.GPIO34 = 1;

// Start the ePWM system timebase.

SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;

EDIS;

// Do the initial calibration on the HRPWM system.

while (SFO() == SFO_INCOMPLETE);

}

After that, the fractional part of the ePWM 2 phase is completely inoperative.

Am I doing something wrong?  If so, what?  Or do I have to settle for 300-step resolution in the phase here?

Thanks in advance for the help.

  • OK, I found out why the HRPWM was completely inop.  Operator errror.  Clock not applied to HRPWM module.

    But that leaves me with high resolution control of the A output but not of the B output.

    Making the B output the complement of the A output does give me high-resolution control of both, but with no dead time.  Dead time is necessary in a full-bridge, so that's not a solution.

    How does one get high-resolution phase control of the two switches of the right-hand leg of the bridge?

  • Hi William,

    You are correct. On Piccolo devices HRPWM is not available on xB output other than as a complement of xA output with no dead-band. If you cannot add dead-band externally, you will need to use xA output of another PWM module to generate the complementary signal. You can then write appropriate compare register values to this PWM module to correctly generate the dead-band.

    High resolution phase control is possible on these devices.

    I hope this helps.

    - Hrishi

  • Ah!  Didn't think of that.  I'll get right on it.

    Thanks!