I am using PIC24HJ to retrieve data from ADS 8330. Manual trigger, Internal OSC clock.
The code is simplified as below trying to single out the problem...
unsigned int SDIData;
unsigned int result;
ADC_SPIBUF = 0x0000; // select channel
while (REG_SPIRBF == 0);
SDIData = REG_SPIBUF; // clear buffer
REG_CONVST = 0; // conversion request, CONVST goes low
while(ADC_EOC == 1); // CONVST back to high after EOC goes low
ADC_CONVST = 1;
while(ADC_EOC == 0); // End of conversion when EOC goes high
REG_SPIBUF = 0xD000; // request to read data
while (REG_SPIRBF == 0); //Receive buffer flag
SDIData = REG_SPIBUF; // read
I cant receive any data (reading is zero). I can read CFR correctly though when send out 0xC000 instead of 0xD000;
1) NO response is observed from SDO while retrieving data
2) EOC pulse width (time when EOC at LOW level) = 800nsec , thus I assume conversion is completed properly?
3) CS pin -- there is only one pulse during conversion. Do I need to generate another one (with a falling edge of CS) to read data? CS seems only controlled by SPI module of PIC24.
Anybody can help? Thank you!