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.

ePWM for TMS320F28035

Other Parts Discussed in Thread: TMS320F28035, CONTROLSUITE, TMDSDOCK28035

Hi,

After I read instruction, I have this code


SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
SysCtrlRegs.PCLKCR1.bit.EPWM1ENCLK = 1; // ePWM1
SysCtrlRegs.PCLKCR1.bit.EPWM2ENCLK = 1; // ePWM2

EPwm1Regs.TBPRD = 800; 
EPwm1Regs.TBCTL.bit.CTRMODE = 0x0; 
EPwm1Regs.TBCTL.bit.PRDLD = 0x0; 
EPwm1Regs.CMPA.half.CMPA = 400;
EPwm1Regs.CMPCTL.bit.SHDWAMODE = 0x0;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = 0x0;
EPwm1Regs.CMPCTL.bit.LOADAMODE = 0x0; 
EPwm1Regs.CMPCTL.bit.LOADBMODE = 0x0;
EPwm1Regs.AQCTLA.bit.CAU = 0x2; 
EPwm1Regs.AQCTLA.bit.CAD = 0x1;
EPwm1Regs.DBCTL.bit.OUT_MODE = 0x3;
EPwm1Regs.DBCTL.bit.POLSEL = 0x2;
EPwm1Regs.DBFED = 50; 
EPwm1Regs.DBRED = 50;  

EPwm1Regs.TZSEL.bit.CBC1 = 1;
EPwm1Regs.TZSEL.bit.CBC2 = 1;

EPwm1Regs.TZCTL.bit.TZA = 1;
EPwm1Regs.TZCTL.bit.TZB = 2;

GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1;

But when I use osilloscope to check, I don't see anything

I don't know what I'm wrong or missing

Please help me !

  • Hi,

    It looks like you have configured the PWM counter in up-count mode with this line:

    EPwm1Regs.TBCTL.bit.CTRMODE = 0x0; 

    Since the timer never counts down, the CAD field in the AQCTL register is meaningless.  The CMPA threshold is only crossed when the counter is counting up, and the only action taken is to force the PWM high.  There is nothing to send it low again.

    You could either configure the timer in up-down count, like this

    EPwm1Regs.TBCTL.bit.CTRMODE = 0x2; 

    ...(keep in mind the PWM frequency will drop by a half if you do this), or stay in up-count mode and send the PWM1A pin low on the period match with

    EPwm1Regs.AQCTLA.bit.PRD = 0x1;

    It may help to draw out the waveform and mark on the AQ settings you need.  Something like the attached example (different from yours - just to show the idea).  

    I hope this helps.

    Regards,

    Richard

    Basic PWM Example.pdf

    when the CMPA thresholdThis mean

  • Richard,

    Thanks for showing me what I'm wrong
    I rechecked and I fixed this fault
    It's working

    Regards,
    Duy Anh
  • Hi Duy Anh Le,
    Did you create PWM succeful? This is the first time I work with microcontroller, I need to create PWM by TMS320F28035 as Digital controller for IGBT. Could you help me in this case because I dont have any idea for that now?
  • Nhat,

    Please downloat the controlsuite at www.ti.com/.../controlsuite, and find the example code at location: D:\ti\controlSUITE\device_support\f2803x\v130\DSP2803x_examples_ccsv5\

    Hope this helps you.

    Regards,
    Jack
  • Jack,

    Tks for your suggestion. Indeed, I don't know how to begin my project. I need create simple PWM with frequency equal 32kHz, but i didn't know which type of PWM( epwm_updown_aq or epwm_up_aq,...). My purpose is to create a PWM signal control MOSFET or IGBT like switch. I couldn't find any book or reference about that. So that I stuck with it for a long time. If you have any idea, please share to me.

    Thank you in advances.
    Nhat
  • Hi Nhat,

    Thanks for attending my subject

    I think you have CCS in your computer

    And this is what I did

    First, I download controlSUITE - which contain a lot of example you need to control motor.

    Second, I search example for TMS320F28035's PWM and see watch what it is in. 

    Third, I read the guide and try to understand every single statement

    Finally, I simulate and make it in reality 

    Hope to help you 

    If you have problems, tell me and we can solve it

    Regard,

    Duy Anh

  • Hi Nhat,

    Go ahead to find example code at controlsuite, and you just do some simple changes to meet your requirement. If you just want to have open loop pwm output that frequency and duty are kept the same all the time, I think either of thoese 2 pwm mode could meet your requirement.

    For reference book, you can visit epwm reference guide at www.ti.com/.../spruge9

    Hope this helps you.

    Regards,
    Jack
  • Hi Jack,
    Thanks for your book. I took a whole day to get a basic of PWM. I tried to use CCS to debug my code, but I failed. I bought C2000 with controlcard from TI, however, I didnt get the JTAG emulator. All my problem from connecting between C2000 and CCS. I thought we connect to PC from C2000 through JP2 is all thing we need. Indeed, I've still failed although I got fully driver. Should I need JTAG simulator to connect and implement code form CCS ????.
  • Nhat,

    You can download the latest CCS at processors.wiki.ti.com/.../Download_CCS. CCS7.3 is available now.

    And click on Help -> Install new software -> select 'code generation tool' in Work with: -> expand ti compiler updates -> select c28 compiler tools v6.4.12 -> install it.

    After that, you can import the expample ccs project from controlsuite.

    Regards,
    Jack
  • Nhat,

    After installing ccs7.3 and the c28 compiler tools, you will be able to use JTAG to connect your device.

    Regards,
    Jack
  • Hi Jack,

    Thank for your ideas. I installed it, but I don't have any connection wires. Indeed, I only have the Docking-Stn USB-EMU [R3], control card Tms320F28035 and USB Cable – A Male to B Male.
    1. Did I miss some components to connect Docking-Stn to PC, such as 'usb Jtag emulator'?
    2. Should I buy the Xds 510LC or Xds100v1.0 ? the problem is here, I only have information about 510LC
    Link from amazon here.

    www.amazon.com/.../ref=sr_1_fkmr0_1


    3. Do you know any cheaper connection wire ? I'm doing minor Project in Swinburne University. My budget from uni is 200aud.

    Thanks in advances,

    Nhat
  • Hi Nhat,

    To begin experimenting with the F28035, obtaining the F28035 Experimenter's Kit should be adequate (TMDSDOCK28035).  This kit has a xds100v1 built into the Docking Station baseboard.  You will not require an external emulator.

    I might recommend working through the F28035 Piccolo Workshop.  This TMDSDOCK28035 is used in this workshop.  After going through a few chapters, I think you will be in a better place to evaluate the device.  After the workshop, I'd recommend going back to some of the controlSUITE examples.
    http://processors.wiki.ti.com/index.php/C2000_Archived_Workshops#F28035_Workshops

    Note that this workshop assumes CCS4.x is used, but please note that CCS4-7 are relatively similar.

    Hopefully this helps!


    Thank you,
    Brett