I'm using an AD7799 to capture Thermocouple input voltages and convert to temperature. I'm running Linux Kernel 3.10 and have the ad7793 driver built in.
When performing successive reads, I'm getting carryover data from one read to the next. For instance, performing cat in_voltage0-voltage0_raw will yield 8388608. After this, I attempt to read in_voltage1-voltage1_raw and obtain the same value from the ADC, despite providing a known voltage input (3.3V) that should max out the differential pair reading.
I have the ADC update rate set at 39Hz. I am using a gain of 1.
Are there any known issues relative to this problem? Or any recommendations to resolve?
I have moved the thread to the Linux and Microcontroller driver community.
What is the value of your Vref? Also, if you try to reduce the voltage on the first channel from 3.3V to something like 1V, do you see any change?
Another thing that you can try is to use a newer version of the driver. At a first look, it seems that a newer version of the driver performs a device reset at setup: https://github.com/analogdevicesinc/linux/blob/master/drivers/iio/adc/ad7793.c#L283
Let us know how it goes.
Vref is 3.3V. I do see changes, and they are values that I would expect to see, when modifying the input voltage. However, it's not always observed on the first read of the channel. Performing successive reads through a C++ program, or even sometimes just through CLI, presents me with this issue of stale data. In the C++ program, I'm reading the inputs with the open(), read(), and close() commands.
I've pulled in the reset function from the current version of the ad_sigma_delta.c code, but that didn't resolve any issues. I can get a valid device ID and complete setup without issue. I also, for a period, attempting pulling in both the ad7793.c and ad_sigma_delta.c / .h into my code any using that in the hopes the issue would resolve. The only function within ad_sigma_delta.c that I needed to switch to prior version due to compile issue was the reinit_completion() function.
My device tree setup for this is as follows. I have reduced the spi-max-frequency to 5000000 from previous tests using 20000000 and 10000000.
compatible = "adi,ad7799";
reg = <0>;
interrupt-parent = <&pioD>;
interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
spi-max-frequency = <5000000>;
This is running on an Atmel (Microchip) SAMA5D3 based system.
I should also note that pioD10, which I'm using as the trigger, is the dout/!drdy pin.
So, the problem is that the result of the first conversion is wrong? Your device tree looks good to me.
We will try to reproduce the problem and come back to you.