Other Parts Discussed in Thread: ADS1298
Hello everyone.
I'm comunicating the TM4C129x with the ADS1298 through SPI, everything was working fine until I had to read a conversion from the ADS.
I'm starting the read when the DRDY is triggered and I realize that everytime in the lecture it comes an extra byte with a value of zero.
I have two functions, one of them send the RDATA (read data command), and the other function reads the values send by the ADS, if I do this then the extra byte appears.
Doing some tests I realize that if I debug the code and stop it in the call to the fuction that reads the data (after the command been send) the data comes without the extra byte, so I guess it was something related to timing so I added a delay and it works, now if I run normally the code I get the read without the extra byte, but why? What I'm doing wrong or what I'm not taking on count?
I saw the SPI data from the ADS on an oscilloscope and it comes without the extra byte so the Tiva is the one of the problem.
This is the sequence of the reading process:
if(bdataReady) { bdataReady = false; SendCommand(RDATA,0,0,NULL,NULL); vReadADSData(ui32ADCReadings); SysCtlDelay(200); SendCommand(START,0,0,NULL,NULL); }
And this is my function that reads from the ADS:
void vReadADSData(uint32_t *ui32ReadData) { /*Clean the Rx FIFO*/ uint32_t ui32FlushFIFO = 0; while(SSIDataGetNonBlocking(SSI2_BASE, &ui32FlushFIFO)); /*Set the value to zero to used as dummy data*/ ui32FlushFIFO = 0; for(uint8_t ui8ReadingIndex = 0; ui8ReadingIndex < BYTES_PER_RDATA + 1; ui8ReadingIndex++, ui32ReadData++) { SSIDataPut(SSI2_BASE, ui32FlushFIFO); SSIDataGet(SSI2_BASE, ui32ReadData); } }
I can't figure it out why this is happening, if you need more info please let me know.
By the way... I can't choose the proper forum, I don't know why, it just appear wireless forums. Please help me to redirect this post to the proper forum.
Thank you.
Regards, Juan.