0
\$\begingroup\$

I have a ADC that works with SPI and I am interfacing it with a Raspberry Pi 3 Model B. The ADC chip has two ADCs with simultaneous sampling. There are two data lines, one for each ADC. How would one implement this in a Raspberry Pi?

This is a quote from the ADC datasheet:

'The data output is supplied to each pin as a serial data stream. The bits are clocked out on the falling edge of the SCLK input and 14 SCLKs are required to access the data. The data simultaneously appears on both pins from the simultaneous conversions of both ADCs. The data stream consists of two leading zeros followed by the 12 bits of conversion data. The data is provided MSB first. If CS is held low for 16 SCLK cycles rather than 14, then two trailing zeros appear after the 12 bits of data. If CS is held low for a further 16 SCLK cycles on either DOUTA or DOUTB, the data from the other ADC follows on the DOUT pin. This allows data from a simultaneous conversion on both ADCs to be gathered in serial format on either DOUTA or DOUTB using only one serial port.'

\$\endgroup\$
1
\$\begingroup\$

The datasheet passage you quoted answers your question. The A/D can be used to get both readings simultaneously. Some SPI implementations allows for multiple input lines, sometimes bi-directional. If the hardware doesn't have this capability, you could implement it in firmware-only.

Alternatively, you can just ignore the second data line. The first reading is sent in the first 16 bits, then the second in the next 16 bits. This is compatible with standard and common SPI hardware, but takes more clocks to get the same data.

\$\endgroup\$
  • \$\begingroup\$ Thanx for the answer.....I understand exactly how the A/D and its SPI works but my question is if it is possible to implement 2 data in lines on the Raspberry Pi SPI interface and how....?? Since the Pi only has one MOSI pin. \$\endgroup\$ – Eduan Shuda Sep 10 '16 at 0:53
  • \$\begingroup\$ @Eduan: That's a Rpi usage question. Surely this is covered in the Rpi documentation. \$\endgroup\$ – Olin Lathrop Sep 10 '16 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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