0
\$\begingroup\$

I want to interface a dual-channel ADC (Analog Devices AD4632-16) with an Arduino that offers integrated wireless communication capabilities, such as Bluetooth, BLE, or Wi-Fi. I'm encountering a challenge because the ADC features two channels, each requiring a separate SDO line for data output, while most Arduino models only have one SPI port.

Does anyone have suggestions on how to manage the connections or know of any Arduino models that come with wireless communication and can handle multiple SPI lines? Any advice or recommendations would be greatly appreciated!

Thank you!

\$\endgroup\$
1
  • \$\begingroup\$ "the ADC features two channels, each requiring a separate SDO line for data output" - no it doesn't. Other options are to change the ADC. But asking what to buy is off-topic. \$\endgroup\$
    – Justme
    Commented Apr 24 at 19:59

2 Answers 2

1
\$\begingroup\$

You can configure the "Interleaved Lane Output Data Clocking Mode" as documented in the "Serial Interface Mode" (page 31).

In the Arduino software you have to separate the two ADC values bit per bit e.g. like this pseudo code does:

uint8_t  spi_data[4]; // filled by SPI read operation, MSB first
uint32_t data_in;     // combined spi bytes
uint16_t value_a;     // decoded ADC channel A
uint16_t value_b;     // decoded ADC channel B

// convert big endian data to 32 bit number
data_in = 0;
for (int i = 0; i < 4; i++) {
    data_in <<= 8;
    data_in |= spi_data[i];
}

// split interleaved bit data
value_a = 0;
value_b = 0;
for (int i = 0; i < 16; i++) {
    value_a >>= 1;
    value_b >>= 1;
    if (data_in & 0x02) {  // take bit from ADC channel A
       value_a |= 0x8000;  // put bit, will walk in LSB direction later
    }
    if (data_in & 0x01) {  // take bit from ADC channel B
       value_b |= 0x8000;  // put bit, will walk in LSB direction later
    }
    data_in >>= 2;  // next two bits, please
}

\$\endgroup\$
0
\$\begingroup\$

You can bit-bang SPI and modify the code to receive on two lanes or you can add a switch/relay/mux that needs to be switched depending on which analog in you want to read.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.