0
\$\begingroup\$

this is a follow up to my previous question "How to measure bipolar analog signal accurately (to 1mV) on raspberry pi" . I can't post more than 2 links yet but please have a look for some more background. The summary is that I need to measure a bipolar signal that varies between +/- 2V. I need the values to be accurate to about 1mV. After, asking here, I proceeded with what I thought was the best way which was to use the LTC1867 chip which is a 16 bit ADC that takes bipolar inputs to eliminate errors from level shifting circuits.

I tried to use the guides for connecting the MCP3008 to connect the IC to the raspberry pi. My connections were SCLK->SCK (Purple), MISO->SDO(Green), MOSI->SDI(Yellow), CE0->CS/CONV(Blue). enter image description here I used spidev for the SPI communication, because it looked like the most popular one (I didnt quite understand WiringPi). I tried to get a differential input between channel 0 and 1

Input Data Word

From the datasheet the input word would be 0000000X. And since it returns 16 bits I assumed I needed to send 2 8bit words. So I used spi.xfer2([0,0]). It returns 2 words. I shift the fist word by 8 bits and combine them both into one word. Since in bipolar mode, it returns it as 2's complement, I convert it to a normal number. However the answer I get is way off. So my questions are

  1. Have I connected the ADC to the raspberry Pi correctly.
  2. Am I sending and receiving the bits correctly?
  3. How do I use Wiring Pi to communicate to the ADC or how do I communicate with ADCs that aren't MCP3008 and similar.
  4. Lastly, while checking he SCLK signal on an oscilloscope, it showed no pulses. Any idea why?

PS: I can post my code as well but didn't want the question to be too long

\$\endgroup\$
  • \$\begingroup\$ It's not clear from your question, but are you aware that the conversion which is started when you clock that 7-bit control word in wil only have its result presented to you on the next SPI transfer? So the 1st set of data you receive will be a result of whatever the default settings in the LTC1867 produce, and the next set of data will be what you asked it for. \$\endgroup\$ – brhans Feb 8 '17 at 16:22
  • \$\begingroup\$ if possible add wiring circuit diagram from pi to LTC1867 \$\endgroup\$ – Raj Feb 8 '17 at 17:28
  • \$\begingroup\$ @brhans I thought the spixfer2() returned the next set of data. So when I do spi.xfer2([0,0]) and it returns lets say [192, 224]. Are you saying I discard the 1 set of data (i.e 192)? If so, since I am expecting 16 bits back how do I get the remaining 8 bits because a 3rd set of data is never returned. Also the data sheet makes it look like the SDO returns only the bits I need. A bit confused \$\endgroup\$ – Baba Feb 8 '17 at 18:49
  • \$\begingroup\$ @Raj just added them \$\endgroup\$ – Baba Feb 8 '17 at 18:50
  • \$\begingroup\$ Each data set is 2 bytes, and send and receive occur simultaneously. So your first spi.xfer2([0,0]) sends a pair of 0's while simultaneously receiving whatever is presently in the LTC's results register. After that SPI transfer completes, the LTC begins a new conversion using the configuration you just sent it (0, 0). When that is complete you can read it out with another spi.xfer2([0,0]), and continue from there. The LTC can't give you the results of a conversion it has not yet done ... \$\endgroup\$ – brhans Feb 8 '17 at 19:10
0
\$\begingroup\$

If any one has this problem, my suggestion would be to use an oscilloscope (or install piscope) to see what the MISO, SCLK, CE0,and MOSI are doing. Mine are behaving strangelyenter image description here

My next task would be to find out why. I'm sure that would be the root of the problem.

\$\endgroup\$

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.