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.

TMS320F28069M: ePWM Generation

Part Number: TMS320F28069M
Other Parts Discussed in Thread: C2000WARE

Hello Everyone,

I am trying to generate PWM signals for the SDI(Software Defined Inverter) TAPAS Board , I am unable to generate the PWM Signals,

but I am able to control GPIO Pins .

Please help me ASAP.

Thank you!

  • Hi,

     

    Our expert will get back ASAP.

     

    Thanks,

    Saravanan

  • Hi Ayush,

    I am unable to generate the PWM Signals,

    Are you using one of the software examples provided within our software development kit (C2000Ware SDK)?

    C:\ti\c2000\C2000Ware_version\device_support\f2806x\examples\c28

    If not, can you please try one of the epwm examples and see if with that you are able to generate a PWM output?

    Best Regards,

    Marlyn

  • Hello sir,

    I am using the code from there only,

    Please see my code..

    Please correct me if i am wrong somewhere..


    #include "DSP28x_Project.h" // Device Headerfile and Examples Include File

    //
    // Function Prototypes
    //
    void InitEPwm5Example(void);
    __interrupt void epwm5_isr(void);
    Uint32 EPwm5TimerIntCount;
    Uint16 EPwm5_DB_Direction;
    //
    // Main
    //
    void main(void)
    {
    //
    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the F2806x_SysCtrl.c file.
    //
    InitSysCtrl();

    //
    // Step 2. Initalize GPIO:
    // This example function is found in the F2806x_Gpio.c file and
    // illustrates how to set the GPIO to it's default state.
    IER = 0x0000;
    IFR = 0x0000;

    // InitGpio(); // Skipped for this example

    //
    // For this case just init GPIO pins for ePWM1, ePWM2, ePWM3
    // These functions are in the F2806x_EPwm.c file
    //
    InitEPwm5Gpio();

    //
    // Step 3. Clear all interrupts and initialize PIE vector table:
    // Disable CPU interrupts
    //
    DINT;

    InitPieVectTable();

    EALLOW;
    SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
    EDIS;

    InitEPwm5Example();


    EALLOW;
    SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
    GpioCtrlRegs.GPBMUX1.bit.GPIO39 = 0;
    GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0;
    GpioCtrlRegs.GPBDIR.bit.GPIO39 = 1;
    GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1;
    GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 0;
    GpioCtrlRegs.GPADIR.bit.GPIO16 = 1;
    EDIS;


    GpioDataRegs.GPBDAT.bit.GPIO34 = 0;
    GpioDataRegs.GPBDAT.bit.GPIO39 = 0;
    GpioDataRegs.GPADAT.bit.GPIO16 = 1;
    //
    // Step 6. IDLE loop. Just sit and loop forever (optional)
    //
    for(;;)
    {
    __asm(" NOP");
    }
    }

    //
    // InitEPwm5Example -
    //
    void
    InitEPwm5Example()
    {
    EPwm5Regs.TBPRD = 22500; // Set timer period
    EPwm5Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
    EPwm5Regs.TBCTR = 0x0000; // Clear counter

    //
    // Setup TBCLK
    //
    EPwm5Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP; // Count up
    EPwm5Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
    EPwm5Regs.TBCTL.bit.HSPCLKDIV = TB_DIV4; // Clock ratio to SYSCLKOUT
    EPwm5Regs.TBCTL.bit.CLKDIV = TB_DIV2;

    EPwm5Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; // Load registers every ZERO
    EPwm5Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
    EPwm5Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
    EPwm5Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;

    //
    // Setup compare
    //
    EPwm5Regs.CMPA.half.CMPA = 11250;

    //
    // Set actions
    //
    EPwm5Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on CAU
    EPwm5Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on CAD

    EPwm5Regs.AQCTLB.bit.CAU = AQ_CLEAR; // Clear PWM1B on CAU
    EPwm5Regs.AQCTLB.bit.CAD = AQ_SET; // Set PWM1B on CAD

    //
    // Active Low PWMs - Setup Deadband
    //
    EPwm5Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE;
    EPwm5Regs.DBCTL.bit.POLSEL = DB_ACTV_LO;
    EPwm5Regs.DBCTL.bit.IN_MODE = DBA_ALL;
    EPwm5Regs.DBRED = 200;
    EPwm5Regs.DBFED = 200;

    }

    Thank you

    //
    // End of File
    //

  • Hi Ayush,

    What example is this? and what pins are you probing on the launchpad?

    Best Regards,

    Marlyn

  • Hello Sir,

    It is f2806x_EPWM_deadband example from C2000ware,

    I am directly probing on the pin no. 54 of microcontroller of the TAPAS Board.

    Thank You

  • Ayush,

    I am unaware of the TAPAS board, and cannot help support this board.

    Do you have access to the signals from the F2806x device? 

    Best Regards,

    Marlyn