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.

F2812 simulator



I am working on F2812 simulator for PWM generation.

I have used IQsin and IQcos but they are showing zero values. Also, values at 0x3FF000 are zeros.

I thought that might be because of limitation of simulator. But when i load program it is not calculating either. 

Also, interrupt is not being executed. Can anyone help me get out of it.?

 

------------

Tapan 

  • Trivedi,

    0x3FF000 happens to be BOOT ROM address. You should be able to see the contents of BOOT ROM when you connect to the device. Do you mean to say you see all 0x0000's in the BOOT ROM contents.

    Also, did you load your program in ROM (or) flash? Did you make sure device was unlocked when you made an attempt to program?

    Regards,

    Manoj

  • I have loaded program in the Flash... and yes the device was unlocked.

    But neither interrupt is being executed nor Boot ROM results are accessible. 

    Before accessing IQsin and IQcos Enableinterrutps(); functions was called. Is there any criteria for making ENPIE bit zero before accessing BootROM?

     

    Also, there is difficulty in executing interrupts. Is that due to limitation of Simulator?

  • Tapan,

    Are you performing all the above functions in a real device (or) in simulator?

    Regards,

    Manoj

  • F2812 device simulator...................

    and the real difficulty is first interrupt is serviced after 40 sec. or so an subsequently it works successfully.

  • I have been trying to execute following program for Space vector PWM  in F2812 simulator and i am getting desired output as well.

    But, first interrupt is received aftere 40 sec. or so, and subsequently it executes very well.

    Can any one suggest me changes? Is there problem with F2812 simulator.... ?

     

    #include "DSP281x_Device.h"

    #include "DSP281x_Examples.h"

    #include <math.h>

     

    void svpwmgenev(void);

    interrupt void svpwmgen(void);

     

     

    #define isqrt3 0.57733

    #define fbase 0.8

    #define PI3 1.0472

    #define dthetamax 0.1571

    #define Vref 0.8

     

    double dtheta,theta,thetaold,thetanew;

     

    Uint16 sector_id,i;

     

    double Valpha,Vbeta,Ta,Tb,t1,t2,t3;

     

    Uint16 ta,tb,tc,comp1,comp2,comp3,tas,tbs,tcs;

     

     

    void main(void)

    {

     

    InitSysCtrl();

    EALLOW;

       // Enable PWM pins

        GpioMuxRegs.GPAMUX.all = 0x00FF; // EVA PWM 1-6  pins    

    GpioMuxRegs.GPBMUX.all = 0x00FF; // PWM 7-12 pins

        EDIS;

    DINT;

    InitPieCtrl();

     

    IER = 0x0000;

        IFR = 0x0000;

     

    InitPieVectTable();

    EALLOW;

        PieVectTable.T1UFINT = &svpwmgen;// Hook interrupt to the ISR

        EDIS;

    PieCtrlRegs.PIEIER2.all = M_INT6;

    EnableInterrupts();

    IER |= M_INT2;

     

    EINT;

    svpwmgenev();

    for(;;);

    }

     

    void svpwmgenev(void)

    {

    EvaRegs.EVAIMRA.bit.T1UFINT = 1;

        EvaRegs.EVAIFRA.bit.T1UFINT = 1;

    EvaRegs.GPTCONA.all = 0;

    EvaRegs.GPTCONA.bit.TCMPOE = 1;

     

    EvaRegs.T1PR = 0x493E;

    EvaRegs.T1CMPR = (18750 - comp1);

    EvaRegs.T1CNT = 0x0000;

    EvaRegs.T1CON.all = 0x0942;

    EvaRegs.CMPR1 =  comp1;

    EvaRegs.CMPR2 =  comp2;

    EvaRegs.CMPR3 =  comp3;

     

    EvaRegs.ACTRA.all = 0x0666;

    EvaRegs.DBTCONA.all = 0x0000;

    EvaRegs.COMCONA.all = 0x8200;

    //Enable T1PINT from Event manager registers

    }

     

     

    interrupt void svpwmgen(void)

    {

    svpwmgenev();

     

    ..................................................

    ..................................................

     

      // To receive more interrupts from this PIE group, acknowledge this interrupt 

        PieCtrlRegs.PIEACK.all = PIEACK_GROUP2;

    }

     

     

     

  •  

    I have been trying to execute following program for Space vector PWM  in F2812 simulator and i am getting desired output as well.

    But, first interrupt is received aftere 40 sec. or so, and subsequently it executes very well.

    Can any one suggest me changes? Is there problem with F2812 simulator.... ?

     

    #include "DSP281x_Device.h"

    #include "DSP281x_Examples.h"

    #include <math.h>

     

    void svpwmgenev(void);

    interrupt void svpwmgen(void);

     

     

    #define isqrt3 0.57733

    #define fbase 0.8

    #define PI3 1.0472

    #define dthetamax 0.1571

    #define Vref 0.8

     

    double dtheta,theta,thetaold,thetanew;

     

    Uint16 sector_id,i;

     

    double Valpha,Vbeta,Ta,Tb,t1,t2,t3;

     

    Uint16 ta,tb,tc,comp1,comp2,comp3,tas,tbs,tcs;

     

     

    void main(void)

    {

     

    InitSysCtrl();

    EALLOW;

       // Enable PWM pins

        GpioMuxRegs.GPAMUX.all = 0x00FF; // EVA PWM 1-6  pins    

    GpioMuxRegs.GPBMUX.all = 0x00FF; // PWM 7-12 pins

        EDIS;

    DINT;

    InitPieCtrl();

     

    IER = 0x0000;

        IFR = 0x0000;

     

    InitPieVectTable();

    EALLOW;

        PieVectTable.T1UFINT = &svpwmgen;// Hook interrupt to the ISR

        EDIS;

    PieCtrlRegs.PIEIER2.all = M_INT6;

    EnableInterrupts();

    IER |= M_INT2;

     

    EINT;

    svpwmgenev();

    for(;;);

    }

     

    void svpwmgenev(void)

    {

    EvaRegs.EVAIMRA.bit.T1UFINT = 1;

        EvaRegs.EVAIFRA.bit.T1UFINT = 1;

    EvaRegs.GPTCONA.all = 0;

    EvaRegs.GPTCONA.bit.TCMPOE = 1;

     

    EvaRegs.T1PR = 0x493E;

    EvaRegs.T1CMPR = (18750 - comp1);

    EvaRegs.T1CNT = 0x0000;

    EvaRegs.T1CON.all = 0x0942;

    EvaRegs.CMPR1 =  comp1;

    EvaRegs.CMPR2 =  comp2;

    EvaRegs.CMPR3 =  comp3;

     

    EvaRegs.ACTRA.all = 0x0666;

    EvaRegs.DBTCONA.all = 0x0000;

    EvaRegs.COMCONA.all = 0x8200;

     

    }

     

     

    interrupt void svpwmgen(void)

    {

    svpwmgenev();

     

    ..................................................

    ..................................................

     

      // To receive more interrupts from this PIE group, acknowledge this interrupt 

        PieCtrlRegs.PIEACK.all = PIEACK_GROUP2;

    }