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.

ADS1198: Problem with ADS1198 data extraction while CHnSET=0x01-->for input shorted and other modes

Part Number: ADS1198

Hi,

i created ADS1198 board from schematic given from user manual, I used Arduino to communicate with the device.

I first changed values of GPIO and its working fine, next step i tried to read ADC channels for input shorted. while doing that i get data like this

ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8

FFCB,35E,8000,383,FFFA,24,FFF9,7FFF,
FFCB,353,8000,383,FFFA,24,FFF9,7FFF,
FFCB,35A,8000,375,FFFA,25,FFF9,FFF,
FFCB,356,8000,37B,FFFA,24,FFF9,7FFF,
FFCB,35D,8000,390,FFFA,25,FFF9,7FFF,
FFCC,353,8000,39E,FFFA,24,FFF9,7FFF,
FFCB,34D,8000,391,FFFA,24,FFF9,7FFF,
FFCC,357,8000,3A5,FFFA,25,FFF9,7FFF,
FFCC,355,8000,394,FFFA,25,FFF9,7FFF,
FFCC,35B,8000,39B,FFFA,25,FFF9,7FFF,
FFCB,355,8000,37B,FFFA,24,FFF9,7FFF,
FFCC,350,8000,385,FFFA,25,FFF9,7FFF,
FFCC,358,8000,386,FFFA,25,FFF9,7FFF,
FFCC,34C,8000,397,FFFA,24,FFF9,7FFF,
FFCC,366,8000,370,FFFA,25,FFF9,7FFF,
FFCC,355,8000,394,FFFA,25,FFF9,7FFF,
FFCC,357,8000,388,FFFA,25,FFF9,7FFF,
FFCC,35A,8000,389,FFFA,25,FFF9,7FFF,
FFCB,354,8000,37D,FFFA,25,FFF9,7FFF,

when I read those chnset registers i get 0x11

can some one help me please...

#include <SPI.h>
//Sensor's memory register addresses:
const byte WAKEUP = 0x02; 
const byte STANDBY = 0x20; 
const byte RESET = 0x21; 
const byte SDATAC=0x11; 
const byte START=0x08;
const byte STOP=0x0A;
const byte RADATA=0x12;
const byte RADATAC=0x10;
// pins used for the connection with the sensor
// the other you need are controlled by the SPI library):
const int chipSelectPin = 10;
const int rset = 8;
const int start = 7;
const int drdy = 2;       // data ready 
unsigned int dat[8]={0};
byte hi=0;
byte mid=0;
byte lo=0;
byte ch=8;     //to use 8 channels
void setup() {
Serial.begin(2000000);
// start the SPI library:
SPI.begin();
SPI.setClockDivider(SPI_CLOCK_DIV2);
SPI.beginTransaction(SPISettings(2000000,MSBFIRST, SPI_MODE1));
// initalize the data ready and chip select pins:
pinMode(chipSelectPin, OUTPUT);
pinMode(rset, OUTPUT);
pinMode(start, OUTPUT);
pinMode(drdy, INPUT);


digitalWrite(rset, LOW);
delay(100);
digitalWrite(rset, HIGH);
digitalWrite(start, HIGH);

digitalWrite(chipSelectPin, LOW);
delay(100);
SPI.transfer(WAKEUP);
delay(100);
SPI.transfer(SDATAC);
delay(100);
SPI.transfer(STOP);
delay(100);
digitalWrite(chipSelectPin, HIGH);
digitalWrite(chipSelectPin, LOW);
delay(100);
SPI.transfer(0x43);//CONFIG3 for 2.4v internal ref
SPI.transfer(0x00);
SPI.transfer(0xC0);
delay(100);
SPI.transfer(0x41);//CONFIG1 for clock o/p enable
SPI.transfer(0x00);
SPI.transfer(0x24);
delay(100);
SPI.transfer(0x42);//CONFIG2 for enable I/P short signal
SPI.transfer(0x00);
SPI.transfer(0x30);
delay(100);
byte ch=8; 
SPI.transfer(0x45);//CHnSET for test signal, Ch=no of channel used
SPI.transfer(0x0|ch-1);
for(int i=0;i<ch;i++)
SPI.transfer(0x11);
delay(100);
SPI.transfer(START);
digitalWrite(chipSelectPin, HIGH);


digitalWrite(start, LOW);
delay(100);
digitalWrite(start, HIGH);
delay(100);
digitalWrite(chipSelectPin, LOW);
SPI.transfer(RADATAC);

}
void loop() {
while(digitalRead(drdy));
while(!digitalRead(drdy));

hi=SPI.transfer(0);
mid=SPI.transfer(0);
lo=SPI.transfer(0);
unsigned long stat=hi<<16|mid<<8|lo;

for (int i=0;i<8;i++)
{ 
hi=SPI.transfer(0);
lo=SPI.transfer(0); 
dat[i]=hi<<8|lo;

}

// Serial.print(stat,HEX);
for (int i=0;i<8;i++)
{ 
Serial.print(dat[i],HEX);
Serial.print(',');

}
Serial.print('\n');
}

Regards

Abiraman.S

  • Hello Abiraman,

    Welcome to our forum and thank you for your post!

    I've removed your code from the original post and attached it in a text file so the thread is easier to read. Here are a few comments regarding your start-up routine:

    1. Your op-code settings for STANDBY and RESET are incorrect. Please review Table 9.
    2. You do not need to send the WAKEUP command at start-up. The device will power-up in normal operation. A simple /RESET pulse on the reset pin is all that's needed to initialize the device (see pages 65 - 66).
    3. You do not need to send the STOP command. Registers can still be written while the device is converting.
    4. The Read and Write function calls are using too many bytes. The correct command for writing to the CONFIG3 register (lines 51 - 53) would be: 0x43 0xC0. Please review the WREG and RREG sections on page 38.

    After you write to all the registers, please read them back to verify that they were written correctly.


    Best Regards,

  • dear Ryan Andrews,

                Thank you for the help, I made the changes as you told it started working fine.but while reading data some time the data seems to be corrupted. I don't know why its happening , I think it might be in sync between ADS1198 and to the controller. 

    Regards 

     Abiraman.S

  • Hi Abiraman,

    I'm glad the suggestions worked for you!

    The data corruption is likely related to the timing between the ADC and your microcontroller. The microcontroller should sense the falling edge of /DRDY as an interrupt. This should trigger an interrupt service routine that enables the interface, reads the data, and disables the interface before the next /DRDY falling edge.

    The easiest way to confirm this issue is to probe your SPI lines (at least /CS, SCLK, and DOUT) and probe /DRDY at the same time. If you notice that /DRDY returns low while you are still reading data, the old data will be overwritten with new data immediately.


    Best Regards,