skycoop wrote:So I am the mysterious coworker responsible for the code and the circuit that it is responsible for managing. I actually stumbled across this thread while trying to debug the problem, and it seems like you guys could help me figure out the problem.
The goal of this system is to get the voltage difference between two different photodiodes with relative speed, which is why we have a ADC capable of differential measurements.
I've partway traced back the issue in the code. I was expecting 3 bytes but one of them is completely missing. The only data I have been able to get from the ADC is 0b11000000 and 0b1. According to the datasheet, this would imply that the voltage difference between the diodes is greater than 2.5V, since SIG and MSB are both 1. This makes no sense, because when I measure it with a multimeter, the difference is more on the scale of 200mV (they're sitting flat under a light). On top of that, it's always supposed to send 3 bytes with the last 6 bits being 0's, but I am getting significantly less than 3 bytes with a last bit of 1. I think I might be reading the bits backwards, but I'm not at all sure....
Possible cause EITHER of the Vin pins is greater than FS (or 0.5 for each end as the bias point is 0.5 * Vref), we don't know how you have connected Vref.
Check groundings of all parts including link to the photodiodes as you may have 200mV between them but be floating many volts above the ADC GND.
What power is being used on the ADC? What decouplers do you have on power and Vref (both inputs)?
Vref+ cannot be higher than Vcc and Vref- cannot be lower than GND
Remember that the Pi only accepts 3V3 input levels on I2C and if your device is using 5V do NOT
use any pullups to 5V, the device excepts a high (minimum) to be 0.7 * Vcc if 5V that is 3V5 which is greater than the the Pi will produce so you need a level translater for the I2C. Also check you have no series resistance on the I2C lines as you may not be seeing ACK on I2C during transactions as that has to be BELOW 0V4 at the ADC.
You are probably only getting one byte and not checking errors on each byte as the ACK may not be happening. So ADC aborts the I2C transaction or is actually sittng waiting for I2C transaction to complete.
Your problems seem first of all to be voltage and matching interface levels digital and possibly analog
Without a lot more circuit details and a detailed scope trace of the transaction on I2C that is all I can say without a lot more detail.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading