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.

ADS131A04EVM: starting conversion

Part Number: ADS131A04EVM
Other Parts Discussed in Thread: ADS131A04,

Hi,


I have a problem with setting up the ADS131A04. I use the ADS131A04EVM, but connected the SPI lines to a Raspberry Pi. Reading and Writing the registers works fine. I'll use the asynchron slave mode, and also the interrupts are generated (by the ADS131) and received (by the Pi) without problems. Following data sheet figure 109, I set some registers I need, enable ADCs, send wakeup and lock the registers. Every command is acknowledged as expected. But - there is no conversion value in the frames I read. I connected only J7 of the EVM (n-input about 1.3 V, p-input about 2.0 V), the remaining inputs of the EVM are open. I would expect quite accurate values for the used input and some small noisy values on the others, but I read simply "0" for all bytes. The registers 02h..05h don't report any error. What happens here, what do I miss? Is it possible to destroy the analog inputs in a way the digital output is constant "0".

  • Hello Axel,

    Can you send me the exact sequence you do all of these things and also the register settings?

    Brian
  • Hallo Brian,


    I used a python script for reading/writing:

    #!/usr/bin/python
    import spidev
    import time
    import RPi.GPIO as GPIO
    
    spi = spidev.SpiDev()
    spi.open(0,0)
    spi.mode = 0b01
    spi.max_speed_hz = 16000000
    
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)
    
    i = 0
    n = 0
    
    def Interrupt(channel):
      global n
    # -- read data and registers 02h..05h  
    resp1 = spi.xfer2([0x22, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) resp2 = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) resp3 = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) resp4 = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) n = n + 1 if n == 100: print ''.join(["0x%02X " % x for x in resp1]).strip() print ''.join(["0x%02X " % x for x in resp2]).strip() print ''.join(["0x%02X " % x for x in resp3]).strip() print ''.join(["0x%02X " % x for x in resp4]).strip() print "" n = 1 try: # avoid wrong bit sync resp = spi.xfer2([0x06, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) time.sleep(0.1) resp = spi.xfer2([0x05, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) # -------------------------------------------------------- # GPIO.add_event_detect(24, GPIO.FALLING, callback = Interrupt) # -- interrupt generation starts without wake-up !!!??? # -- >>> TI-Blog: "expected behaviour"; wait for READY Word 0xFF 0x04 and start with UNLOCK while i == 0: i = i + 1 # -- unlock resp = spi.xfer2([0x06, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() # -- read all registers resp = spi.xfer2([0x20, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() # -- lock resp = spi.xfer2([0x05, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() # -- wait for lock response resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() print "" time.sleep(5) # end while while i == 1: i = i + 1 # -- unlock resp = spi.xfer2([0x06, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() # -- CLK2 (0x0E): 8 - fICLK/8, 0 - fMOD/4096 resp = spi.xfer2([0x4E, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() # -- ADC_ENA (0x0F): F - enable all ADCs resp = spi.xfer2([0x4F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() # -- wakeup resp = spi.xfer2([0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() # -- lock resp = spi.xfer2([0x05, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() # -- wait for lock response resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() resp = spi.xfer2([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) print ''.join(["0x%02X " % x for x in resp]).strip() print "" GPIO.add_event_detect(24, GPIO.FALLING, callback = Interrupt) time.sleep(2) # end while while i == 2: i = i + 1 # end while while True: time.sleep(1) # end while except KeyboardInterrupt: spi.close() GPIO.cleanup() print "\nTschaui" print "" # end try

    The output is the following, which is (beside the zeros for the conversion values) what I expect to see:

    0xFF 0x04 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x06 0x55 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x60 0x14 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x04 0x03 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x00 0x01 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x00 0x60 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x3C 0x08 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x86 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x05 0x55 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    
    0x22 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x06 0x55 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x2E 0x80 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
    0x2F 0x0F 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x33 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x05 0x55 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x22 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    
    0x22 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x62 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    
    0x22 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x62 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    
    0x22 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x62 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    
    
    Tschaui

    When I'm correct, I'll have about 62 interrupts per second. To avoid a mass of data on the screen, I write only every 100th set. The time seems ok, i.e. I see a new block roughly every 1.xx second.

    By the way: The only thing I can't explain is the value of 0x22 at first position of every block except the first one. the first one starts correctly with 0xFF 0x04.

    Do you have a suggestion to make this work?

    Best regards

    Axel

  • Hey Axel,

    I don't mean to be picky, but could you just summarize what you do in the sequence in a list form and perhaps just summarize the register settings in a list? That way I can easily tell which part your sequence is missing.

    The 0x22 at the beginning of each output frame is the "ACK" for a "NULL" command. It simply means that the device is reporting the contents of register 0x02 in the very next byte.

    Regards,
    Brian
  • Hallo Brian,


    no problem, it's not much. In a first step I read all registers to have a complete picture, i.e. UNLOCK, READ (0x20, 0x14), LOCK. Then, I do

    - 0x06, 0x55: UNLOCK

    - 0x4E, 0x80: CLK2 register, fICLK / 8, fMOD / 4096 (resulting in 62 interrupts per second)

    - 0x4F, 0x0F: ADC_ENA for all ADCs

    - 0x33: WAKEUP

    - 0x05, 0x55: LOCK

    - 0x00: wait for LOCK response

    After that sequence I enable the interrput routine in Python. The MODE PIN STATUS register is correctly 0x01, all write commands are acknowledged correctly. Interrupts are generated, but channel data are "0".


    That's it. Do you have any suggestions?

    Best regards

    Axel

  • Axel,

    I think I have identified the mistake. When you attempt to send the WAKEUP command, you send 0x3300. In fact the WAKEUP command should be 0x0033. The reason you do not receive an F_OPC fault is because 0x3300 is a valid command: RREG register 0x13 - the result of which is 0x00. In the end, you never actually send the WAKEUP command so all the conversion results appear as 0x00. I believe if you change that one line in the script it should work.

    Brian
  • Hallo Brian,


    you're completely right, it was my fault. Tricky that the response is in this particular case exactly what one could expect also for the (wrong) WAKEUP command. Thanks a lot!!!


    Best regards

    Axel

  • Hi Axel,

    I'm looking to set something up very similar to what you have. I'm just curious, are you able to get the full 128ksps with simultaneous sampling with your setup?

    -Daniel