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.

F28379d complete project example

Other Parts Discussed in Thread: C2000WARE

I am trying to load a project for LAUNCHPAD f28379d but I cannot find any. Where I can find a project for any f28379d processor based card? (Launchpad OR control card )

I used to have the dual_axis_servo_drive_fcl_qep_f2837x, now I'm going to the same path to load it but it's not there! Any help is appreciated. 

  • Hi Ahmad,

    I used to have the dual_axis_servo_drive_fcl_qep_f2837x, now I'm going to the same path to load it but it's not there! Any help is appreciated. 

    Did you import this project from the C2000Ware_MotorControl_SDK? If you couldn't find it, you can download the latest version of the C2000Ware_MotorControl_SDK, then you should be able to import the project again under location "/solutions/boostxl_3phganinv/f2837x". This example is a motor control example based on the F2837x LaunchPad.

    Thanks,

    Jiaxin

  • Thank you for your response.  I finally was able to import it using the resource explorer. I have another issue. I am trying to use that project but replace the main code to what I have for my own purpose. Here is my code that I'm trying to replace with the code in "dual_axis_servo_drive.c"

    #include "F2837xd_Device.h"
    #include "IQmathLib.h"
    #include "math.h"
    extern void InitSysCtrl(void);
    extern void InitPieVectTable(void);
    extern void InitPieCtrl(void);
    interrupt void ePWM1_compare_isr(void);
    //#pragma DATA_SECTION(sine_table,"IQmathTables");
    //_iq30 sine_table[999];
    #define PI 3.14159
    static float Freq = 1;
    static float MI = 0.1;
    static float Angle = 0;
    void main(void)
    {
    InitSysCtrl();
    InitPieCtrl(); // basic setup of PIE table
    InitPieVectTable(); // copy default ISR’s into PIE
    EALLOW;
    PieVectTable.EPWM1_INT = &ePWM1_compare_isr;
    //SysCtrlRegs.WDCR = 0x00AF;
    WdRegs.WDCR.all = 0x00AF;
    GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // ePWM1A
    GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0; // enable pull-up
    GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 1; // ePWM1B
    GpioCtrlRegs.GPAPUD.bit.GPIO1 = 0; // enable pull-up
    EDIS;
    EPwm1Regs.TBCTL.all = 0; // default values
    EPwm1Regs.TBCTL.bit.CLKDIV = 0; // CLKDIV = 1;
    EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0; // HSPCLKDIV = 1
    EPwm1Regs.TBCTL.bit.CTRMODE = 2; // up-down mode
    EPwm1Regs.AQCTLA.all = 0x0006; // ZRO=set; PRD=clear
    EPwm1Regs.AQCTLB.all = 0x0009; // ZRO=clear; PRD=set
    EPwm1Regs.TBPRD = 8000; // 25 kHz PWM frequency
    // TBPRD = fcpu / (2* fpwm * CLKDIV * HSPCLKDIV)
    // TBPRB = 200 MHz / (2 * 25 kHz * 1 * 1)
    EPwm1Regs.CMPA.bit.CMPA = 4000; // initial duty 50 %
    EPwm1Regs.CMPCTL.bit.SHDWAMODE = 0;
    EPwm1Regs.AQCTLA.all = 0x0060; // CMPA up = set; CMPA down = clear
    EPwm1Regs.DBCTL.bit.OUT_MODE = 3;
    EPwm1Regs.DBCTL.bit.POLSEL = 2;
    EPwm1Regs.DBCTL.bit.IN_MODE = 0;
    //EPwm1Regs.DBRED = 344;
    //EPwm1Regs.DBFED = 344;
    // EPwm1_DB_Direction = 1;
    EPwm1Regs.AQCTLB.all = 0x0090; // CMPA up = clear; CMPA down = set
    EPwm1Regs.ETSEL.all = 0;
    EPwm1Regs.ETSEL.bit.INTEN = 1; // enable ePWM1 int
    EPwm1Regs.ETSEL.bit.INTSEL = 5; // 5=CMPA down match, 1=Zero match/Every switching frequency
    EPwm1Regs.ETPS.bit.INTPRD = 1; // 1st event
    PieCtrlRegs.PIEIER3.bit.INTx1 = 1; // ePWM1


    IER |= 4; // enable INT3
    EINT; // global int enable
    while(1)
    {
    EALLOW;
    //SysCtrlRegs.WDKEY = 0x55; // service key #1
    //SysCtrlRegs.WDKEY = 0xAA; // service key #2
    WdRegs.WDKEY.all = 0x55; // service key #1
    WdRegs.WDKEY.all = 0xAA; // service key #2
    EDIS;
    }
    }

    interrupt void ePWM1_compare_isr(void)
    {
    EPwm1Regs.CMPA.bit.CMPA = EPwm1Regs.TBPRD - ((sin(Angle)*MI+1)*0.5)*EPwm1Regs.TBPRD;
    Angle = Angle + Freq/25000*2*PI;
    if (Angle > 2*PI) Angle = Angle - 2*PI;
    EPwm1Regs.ETCLR.bit.INT = 1; // clear ePWM1 interrupt flag
    PieCtrlRegs.PIEACK.all = 4; // ACK for PIE group 3 int
    }

    When I copy this code I get the following errors:

    Could you please help me with this?