Hi,
My requirement is to read sequence of bytes (01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F) via SCI A port using interrupt.
So I configured the SCIA for interrupt. When I tried to send the above sequence of data from PC, 1 Rx interrupt is received, but i could able to read only the 4 bytes of data and rest is discarded. Please help me to read all the data received via Rx
Please refer my code sniffet below:
void scia_fifo_init()
{
SciaRegs.SCICCR.all =0x0007;
SciaRegs.SCICTL1.all =0x0003;
SciaRegs.SCICTL2.bit.TXINTENA =0;
SciaRegs.SCICTL2.bit.RXBKINTENA =1;
SciaRegs.SCIHBAUD = 0x0000;
SciaRegs.SCILBAUD = 0x0040; //SCI_PRD;
SciaRegs.SCICCR.bit.LOOPBKENA =0; // Enable loop back
// SCI FIFO initiate
SciaRegs.SCIFFTX.all = 0xc000;
SciaRegs.SCIFFRX.all = 0x0028;
SciaRegs.SCIPRI.all = 0x0010;
SciaRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
SciaRegs.SCICTL1.bit.RXERRINTENA = 1;
SciaRegs.SCIFFTX.bit.TXFIFOXRESET=1;
SciaRegs.SCIFFRX.bit.RXFIFORESET=1;
}
interrupt void sciaRxFifoIsr(void)
{
volatile int data;
byte Rec_data[20];
int i=0,j=0;
while(SciaRegs.SCIFFRX.bit.RXFFST != 0)
{
Rec_data[i] = SciaRegs.SCIRXBUF.all; // Read data
i++;
}
for(j=0;j<i;j++)
{
printf("data is %x\n",Rec_data[j]);
}
SciaRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
SciaRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ack
}