Hi,
I import UART interrupt loopback example based on SCI-A . It is working OK. I convert into SCI-C. when data is received, it is not reached at the interrupt vector.
I set interrupt group for SCI-C:
PieCtrlRegs.PIEIER8.bit.INTx5=1;
PieCtrlRegs.PIEIER8.bit.INTx6= 1;
my code as below. please help me.
Kind Regards-
Sudip
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
#define CPU_FREQ 60E6
#define LSPCLK_FREQ (CPU_FREQ/4)
#define SCI_FREQ 100E3
#define SCI_PRD ((LSPCLK_FREQ/(SCI_FREQ*8))-1)
// Prototype statements for functions found within this file.
interrupt void scicTxFifoIsr(void);
interrupt void scicRxFifoIsr(void);
// Global variables
Uint16 sdataA[2]; // Send data for SCI-A
Uint16 rdataA[2]; // Received data for SCI-A
Uint16 rdata_pointA; // Used for checking the received data
void main(void)
{
Uint16 i;
InitSysCtrl();
EALLOW;
GpioCtrlRegs.GPBPUD.bit.GPIO39 = 0; // Enable pull-up for GPIO39 (SCIRXDC)
GpioCtrlRegs.GPBPUD.bit.GPIO42 = 0; // Enable pull-up for GPIO42 (SCITXDC)
GpioCtrlRegs.GPBQSEL1.bit.GPIO39 = 3; // Asynch input GPIO39 (SCIRXDC)
GpioCtrlRegs.GPBMUX1.bit.GPIO39 = 2; // Configure GPIO39 for SCIRXDC
GpioCtrlRegs.GPBMUX1.bit.GPIO42 = 2; // Configure GPIO42 for SCITXDC
EDIS;
DINT;
InitPieCtrl();
InitPieVectTable();
IER = 0x0000;
IFR = 0x0000;
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.SCIRXINTC = &scicRxFifoIsr;
PieVectTable.SCITXINTC = &scicTxFifoIsr;
EDIS; // This is needed to disable write to EALLOW protected registers
ScicRegs.SCICTL1.all = 0x0023; // Relinquish SCI from Reset
ScicRegs.SCICTL2.bit.TXINTENA = 1;
ScicRegs.SCICTL2.bit.RXBKINTENA = 1;
ScicRegs.SCICCR.all = 0x0007;
ScicRegs.SCICCR.bit.LOOPBKENA =0; // 1; // Enable loop back
ScicRegs.SCILBAUD=0x00C2;
ScicRegs.SCIFFRX.all = 0x0022;
ScicRegs.SCIFFRX.bit.RXFIFORESET = 1;
ScicRegs.SCIFFRX.bit.RXFFIENA=1;
ScicRegs.SCIFFCT.all = 0x00;
ScicRegs.SCIFFTX.all = 0xC022;
ScicRegs.SCIFFTX.bit.TXFIFOXRESET = 1;
////////////////////////////////////////////
for(i = 0; i<2; i++)
{
sdataA[i] = i;
}
rdata_pointA = sdataA[0];
//
// 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.INTx2= 1; // PIE Group 9, INT2
PieCtrlRegs.PIEIER8.bit.INTx5=1;
PieCtrlRegs.PIEIER8.bit.INTx6= 1;
IER = 0x100; // Enable CPU INT
EINT;
//
// Step 6. IDLE loop. Just sit and loop forever (optional):
//
for(;;)
{
}
}
void error(void)
{
asm(" ESTOP0"); // Test failed!! Stop!
for (;;);
}
interrupt void scicTxFifoIsr(void)
{
Uint16 i;
for(i= 0; i < 2; i++)
{
ScicRegs.SCITXBUF = sdataA[i]; // Send data
}
for(i= 0; i < 2; i++) //Increment send data for next cycle
{
sdataA[i] = (sdataA[i]+1) & 0x00FF;
}
ScicRegs.SCIFFTX.bit.TXFFINTCLR = 1; // Clear SCI Interrupt flag
PieCtrlRegs.PIEACK.all |= 0x100; // Issue PIE ACK
}
interrupt void scicRxFifoIsr(void)
{
Uint16 i;
for(i = 0; i < 2; i++)
{
rdataA[i] = ScicRegs.SCIRXBUF.all; // Read data
}
for(i = 0; i < 2; i++) // Check received data
{
if(rdataA[i] != ((rdata_pointA+i) & 0x00FF)) error();
}
rdata_pointA = (rdata_pointA+1) & 0x00FF;
ScicRegs.SCIFFRX.bit.RXFFOVRCLR = 1; // Clear Overflow flag
ScicRegs.SCIFFRX.bit.RXFFINTCLR = 1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all |= 0x100; // Issue PIE ack
}