Post Go back to editing

Register values occasionally being shifted


I'm working with an AD7142, which is similar to the AD7147 also.

It's configured to work with 12 stages and 12 inputs, one stage per input, and register 007 is configured to interrupt after stage 11 is complete. At this point I handle the interrupt and read 12 registers for the 12 stages, starting at register address 00B.

The results largely make sense. For testing I have different fixed capacitances connected to the 12 inputs.

But cccasionally, I see results that indicate a set of results are "shifted" to adjacent channels. Meaning a result that clearly fits with input 6 is read out as the result for input 5. When this happens, all of the registers for a particular set of results seem to be "shifted".

The diagram below shows an example: I highlighted extra low values in yellow, and extra high in red. Normally the low values should be channels 27, 29 and 33, and high should be channel 32.

However, in two instances all these are shifted up, so that the result for channel 27 is in channel 26, the result for channel 29 is in channel 28 etc.

Note that I have multiple chips, and the channel numbers map onto CDC inputs.

I don't know where the extra reading for channel 35 comes from, since this represents input 12 for this chip and is the last input we read.

Has anybody seen anything like this before?

I doubt it's corruption while reading the register, because the values clearly make sense, they're just associated with the wrong input, shifted by one.

As background, I am stopping the CDC after the interrupt triggers, before reading the registers. However, I don't stop the CDC immediately, there may be a short delay before the interrupt gets handled.  But still I don't see how that could cause such a shift.

I'm using standard Renesas i2c drivers to communicate with the chip. And I use the auto-increment function to read the 12 registers sequentially, in on i2c transaction.

Any ideas welcome.