Go Down

Topic: Arduino Zero with ADC128D818 [SOLVED] (Read 77 times) previous topic - next topic

androidfanboy

Jun 05, 2018, 05:27 pm Last Edit: Jun 05, 2018, 10:59 pm by androidfanboy
I'm using Arduino Zero with the ADC128D818 ADC I2C expander and using this Arduino library, but I can't seem to get any response from the ADC128.

Some other info:

- I have two 4.7k pullup resistors to pull both SCL and SDA lines to 3.3V
- Address of the ADC128D818 is set to 0x1D by connecting both A0 and A1 to GND
- The ADC128D818 is powered by a 3.3V regulator on the V+ pin, same logic voltage as the Arduino Zero
- I have a precision 3.3V reference on the VREF pin of the ADC128D818
- I probed the 3.3V and reference voltage with a meter, all are OK and nothing's shorted anywhere in the circuit (the Arduino Zero runs code just fine)

Here's the code I'm using to test:

Code: [Select]
#include "Wire.h"
#include "ADC128D818.h" // https://github.com/bryanduxbury/adc128d818_driver

ADC128D818 adc (0x1D);

#if defined(ARDUINO_SAMD_ZERO) && defined(SERIAL_PORT_USBVIRTUAL)
  // Required for Serial on Zero based boards
  #define Serial SERIAL_PORT_USBVIRTUAL
#endif

void setup() {
  while (!Serial);
  Wire.begin();
  Serial.begin(115200);
  Serial.println("*** ADC128D818 Test ***");
  adc.setReferenceMode(EXTERNAL_REF);
//  adc.setReference(2.048);
  adc.setReference(3.3);
  adc.begin();
}

void loop() {
  // IN0-IN6 ...
  for (int i = 0; i < 7; i++) {
    Serial.print(i);
    Serial.print(": ");
    Serial.print(adc.readConverted(i));
    Serial.println();
  }
  // ... and the internal temp sensor
  Serial.print("Temp: ");
  Serial.print(adc.readTemperatureConverted());
  Serial.println(" deg C");

  delay(1000);
}


I looked at the source code in the library and it seems OK. However, I can't even get past the "begin()" function because it never receives a response from the ADC128D818's 0x0C register. I tried on a second ADC128D818 and still the same thing.

Any ideas what I might be doing wrong?

androidfanboy

Wow, I feel stupid, swapped SCL/SDA. Fixed!

Go Up