Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 17 of 17

Thread: ads8885, ADS132A02, ADS1252 question

  1. #1

    ads8885, ADS132A02, ADS1252 question

    Hello guys,

    for my work and personal use I developed a certain interest in adc's. I know there are some on the market that are compatible with the Arduino environment and can be accessed with SPI. however it is practical not all ADC's are compatible with each other and I would like increase my learning curve by doing stuff from scratch. create the board and adc board and program

    therefore I ordered from Texas Instruments 3 types of ADC, which I would like to understand how to interface with ADS8885, ADS132A02 and ads1252.

    What I would like to understand and implement in a clear manner is:

    send data by using spi commands, set the addresses(should this be done in Hexidecimal, Binary or just spi.command(something).
    set the speed,resolution of the ADC, flip the channel to channel 2, play with the SINC Filter,

    send data, continious mode, wait for transaction, receive Data, do something with data.

    I am willing to buy a intronix logic analyzer or a logic analyzer that can handle each of the adcs.
    you guys have any experience with this or a logic analyzer that would be recommended for a beginner? the saleae is also fine, a bit more expensive and less bandwidth compared to the intronix.

    tx for reading and best regards

    Bastiaan

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,523
    Quote Originally Posted by Bastiaan View Post
    Hello guys,


    therefore I ordered from Texas Instruments 3 types of ADC, which I would like to understand how to interface with ADS8885, ADS132A02 and ads1252.
    first,
    the ADS8885 is a SAR technology requiring an antialiasing filter (say 8-pole)
    the other two (ADS131A02 and ADS1252) are sigma delta technology that require only a single pole LP filter, that is typically part of the ADC input interface.

    power consumption of SAR is extremely low, Sigma-Delta on the other sides are power hungry.

    reference voltages require special attention.

    Interfaces to Teensy is typically not the issue, but the analogue design.

  3. #3
    yeah I know I read the book grounds for Grounding. and made seperate boards with my cnc mill. keeping in mind that analog Ground is everywhere and properly bypassed with caps. the refs I use are the prescribed ones from texas instruments.
    the digital ground will be on another board. thanks for pointing out the differences in adc's.

    I am just wondering how to communicate with the ADC's, could you help me out in this matter?

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,523
    I connect the ADS8881 (I have the 1 Ms/s version) simply to the I2S port.
    The ads131a02 seems standard SPI
    I have not figured out the logic of the ADS1252 (in particular the dual use of DOUT and not_DRDY)
    for the ads1282, I have, use the I2S MCLK as CLK and standard SPI for the other lines, but ads1282 has an own not_DRDY line

    both (ads131 and ads1252) seem to require a master clock (could be replaced by xtal for ads131)

  5. #5
    Senior Member
    Join Date
    Mar 2013
    Posts
    651
    Thinking of something similar. I have an ADS8698 sitting on my desk waiting for my breakout board to arrive. I'm hoping to do most of the grunt work with DMA control so that the processor does not have to babysit the ADC the whole time.

  6. #6
    lets streamline this a bit, how do I start with the General SPI Code to write to the ADS8885, to set the resolution, sample speed, and do a conversion? any Ideas? I read the Nick Gammon Page on SPI, which is explained quite well, still it does not show me anyway to communicate with the ADS8885 or the ADS8698, the PDF from the ADS8885 doesnt show that much help in communicating with the right buffers inside ads8885.

    any thoughts?

  7. #7
    Senior Member
    Join Date
    Mar 2013
    Posts
    651
    The ADS8885 is a dumb ADC, you don't set resolution or sample speed. It has an internal Clock, in the case of 3 wire mode you pull CS(CONVST) high for 1.3uS, then low and clock out data at up to 16Mhz. Not really a fan of whoever wrote that datasheet, they don't appear to say what happens if you continue to clock after the 18 bits has been sent....... Its pretty expensive for what it does also.

    The ADS8698 is fairly straightforward, at power-up you send commands to configure the registers, once configure you can start using the IC, how you get data and if you need to clock in commands depends on how you want to use it. Registers start on page 47.

    I managed to find a library for the ADS8688, you can look at the .h and .cpp to see how they set it up and controlled it. Keep in mind the major difference between the ADS8688 and ADS8698 is the resolution 16 vs 18. In the case of the ADS8698 you have to clock 2 extra times or clock an extra byte and do some shifting.
    Last edited by Donziboy2; 11-02-2017 at 04:47 PM.

  8. #8
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,523
    I have the ADS8881 and I use I2S to interface to teensy.
    In fact I have two of them on the same data line
    No Master Clock required, Din is always low, RXFS goes to Conv and is configured for16 high+16 bit low.
    I have an inverter to feed RXFS to the second ADS8881. this way once one channel is converting, the other is sending out data.

    All straight forward. Only that top 16 bit are used.

    I vaguely recall, I tried 2 x 32 bit and got data on top 18 bits. But this seems waste of clocks and power.

  9. #9
    Senior Member
    Join Date
    Mar 2013
    Posts
    651
    @WMXZ, if your only using 16 bit why not just switch to the ADS8861? Its a few bucks cheaper.

  10. #10
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,523
    Quote Originally Posted by Donziboy2 View Post
    @WMXZ, if your only using 16 bit why not just switch to the ADS8861? Its a few bucks cheaper.
    the hope was to have somewhat better dynamic range and drop the lower two bits as noise. (I know chip is expensive and I have wasted a couple of them on bad PCB boards and placing )

  11. #11
    So I read the datasheet for the ADS8885 many times over and came to an conclusion how to solve it. Ill write it in pseudo code and write the signals to the SPI input of the ADS8885.


    CONVST=HIGH,delay(10); DIN=HIGH, // I dont know how to do a half bit but I guess setting the order of execution will create a bit of lag /(delay)
    if(conversiontime!=18*24MHz) //sclk*18 page
    {
    //do something or read other adc
    }
    else
    {
    digitalRead(DOUT); //MSB data first page 24 pdf ads8885
    }
    bin_Val=digitalRead(DOUT);
    while(bin_Val>0)
    {
    do a binary to decimal conversion.
    }
    Last edited by Bastiaan; 11-03-2017 at 12:46 PM.

  12. #12
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,523
    Quote Originally Posted by Bastiaan View Post
    So I read the datasheet for the ADS8885 many times over and came to an conclusion how to solve it. Ill write it in pseudo code and write the signals to the SPI input of the ADS8885.


    CONVST=HIGH,delay(10); DIN=HIGH, // I dont know how to do a half bit but I guess setting the order of execution will create a bit of lag /(delay)
    if(conversiontime!=18*24MHz) //sclk*18 page
    {
    //do something or read other adc
    }
    else
    {
    digitalRead(DOUT); //MSB data first page 24 pdf ads8885
    }
    bin_Val=digitalRead(DOUT);
    while(bin_Val>0)
    {
    do a binary to decimal conversion.
    }
    IMO, you don't do that (fetching every word or even bit from digital pin)
    For that you have an SPI interface (or I2S interface) and then you will use DMA to transfer data from port to memory. you will access data only when triggered by DMA.

  13. #13
    Quote Originally Posted by WMXZ View Post
    IMO, you don't do that (fetching every word or even bit from digital pin)
    For that you have an SPI interface (or I2S interface) and then you will use DMA to transfer data from port to memory. you will access data only when triggered by DMA.
    something more like this you mean this is definitely more practical.
    http://polpla.cat/tutorials/SPI+DMA.html

    thanks for the hint.
    In total I require 4 pins

    ADC =Teensy3.2
    DIN =CS(NOT) = chip Select can be set in void setup ok.
    Convst =CNV? = where do I set this pin? is this MISO? SPI.transfer?
    DOUT =SDI =MOSI
    SCLK =CLK =CLK

    I am not quite understanding the correlation between the pins, and software. so I send with the SPI.Transfer? and automatically get the values back in the same array? If I follow the syntax from this SPI example?

    Do I hook up some resistor between the SDO and SDI pin?
    Last edited by Bastiaan; 11-03-2017 at 01:13 PM. Reason: added Info. more questions

  14. #14
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,523
    You would only read from the spi device. The driver takes care about the need to fill also the transmit buffer with dummy words.

    the tutorial seems to be the right one, but a look also at other example of using SPI are in the teensy libraries (e.g. SD, SPI, but also Audio)

  15. #15
    do you mean under audio the SdCardTest.ino, or under the SD the DumpFile.ino, ReadWrite.ino? tx for your time

    I just dont get it what it requires for me to communicate with this ADC, Donziboy2 said that it is a dumb chip. what does it require besides setting the High Low of the pins DIN, CS, CONVST, and SCLK?

    I know that I should use SPI.transfer in someway but what do I feed the chip so that it puts out 18bits of data? do I have to use SPCR? CPHA, CCLK, or other registers? it is just not quite plain what it requires. tx for the feedback and help guys.

  16. #16
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,523
    Quote Originally Posted by Bastiaan View Post
    I just dont get it what it requires for me to communicate with this ADC, Donziboy2 said that it is a dumb chip. what does it require besides setting the High Low of the pins DIN, CS, CONVST, and SCLK?
    Nothing, that is all.
    I know that I should use SPI.transfer in someway but what do I feed the chip so that it puts out 18bits of data? do I have to use SPCR? CPHA, CCLK, or other registers? it is just not quite plain what it requires. tx for the feedback and help guys.
    My hunch is that you can only use multiple of 8 bits on SPI. So standard SPI
    The trick is to initiate conversion with CONVST to high and transfer with CONVST to low. After 16,24, or 32 bits you set CONST back to high. this will end current transfer and start new conversion. (must first test how chip behaves id clocks continue to 24/32 bits)

    This means CONST and SCLK are linked and not independent. if you read continuously, this may require some care.
    Which is also the reason that I'm using I2S for reading my ADS8881.

  17. #17
    Senior Member
    Join Date
    Mar 2013
    Posts
    651
    Looking at the ADS8881, you pull CONVST High (Chip Select), clock 8 times, then pull it low and clock 24 bits, then you have to shift your 3 bytes around to get the correct value.

    Here is a simple test sketch I made for the ADS8698. RST is not valid for your chip and the SPI.transfers I do in Setup are also not used on the ADS8881. The ADS8698 needs 16 clocks to convert where your 8881 only needs 8 from the looks of it.

    Code:
    //Basic sketch will enable the ADS8698 and begin reading the ADC's in order.
    
    #include "SPI.h"
    //ADS8698 pins
    const int cs = 10;
    //mosi = 11;
    //miso = 12;
    //sck = 13;
    const int _RST = 9;
    
    #include "SPI.h"
    SPISettings ADS8698(8000000, MSBFIRST, SPI_MODE1);
    
    
    void setup() {
    pinMode (cs, OUTPUT);
    pinMode (_RST, OUTPUT);
    digitalWrite(_RST, HIGH);
    
    delay(10);
    Serial.begin(115200);
    Serial.println("Test");
    delay(1000);
    
    
    //SPI.beginTransaction(ADS8698);
    SPI.begin();
    //ADS8698 starts with all channels enabled.
    //ADS8698 starts with PGA's set to +/- 2.5*Vref.
    digitalWrite(cs, HIGH);
    digitalWrite(cs, HIGH);
    digitalWrite(cs, LOW); 
    SPI.transfer16(0x8500);
    digitalWrite(cs, HIGH);
    digitalWrite(cs, HIGH);
    digitalWrite(cs, LOW); 
    SPI.transfer16(0xA000);
    digitalWrite(cs, HIGH);    
    
    }
    
    void loop() {
    
      for (byte i = 0; i < 8; ++i){
      
    delay(10);
    digitalWrite(cs, LOW);
     SPI.transfer(0x00);
     SPI.transfer(0x00);
        byte MSB = SPI.transfer(0x00);
        byte midSB = SPI.transfer(0x00);
        byte LSB = SPI.transfer(0x00);
        
        uint32_t result = (MSB << 16) | (midSB << 8) |LSB; 
                 result = result >> 6;
    digitalWrite(cs, HIGH);             
    Serial.print("CH");
    Serial.print(i);
    Serial.print(": ");
    //Serial.println(result);
    Serial.print(MSB, BIN);
    Serial.print(",");
    Serial.print(midSB, BIN);
    Serial.print(",");
    Serial.print(LSB, BIN);
    Serial.print(": ");
    Serial.println(result);
      }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •