I use the AD7156 capacitance to digital converter in a sensor application where I sample a capacitance value at 20 hz.
In my application i use a micro controller to setup the AD7156 via i2c to continuos conversion, 1 pico farad range and the CAPDAC in auto mode on channel 1. For the most part it works very well, I can use the full dynamic range of 13 pico farad of the AD7156, and I can confirm that the auto-DAC feature correctly moves the capacitance offset according to the input.
However, seeming random, the CAPDAC and CDC values get misaligned for just one sample during a transition where the CAPDAC is stepped up or down. I have included a plot that shows a typical example of the problem.
The red graph is the calculated capacitance value in pico farad (basically CAPDAC offset + CDC value). The green graph is the CAPDAC offset, to illustrate the auto-DAC feature works.
The misalignment causes a spike i the calculated capacitance value (marked by a blue *). The brown and turquoise symbols marks where the CDC value gets below zero (0x3000) or above full scale (0xD000). I have used this to confirm that the issue is not that the input changes too rapidly for the auto-DAC to keep up.
So my question: what could be wrong? Have anyone else experienced the same problem?
The AD7156 data sheet states on page 17 that:
The data register is updated after a finished conversion on the capacitive channel, with one exception: when the serial interface read operation from the data register is in progress, the data register is not updated and the new capacitance conversion result is lost.
To avoid messing up the data register during read, my readout sequence for each sample is the following:
1) Poll the AD7156 Status Register (0x00) to check /RDY1 (CDC conversion finished on channel 1)
2) When I get /RDY1, I set Configuration Register (0x0F) to 0x10 Idle-mode to stop any further conversions.
3) Read from CDC Data Register (0x01+0x02) and CAPDAC Ch1 Register (0x11)
4) Set Configuration Register (0x0F) to 0x11 Continuos Conversion-mode on channel 1
Any input or insights are greatly appreciated