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.

Timer0, SCIA, and SCIB Interrupts

Hello,

My Timer0, SCIA, and SCIB do not work consistanly.  Sometime, the timer worked but not the SCIA nor SCIB receiver, and sometime the receivers of both SCIA and SCIB worked very well but not the timer.  However, all Timer0, SCIA, and SCIB worked very well with the same code.  Would you please take a look at the following code to see if I initilalized and enabled Timer0, SCIA, SCIB correctly?  I basically used the LEDBlink example and added the SCIA and SCIAB initialization codes in.  Thank you very much.

void main(void)
{

//  Step 1. Initialize System Control:
//  PLL, WatchDog, enable Peripheral Clocks
    InitSysCtrl();

//  Step 2. Initalize GPIO:
    InitSciGpio();
   
//  Step 3. Clear all interrupts and initialize PIE vector table:
//  Disable CPU interrupts
    DINT;

//  Initialize PIE control registers to their default state.
    InitPieCtrl();

//  Disable CPU interrupts and clear all CPU interrupt flags:
    IER = 0x0000;
    IFR = 0x0000;

//  Initialize the PIE vector table with pointers to the shell Interrupt
//  Service Routines (ISR).
//  This will populate the entire table, even if the interrupt
    InitPieVectTable();

//  Interrupts that are used in this example are re-mapped to
//  ISR functions found within this file.
    EALLOW; // This is needed to write to EALLOW protected registers
    PieVectTable.SCIRXINTA = &sciaRxFifoIsr;
    PieVectTable.SCIRXINTB = &scibRxFifoIsr;
    PieVectTable.TINT0 = &cpu_timer0_isr;
    EDIS;
   // This is needed to disable write to EALLOW protected registers
 
//  Step 4. Initialize all the Device Peripherals:
    scia_fifo_init();                // Init SCI-A
    scib_fifo_init();                // Init SCI-B
    InitCpuTimers();              // initialize the Cpu Timers

//  Step 5. User specific code, enable interrupts:

    ConfigCpuTimer(&CpuTimer0, 150, 500000);      // 0.5 second timer


// To ensure precise timing, use write-only instructions to write to the entire register. Therefore, if any
// of the configuration bits are changed in ConfigCpuTimer and InitCpuTimers (in DSP2833x_CpuTimers.h), the
// below settings must also be updated.

    CpuTimer0Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0

// Configure GPIO32 as a GPIO output pin
    EALLOW;
    GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0;
    GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1;
    EDIS;

// Enable CPU int1 which is connected to CPU-Timer 0
     IER = 0x101 ; // Enable CPU INT

// Enable TINT0 in the PIE: Group 1 interrupt 7
    PieCtrlRegs.PIEIER1.bit.INTx7 = 1;


//  Enable interrupts required for this example
    PieCtrlRegs.PIECTRL.bit.ENPIE = 1;         // Enable the PIE block
    PieCtrlRegs.PIEIER9.bit.INTx1 = 1;           // PIE Group 9, int1
    PieCtrlRegs.PIEIER9.bit.INTx3 = 1;           // PIE Group 9, INT3


    EINT;
    ERTM;
   // Enable Global realtime interrupt DBGM

//  Step 6. IDLE loop. Just sit and loop forever (optional):
 for(;;){}
}

 

  • Hi,

    I think you posted this in the wrong community. I can't tell from your code what processor this is. Please repost your question in the MSP430, to TMSxxxx or ,,,, community. THis forum is for discrete clock driver and timer only.

    Much thanks, Fritz