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.

ADS8688 with Arduino DUE

Other Parts Discussed in Thread: ADS8688

Hi,


I am using ADS8688 with my arduino due, if i set channels 0-3 to gnd i get
this as answear, but i expect something about  32768.

CH0: 64
CH1: 64000
CH2: 0
CH3: 256
 
CH0: 192
CH1: 63904
CH2: 32
CH3: 64
 
CH0: 0
CH1: 63520
CH2: 752
CH3: 63552

my setup an code is.

RST/PD -> 3V3

REFSEL -> GND

AVVD -> 5V

DVDD -> 3V3

daisy - > GND

REFGND - > GND

my code is:

#include "SPI.h"    

#define CS         49

int result0;  
int result1;
int result2;
int result3;

void setup() {

pinMode(CS, OUTPUT);          // Chip Select als Output
digitalWrite(CS, HIGH);       // CS High
SPI.begin();                  // SPI start
SPI.setDataMode(SPI_MODE1);   // SPI Mode 1
SPI.setBitOrder(MSBFIRST);  
Serial.begin(9600);           

digitalWrite(CS,LOW);
SPI.transfer16(0x8500);     // device Reset
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0xA000);    // Auto Channel with Reset
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0x010F);     // channel 0-3 enable
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0x02F0);     //Channel 4-7 Power Down
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0x0300);     // SDO Output format MSB first
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0x0501);  // Vref Channel0 +- 1.25 * 4.096
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0x0601);  // Vref Channel1 +- 1.25 * 4.096
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0x0701);  // Vref Channel2 +- 1.25 * 4.096
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0x0801);  // Vref Channel3 +- 1.25 * 4.096  
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0xA000);              // start sampling
digitalWrite(CS,HIGH);
}

void loop() {

digitalWrite(CS,LOW);
SPI.transfer16(0x0000);              // start sampling
result0 = SPI.transfer16(0x0000);    // Channel 0 Data
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0x0000);              // start sampling  
result1 = SPI.transfer16(0x0000);    // Channel 1 Data
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0x0000);              // start sampling  
result2 = SPI.transfer16(0x0000);    // Channel 2 Data
digitalWrite(CS,HIGH);
digitalWrite(CS,LOW);
SPI.transfer16(0x0000);              // start sampling  
result3 = SPI.transfer16(0x0000);    // Channel 3 Data
digitalWrite(CS,HIGH);


Serial.print("CH0: ");
Serial.println(result0);
Serial.print("CH1: ");
Serial.println(result1);
Serial.print("CH2: ");
Serial.println(result2);
Serial.print("CH3: ");
Serial.println(result3);
Serial.println(" ");

delay(1000);

}

I do not know whether the device is defect or my code is wrong

Thanks

  • Hi Schubbi,

    Thanks for choosing ADS8688.

    There are some problems with your code (I assume that your hardware circuit is correct):

    Your all programming to the program registers are not correct and successful:

    1.  All BIT 8 for register programming are missed. For example, when programming Auto_SEQ_EN register to enable CH 0~3, 0x030F should be sent out, not 0x010F you are sending. Please check table 9 and 7 in ADS8688’s datasheet.

    2. When programming the program registers, it needs 24 SCLKs to finish the register writing, not 16 SCLKs you are using. Please refer to Figure 88.

    To retrieve the data, 32 SCLKs are necessary, not 16 SCLKs you are using, please refer to Figure 1 and 72.

    I copied them from datasheet and highlight them here.

    Please let me know if you have more questions. Thanks.