AD7173-8 and multiple channel sampling

Hi everyone, I am trying to use AD7173-8 in an application where 3 channels are to be used and I am a little confused about that.

In particular:

  • The AD7173-8 is connected to a microcontroller via SPI. I have configured SPI according to the datasheet and communications are OK. The SPI clock frequency that I am currently using for tests is 2 MHz and I intend to push it further, if necessary. Data read from the ADC are seen on the DOUT/~RDY pin of the ADC.
  • ADC configuration details:
    • Only 3 channels of the ADC are enabled; the rest are disabled on power-up.
    • ADC MODE:SING_CYC bit is set, mode: continuous conversion, delay after channel switch: 0 us
    • IF MODE / DATA STAT: enabled for testing
    • Two setups are used (0 and 1); in setup 0, output is offset binary and in setup 1 output is unipolar.
    • Two filter configurations are used (0 and 1); in FILTCON0, sinc5+sinc1 is used and ODR is 10417 samples/s - in FILTCON1, sinc3 is used and ODR is 20.01 samples/s (this is for sampling a temperature sensor output that does not change fast)
    • External reference (ADR4533, +3.3 V) is used and external buffers (AD8572) are placed between analog voltages and ADC, thus input buffers are disabled; clock is provided by an external crystal at 16 MHz
  • The microcontroller reads the data register of the ADC at regular time intervals (upon overflow of a timer).
  • Having only one channel enabled, everything works OK. I can read data into the microcontroller's registers and they correspond to the known analog voltage values that are present each time. I read 3+1 = 4 bytes (3 with data and 1 with the contents of the STAT register).
  • When I try to enable two channels, I read 2x(3+1) = 8 bytes that correspond to successive readings of the data register. I notice that, when stepping through the microcontroller's code, the first 4 bytes correspond to one of the two ADC channels and the remaining 4 are rubbish (0xFFs); however, the STAT register contents indicate that sometimes one channel is read, sometimes the other.

What I want to do is to have a consistent way of reading all enabled channels of the ADC. The datasheet says about the DOUT/~RDY pin that goes low to indicate that a conversion has been completed. Up to now, when hooking a 'scope to check logic levels on the SPI lines, I cannot see DOUT/~RDY going low right after an SPI transaction; it remains high and then it goes Hi-Z (green trace is ~CS, yellow trace is DOUT/~RDY):

Has anyone a suggestion to move forward? What exactly should I have to do to switch channels fast enough without losing data?

Parents
  • Thank you, Jellenie; I have started trying out the approach you suggested.

    I was intending to use a falling edge external interrupt on MISO (DOUT/~RDY) line as a trigger for SPI transactions. However, that did not work. Instead, careful study of the code presented here revealed that the external interrupt must be triggered when DOUT/~RDY is LOW. This is what I did and I managed to read data from the ADC.

    The following screenshots shows DOUT/~RDY (yellow trace) and DIN (green trace) while having 2 channels activated; SPI clock frequency is 5 MHz:

    A. reading data with ODR=31250 SPS (notice that SING_CYC=1 in my case, therefore the actual sampling rate is 6.2 kHz)

    B. this is what happens before starting sampling - even when I disconnect the ADC from the microcontroller after setup. Notice the pulses on DOUT/~RDY line, each one of apprx. 9 us duration.

    C. Here is an short excerpt from raw data transferred over USB. Again, two channels are activated (CH0 and CH2); data in bold correspond to the contents of the DATA_STAT register and the 3 bytes on the left of each byte in bold are the contents of the corresponding channel (0 or 2), showing that the ADC continuously reads the activated channels in a circular manner.

    ... AE 4E C3 02 B4 55 97 00 AE 4E 8F 02 B4 56 C6 00 AE 4E FB 02 B4 55 93 00 AE 4E EC 02 B4 53 86 00 AE 4E 95 02 B4 51 0B 00 AE 4E C3 02 B4 55 97 00 AE 4E 8F 02 B4 56 C6 00 AE 4E FB 02 B4 55 93 00 AE 4E EC 02 B4 53 86 00 AE 4E 95 02 B4 51 0B 00 ...

    I am currently developing my host PC application where data captured from USB are logged into a text file for further processing.

Reply
  • Thank you, Jellenie; I have started trying out the approach you suggested.

    I was intending to use a falling edge external interrupt on MISO (DOUT/~RDY) line as a trigger for SPI transactions. However, that did not work. Instead, careful study of the code presented here revealed that the external interrupt must be triggered when DOUT/~RDY is LOW. This is what I did and I managed to read data from the ADC.

    The following screenshots shows DOUT/~RDY (yellow trace) and DIN (green trace) while having 2 channels activated; SPI clock frequency is 5 MHz:

    A. reading data with ODR=31250 SPS (notice that SING_CYC=1 in my case, therefore the actual sampling rate is 6.2 kHz)

    B. this is what happens before starting sampling - even when I disconnect the ADC from the microcontroller after setup. Notice the pulses on DOUT/~RDY line, each one of apprx. 9 us duration.

    C. Here is an short excerpt from raw data transferred over USB. Again, two channels are activated (CH0 and CH2); data in bold correspond to the contents of the DATA_STAT register and the 3 bytes on the left of each byte in bold are the contents of the corresponding channel (0 or 2), showing that the ADC continuously reads the activated channels in a circular manner.

    ... AE 4E C3 02 B4 55 97 00 AE 4E 8F 02 B4 56 C6 00 AE 4E FB 02 B4 55 93 00 AE 4E EC 02 B4 53 86 00 AE 4E 95 02 B4 51 0B 00 AE 4E C3 02 B4 55 97 00 AE 4E 8F 02 B4 56 C6 00 AE 4E FB 02 B4 55 93 00 AE 4E EC 02 B4 53 86 00 AE 4E 95 02 B4 51 0B 00 ...

    I am currently developing my host PC application where data captured from USB are logged into a text file for further processing.

Children
No Data