AD7176: how to read channels in order

Hi,

I'm trying to access an AD7176 from an AVR32 microcontroller via SPI. I can read and write registers fine, but my problem is, when I read the converted data, the channels seem to appear in random order.

For example, the DAC gave the following output in continuous conversion mode, with DATA_STAT set:

800f1b02

800f1d02

800e6401

800e4a01

800e3701

8008f800

80091f00

800f2902

8008dd00

80091000

800efb02

8008ff00


[UPDATE: If I interpret the data correctly, the most sig. three bytes represent the converted 24 bit value, and the least significant byte is the status register. This indicates a channel sequence of 2, 2, 1, 1, 1, 0, 0, 2, 0, 0, 2, 0. Which means the data is almost useless for my application.]

This example was read with CS rising between each read operation, but keeping CS low didn't make a difference. Register configuration was:

 

GPIOCON: 0

ADCMODE: REF_EN only (0x8000)

IFMODE: DATA_STAT | DOUT_RESET (0x0140)

CHMAP0: EN | AINPOS_AIN1 | AINNEG_AIN0 (0x8020)

CHMAP1: EN | AINPOS_AIN2 | AINNEG_AIN0 (0x8040)

CHMAP2: EN | AINPOS_AIN3 | AINNEG_AIN0 (0x8060)

CHMAP3: AINPOS_AIN1 | AINNEG_AIN0 (0x0020)


Any suggestions?


cheers

Hendrik

  • 0
    •  Analog Employees 
    on Aug 11, 2014 12:38 PM

    Hi Hendrik,

    Let me take a look on this. I'll get back to you with a reply.

    Regards,

    Johnny

  • After further investigation, I can at least partly answer my own question:

    My mistake was that I was trying to impose the microprocessor's timing (using a timer interrupt) onto the AD7176, whereas the AD7176 was using its own master clock to control the channel sequence and conversions. Therefore the result was random.

    I was initially not interested in the chip's filtering capabilities, but I should probably have read that section of the data sheet, too, because that section contains the essential clue. The FILTCON registers allow you to control the output data rate.

    I have now started implementing a different way of accessing the AD7176. I'm now using a GPIO interrupt that triggers on the falling edge of the MISO (alias DOUT/RDY) line. This interrupt then reads the data from the SPI. Still not working 100%, but that's a different issue.

    Hope this helps for anyone who stumbles into the same problems.

    cheers

    Hendrik

    P.S. maybe one could use the SYNC line to work with the microcontroller as the master clock, but I haven't tried this.