Part Number: ADS1248
Hello.
I'm using a pic24EP64GP206 to controll the adc over spi.
After some work and validation, spi seems work fine, but never getting a data ready from the adc, i just tryed all i getting nothing.
Here is a photo from my SPI (just sending 0xAA to make sure it's well configured)
And here is my code for configuration and data aquisition. (there is no CS signal in the code, but by hardware is fixed low)
void InicializaADC(){
DELAYADC(10); //Delay 10ns
SPI1_send(0b00000110); //Send reset
DELAYADC(600); //Delay 0.6ms
//SPI1_send(0b00000000); //Send WakeUp
SPI1_send(0x16); //Send SDATAC
DELAYADC(600); //Delay 0.6ms
//SPI1_send(0b00010100); //Send RDATAC
//Send WREG
SPI1_send(0x43); //write to SYS0 to change SPS
SPI1_send(0x00);
SPI1_send(0x52);
SPI1_send(0x42); //write to MUX1 to set up internal reference
SPI1_send(0x00);
SPI1_send(0x30);
SPI1_send(0x40); //write to MUX0 register to change channels
SPI1_send(0x00);
SPI1_send(0x01); //+AIN0, -AIN1
//SPI1_send(0x13); //+AIN2, -AIN3
//SPI1_send(0x25); //+AIN4, -AIN5
//SPI1_send(0x37); //+AIN6, -AIN7
SPI1_send(0x04); //Send SYNC
SPI1_send(0x04);
DELAYADC(2); //Delay 6ms
SPI1_send(0x14); //Send RDATAC
}
ulong getADCSample(){
FastTriggerSet(&timeoutADC,200000); //timeout 200ms
while(DREADY_ADC){ //wait until data ready or timeout
if( FastTriggerActivado(&timeoutADC) )
return 99999;
}
DELAYADC(20); //Delay tcssc
SPI1_send(0x12); //Send RDATA
SPI1_send(0xFF); //Send NOP x3
SPI1_send(0xFF);
SPI1_send(0xFF);
DELAYADC(2); //Delay tsccs
return SPI1_recive();
}
