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.

ADS1256: ADS1256

Part Number: ADS1256

I am using a Waveshare A/D board on a Raspberry Pi 3b. This board contains a ADS156 A/D chip. I am writing driver code in Python using a Broadcom C library with bindings to Python.  This is NOT a software question as such.

This library does not have a distinct spi_write function, instead it has a spi_transfer function. When this function is called, it asserts CS and clocks an 8 but value out on MOSI (ads1256 DIN) and simultaneously clocks in data from MISO (ads1256 DOUT) thus reading 8 bits of data from the slave.

I believe this is what I need to do in order to read data (one shot mode): When doing a read from the ads1256, (reference fig 30 in datasheet) I wait for DRDY to go low then write a RDATA command to MOSI (DIN) and read the data that returns and that is byte 1, the MS byte. Then I do two additional spi transactions reading the returned data as Middle byte and LS byte.

So my question is, these additional transactions also send data out MOSI. What data should I send? Should I send RDATA (0x01), 0xff, 0x00? Sending nothing is not an option.

I believe that the issue of not having a read only function is common among spi drivers so it must be that the ads1256 is able to ignore these writes but that is speculation.

What are your thoughts in this issue?

  • Hi Aubrey,

    While SPI is capable of  full-duplex communication, the ADS1256 will only communicate using half-duplex mode; therefore, there will be certain bytes of data that you will need to ignore.

    Aubrey Page said:

    I believe this is what I need to do in order to read data (one shot mode): When doing a read from the ads1256, (reference fig 30 in datasheet) I wait for DRDY to go low then write a RDATA command to MOSI (DIN) and read the data that returns and that is byte 1, the MS byte. Then I do two additional spi transactions reading the returned data as Middle byte and LS byte.

    So my question is, these additional transactions also send data out MOSI. What data should I send? Should I send RDATA (0x01), 0xff, 0x00? Sending nothing is not an option.

    When sending the "RDATA" command, you will likely want to read the return data (to clear out the data buffer on the Pi); however, this return data should be neglected.

    After sending the RDATA command, you will clock out the A/D data by sending 3 additional NOP bytes (0x00). These bytes will make up the MSB, Mid-Byte, and LSB, respectively.

    When clocking out the data, it is important to send NOP bytes and not any command bytes (such as another RDATA byte) as this may cause the ADC to restart the read operation.

     

    I'm not too familiar with the SPI APIs on the Pi, but in general, all SPI functions are usually some combination of writing to the SPI output buffer, waiting until the SPI has finished clocking out the TX byte and clocking in the RX byte, and reading the RX byte from the SPI input buffer. I'm not aware of any standard SPI commands, I think all commands follow the above pattern but will be vendor and/or device specific.

    I hope that helps,
    Chris

  • OK, I believe you have informed me of two things that are pertinent to my question. 1) I need to ignore the first byte received as a response to my RDATA command. 2) Perform 3 more spi transactions sending NOP (0x00) and receiving 3 bytes of data MS, Middle ans LS bytes of the converted data.