ADS1235: Using ADS1235 in Single Ended Mode?

Part Number: ADS1235
Other Parts Discussed in Thread: INA228

Tool/software:

Hi

I designed a board for our production testing using an ADS1235 and an INA228. The INA228 part is working ok.

I would like to make some single ended measurements on the two inputs AIN0 and AIN1, AIN2..AIN5 are tied to GND. RefP is my voltage Reference, 3.0 V, AVDD is 5.0 V.

So I configure the registers as follows:

void initADS1235() {
  ADS.SetRegisterValue(MODE0, MODE0_RESET);  //20 SPS, FIR
  ADS.SetRegisterValue(MODE1, MODE1_RESET);  //Chop off, Cont. conversion, 50 uS
  ADS.SetRegisterValue(MODE2, MODE2_RESET);  //No GPIO
  ADS.SetRegisterValue(MODE3, MODE3_RESET);  //Default
  ADS.SetRegisterValue(REF, REF_RESET);      //AVDD First, 5V
  ADS.SetRegisterValue(OFCAL0, OFC0_RESET);
  ADS.SetRegisterValue(OFCAL1, OFC1_RESET);
  ADS.SetRegisterValue(OFCAL2, OFC2_RESET);
  ADS.SetRegisterValue(FSCAL0, FSC0_RESET);
  ADS.SetRegisterValue(FSCAL1, FSC1_RESET);
  ADS.SetRegisterValue(FSCAL2, FSC2_RESET);
  ADS.SetRegisterValue(RESERVED0, RES0_RESET);
  ADS.SetRegisterValue(RESERVED1, RES1_RESET);
  ADS.SetRegisterValue(RESERVED2, RES2_RESET);
  ADS.SetRegisterValue(PGA, PGA_RESET);  //PGA ON, 1.0
  ADS.SetRegisterValue(INPMUX, MUX0_RESET);
  Serial.println("Registers set to default Values");
  //-----
  ADS.SetRegisterValue(PGA, PGA_BYPASS_ON);
  ADS.SetRegisterValue(REF, REF_RMUXP_REFP0 | REF_RMUXN_REFN0);  //Ref in is 3.0 V
  ADS.SetRegisterValue(INPMUX, MUXN_AIN2 | MUXP_AIN0);           //want to measure single ended, AIN2==GND, AIN0, AIN1 signal
}
I have a test voltage on board which I can switch to the inputs 0 and 1, 1.0 V and 2.0 V, respectively.
and then I do a reading. I will always get "0". (insted of 2^23*(1/3) and 2^23*(2/3)
I can read the internal temperature of the ADC with
void test_Thermo()
{
  Serial.println("Temperature");
  ADS.SetRegisterValue(REF, REF_RMUXP_REFP0 | REF_RMUXN_REFN0);
  ADS.SetRegisterValue(REF, REF_RMUXP_AVDD | REF_RMUXN_AVSS);
  ADS.SetRegisterValue(PGA, PGA_RESET);
  uint8_t regData = ();
  ADS.SetRegisterValue(INPMUX, MUXP_TEMP_P | MUXN_TEMP_N);
  float temp_C;
  for (uint8_t i = 1; i < 10; i++) {
    int32_t adcData = ADS.GetConversion();
    /* Convert to temperature (deg C) */
    //   float uVolts = (float) adcData * 0.298023224;
    float uVolts = 0.596046447754 * (float) adcData ;
    Serial.print("uVolts: ");
    Serial.println(uVolts);
    temp_C = 25.0 + ((uVolts - 122400.0) / 420.0);
    Serial.print("Temperature Measurement DEGC ");
    Serial.println(temp_C);
  }
 // return temp_C;
}
and am getting back reasonable values, so my getConversion code is working...
uVolts: 119984.74
Temperature Measurement DEGC 19.25
uVolts: 119986.53
Temperature Measurement DEGC 19.25
bool waitforDRDY() {
  int timeout=millis();
  timeout = millis();
  while (DRDY_state) {
    //Serial.println("Wait for DRDY");
    if(millis()-timeout >10000){
      return 0;
    }
    continue;
  }
  noInterrupts();
  DRDY_state = HIGH;
  interrupts();
  return(1);
}



// function to get a 3byte conversion result from the adc
int32_t ads12xx::GetConversion() {
  int32_t convData=0;
  while(waitforDRDY()==0){  // Wait until DRDY is LOW
    Serial.println("Wait for DRDY Timeout");
  //  return 0;
    };
  SPI.beginTransaction(SPISettings(SPI_SPEED, MSBFIRST, SPI_MODE1));
  digitalWrite(_CS, LOW); //P
 
  SPI.transfer(RDATA); //Issue RDATA
 
  uint8_t numbrx=4;//number of bytes to receive
  //Byte 0: Echo byte, Byte 1: upper Byte, Byte 2: middle Byte, Byte 3: lower Byte
    uint8_t rxb[numbrx];
  for(uint8_t i=0;i<numbrx;i++){
    rxb[i]=SPI.transfer(NOP);
  }

    int32_t upperByte   = ((int32_t) rxb[1] & 0xFF) << 16;
  int32_t middleByte  = ((int32_t) rxb[2] & 0xFF) << 8;
  int32_t lowerByte   = ((int32_t) rxb[3] & 0xFF) << 0;
  int32_t signByte;
  if (rxb[1] & 0x80) {
    signByte = 0xFF000000;
  }
  else                {
    signByte = 0x00000000;
  }
/*
  Serial.println("signByte");
  Serial.println(signByte,HEX);
  Serial.println(signByte | upperByte | middleByte | lowerByte, HEX);
  Serial.println(signByte | upperByte | middleByte | lowerByte, BIN);
  */
  convData= (signByte | upperByte | middleByte | lowerByte);
 
//  delayMicroseconds(1);
  digitalWrite(_CS, HIGH);
  SPI.endTransaction();

  return convData;
}
So I suspect I did not configure a register correctly. Unfortunately a search in ads1235.pdf gives only two results for "single ended"
  ADS.SetRegisterValue(INPMUX, MUXN_AIN2 | MUXP_AIN0);
  ADS.SetRegisterValue(INPMUX, MUXN_AIN2 | MUXP_AIN1);
are the two configurations I would like to get a non-zero result back. Thank you very much for any hint
  • Hi Pio Baettig1,

    Are you able to read back the supply voltages as well as the temperature sensor? Can you provide the data you get from the ADC (not the values you convert, the raw hex values coming out of the device)?

    How are you controlling conversions? Are you using the START pin or the START/STOP commands?

    The ADS1235 is capable of measuring single-ended inputs so that is not an issue. You just need to make sure you have the PGA disabled, which it seems like you do

    Can you also send a schematic of your system?

    -Bryan