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.

TMS320F28377S: issue with the interrupt

Part Number: TMS320F28377S
Other Parts Discussed in Thread: C2000WARE

Dear Experts,

I am trying to initialize timer and system initialisation. I had blinked a GPIO on and Off. However, I couldn't do accomplish the same task with the timer and interrupts and there are no errors though. Kindly see the issues in the code attached. In addition to that, I would like to know whether the program initalised the microcontroller at 200MHz.

#include "F28x_Project.h"

interrupt void timer_ovf_isr(void);

extern void InitSysCtrl(void);



void TimerInit();
void GpioInit();

int a =0;

void main(void)

{
     InitSysCtrl();
     TimerInit();
     GpioInit();
     DINT;
     InitPieCtrl();
     InitPieVectTable();
     EALLOW;


     EALLOW;
     PieVectTable.TIMER0_INT = &timer_ovf_isr;
     EDIS;

     PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
     PieCtrlRegs.PIECTRL.bit.ENPIE = 1;

     IER |= 0x0001;

     EINT;          // Enable Global interrupt INTM
     ERTM;          // Enable Global realtime interrupt DBGM

     CpuTimer0Regs.TCR.bit.TSS = 0;
     while(1)
     {
             //idle
     }

}

void GpioInit(void)
{
     GpioCtrlRegs.GPAGMUX1.bit.GPIO13 = 0;
     GpioCtrlRegs.GPADIR.bit.GPIO13 = 1;
     GpioCtrlRegs.GPADIR.bit.GPIO12 = 1;
}
void TimerInit(void)
{
     CpuTimer0Regs.PRD.bit.LSW = 0x02FF;
     CpuTimer0Regs.PRD.bit.MSW = 0x002F;
     CpuTimer0Regs.TPR.bit.TDDR = 0x001F;
     CpuTimer0Regs.TCR.bit.TIE = 1;
     CpuTimer0Regs.TCR.bit.TRB = 0;
     CpuTimer0Regs.TCR.bit.TSS = 1;
     CpuTimer0Regs.TCR.bit.FREE = 0;
}

void timer_ovf_isr(void)
{

     GpioDataRegs.GPATOGGLE.bit.GPIO13 = 1;
     GpioDataRegs.GPATOGGLE.bit.GPIO12 = 1;
     CpuTimer0Regs.TCR.bit.TIF = 1;
     PieCtrlRegs.PIEIFR1.bit.INTx7 = 0;
     PieCtrlRegs.PIEACK.all = 0x0001;

}

  • Hello Beesetty,

    However, I couldn't do accomplish the same task with the timer and interrupts and there are no errors though.

    How did you verify this? Is the ISR not being hit at all? Did you follow the timed_led_blink_cpu01 example from C2000Ware already? Based on your code it looks like you're using a divide-down value which will increase the length of the timer's period. Please verify you can get the example working first, that way you have a known working starting point.

    In addition to that, I would like to know whether the program initalised the microcontroller at 200MHz.

    By default I believe so, yes.

  • Dear Omer,

    ISR is being called and I comformed by incremening a variable (not shown in this code), but the GPIO toggle is not happening. I did work on a more basic code than provided by C2000ware. The program was just to turn ON and OFF an LED and it worked.

  • ISR is being called and I comformed by incremening a variable (not shown in this code), but the GPIO toggle is not happening. I did work on a more basic code than provided by C2000ware. The program was just to turn ON and OFF an LED and it worked.

    I noticed that you're not reloading your timer (you use CpuTimer0Regs.TCR.bit.TRB = 0;), is this intentional? You should reload it to start it, the C2000Ware example calls a timer config function which does the necessary steps in case you need to compare against something. Please try to use this example modified for your required GPIO pin and verify its functionality. Let me know after you've tested this.