This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I am using an ADS7870EVM board in conjunction with an arduino uno (ATMEGA328), and am in the process of writing a library for easy use of this ADC. I am using the arduino framework, but have moved beyond functions like digitalWrite etc because of their overhead.
I have successfully been able to get the basic functions working - writing to and reading from registers, direct conversions and instruction conversion, and reading back data using both the automatic mode, and requesting with an instruction. I have also been able to implement the *busy* signal both as a SPI command, and with a pin.
What I would like to do is quickly sample all 8 channels in quick succession in a single function, and have been trying to implement the queued sampling. What I have tried is (RBM=1 so it sends back two bytes of data after a conversion finishes):
1. Assert CS=LOW
2. Write to GAINMUX register with CNV/BSY set, send instruction byte for channel 1, single ended, gain=1
3. Write to GAINMUX register with CNV/BSY set, send instruction byte for channel 2, single ended, gain=1
4. Wait until the busy signal goes low
5. Read out two bytes which is the result from Channel 1
Repeat steps 3, 4 and 5 for the remaining channels up until the convert instruction for the last channel has been queued
Then wait for busy to go low and read out the last two bytes.
Release CS=HIGH
However this doesn't work! I can get it to work for all but the final readout. Which leads me to think that the final read where I send two 0x00 on MOSI is actually sending a reset. Another strange thing is that I have to cycle CS HIGH then LOW between steps 2 and 3 - otherwise it stops the conversion. I've been looking at the signals on a logic analyser by the way. This is a bit strange to me - I don't really get why it happily automatically returns values for all the other channels. The only thing I can think of really is that one of the conversions is somehow skipped, so when it comes to trying to read out the 8th channel it actually doesn't have any data to push out and so 0x00 0x00 resets it.
Can anyone help me - am I doing the right thing?! I'm happy to send code, but figured describing what I'm trying to do first might be more help