Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

ADS7851: ADS7851

Part Number: ADS7851

Hi, I've recently purchased ADS7851

With QFN16 to DIP16 adapter I connected it to Raspberry Pi, trying to communicate via SPI.

However, I'm facing some problems, which might be unique one for this product since ADS7851 doesn't have Din(Data input) port. It only has CS(Chip Select) Port.

As far as I know, I need to send command bytes by MOSI(Raspi)->Din(ADS) and receive back by MISO(Raspi)<-SDO A(ADS), which is the common way in other ADC Products such as MCP3208.

The point is, I wonder how to apply SPI communication to this product.

Thanks, Daniel

  • Hello Daniel,

    In order to properly communicate with the ADS7851 via SPI, I suggest looking closely at Figure 1 from the ADS7851 datasheet. This is the timing diagram and if you follow the timing requirements for CS, SCLK, and reading from SDO-A and SDO-B, then you should be able to properly collect sampled data from the SAR ADC.

    Also note that depending on the sampling rate you would like to run at, your SCLK can be adjusted. For example, at 2000kSPS you will need you SCLK to be at 32MHz to ensure you can capture data quickly enough per cycle. At slower sampling rate, the SCLK can scale to a slower frequency.

    Please let me know if you have any follow-up questions. If so, please also inform me about the sampling rate you want.

    Thank you,
    Reed Kaczmarek
  • Hello Kaczmarek,

    I'm expecting 1.5MSPS, which then needs clock speed of 24MHz(I believe it's correct, since one data needs 16 bits(2 dummy+14 resolution bits)

    and here is the code I've used in Raspberry Pi

    #!/usr/bin/python
    import time
    import sys
    import spidev
    import RPi.GPIO as GPIO

    GPIO.setmode(GPIO.BCM)
    spi=spidev.SpiDev()
    spi.max_speed_hz=24000000

    SCLK=23
    CS=24
    MISO=21

    GPIO.setup(SCLK,GPIO.OUT)
    GPIO.setup(CS,GPIO.OUT)
    GPIO.setup(MISO,GPIO.IN)

    def readADC(clkPin, csPin, misoPin):
    GPIO.output(csPin,GPIO.LOW)
    buff=[]
    for i in range(16):
    buff.append(GPIO.input(misoPin))
    bData=buff[2:16]
    bData.reverse()
    Data=0
    for bit in bData:
    Data=(Data<<1)|bit
    return Data

    if __name__=='__main__':
    try:
    while True:
    val=readADC(SCLK,CS,MISO)
    volt=val*3.3/(2**14)
    print 'ADC value', str(volt)
    time.sleep(0.1)
    except KeyboardInterrupt:
    GPIO.cleanup()
    spi.close()
    sys.exit(0)



    Here, I've used time.sleep(0.1) , just to check the real-time voltage signal (Later I'll get rid of it to get full sampling rate)

    Is this the proper approach of SPI Communication?

    Thanks,
    Daniel
  • Hi Daniel,

    You are correct that for 1.5 MSPS you require a SCLK of 24 MHz.

    As long as you are able to have the timing match Figure 1 of the datasheet then you should be all set. The code looks like you have properly setup your inputs and outputs as well as your SCLK frequency of 24MHz.

    Thank you,
    Reed