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.
I can't seem to access the SPI INT FLAG. I would expect this flag to be a "1" after I send data through the SPI, and I would expect this flag to reset "0" after I read the SPI RX BUFF as per APP Note SPRU059D. Every time I look at the values of these resigeters they remain unchanged. I am able to communicate via the SPI but I can't seem to get the registers to update correctly. My overall goal is to get the SPI to genereate an interrupt to the CPU, but would like to use the flag as a trigger point for some other code. Here is the code that I am using to try and read the SPI INT FLAG. Thanks
interrupt void XINT1_ISR(void)
{
Uint16 spiaflag;
Uint16 rdata;
Uint16 rxovrn;
long i;
// Insert ISR Code here
// To receive more interrupts from this PIE group, acknowledge this interrupt
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
SpiaRegs.SPITXBUF = 0xAA00;
//Wait till rx is complete
while(SpiaRegs.SPIFFRX.bit.RXFFST !=1) { }
rdata = SpiaRegs.SPIRXBUF;
SpiaRegs.SPITXBUF = 0xFA00;
rxovrn = SpiaRegs.SPISTS.bit.OVERRUN_FLAG;
while (count != 5)
{
GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1; // Toggle the pin
for (i = 0; i < 2000000; i++) {}
count++;
}
count = 0;
spiaflag = SpiaRegs.SPISTS.bit.INT_FLAG;
rdata = SpiaRegs.SPIRXBUF;
rxovrn = SpiaRegs.SPISTS.bit.OVERRUN_FLAG;
}
Hi Jorge!
SPI INT flag automaticaly resets when you read from SPIRXBUF.You doread SPIRXBUF reading the SPI INT flag
Be careful the flag also resets when you update watchwindow if you monitor SPIRXBUF. Use SPIRXEMU
Regards, Mitja