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.

ADS1211: ADS1211E

Part Number: ADS1211

Hi......

I am interfacing  ADS1211E through SPI with PSOC5  in my Project.I am able to write the data to ADS1211 but I am not able to Read the data from ADS1211E..

I was trying to write data to command register using instruction register and read back default value in command register but it is reading always 0xFF/0x00. i want support for how to use ADS1211E ADC. If possible anyone used ADS1211E post sample code here.

Thanks in Advance.

  • Hi Jayaramulu,

    Welcome to the E2E forums!  Unfortunately we do not have any sample code for the ADS1211.  It is in some ways a complicated device with respect to timing of the communication.  How have you verified that you can write to the device if you cannot read from it?

    Can you send me your schematic and some scope or logic analyzer shots of your communication?  This would be helpful for me to see what might be going wrong in the communication.

    Best regards,

    Bob B

  •  writing data to ADC using SPI serial communication

  • writing 0x84 and dummy data 0x00
  • this is our code ..please review and let me know where iam doing mistake.

    /* ========================================
    *
    * Copyright YOUR COMPANY, THE YEAR
    * All Rights Reserved
    * UNPUBLISHED, LICENSED SOFTWARE.
    *
    * CONFIDENTIAL AND PROPRIETARY INFORMATION
    * WHICH IS THE PROPERTY OF your company.
    *
    * ========================================
    */
    #include "project.h"

    uint8 SPIReadData[4] = {0};
    #define READEMASK 0x80
    #define WRITEMASK 0x00


    #define ADC_DATA_REG2_ADDRESS 0x00
    #define ADC_DATA_REG1_ADDRESS 0x01
    #define ADC_DATA_REG0_ADDRESS 0x02


    #define ADC_CMD_REG3_ADDRESS 0x20
    #define ADC_CMD_REG2_ADDRESS 0x05
    #define ADC_CMD_REG1_ADDRESS 0x06
    #define ADC_CMD_REG0_ADDRESS 0x07



    uint8 CMDRegValue[4] = {0};



    //void adcWrite(void);
    //void adcRead(void);
    void adcWrite(uint8 Address,uint8 Data);

    void writeADCCMDRegValue(void);
    void ReadADCCMDRegValue(void);
    uint8 adcRead(uint8 Address);
    uint8 CMDbuff[4] = {0xB0,0x04,0xFF,0x80};
    //uint8 i = 0;
    int main(void)
    {

    // Clock_1_Start();
    SPIM_Start();


    CyDelay(1000);
    CyGlobalIntEnable; /* Enable global interrupts. */

    //CS_Write(1);

    while(1 == DRDY_IP_Read());

    /* Place your initialization/startup code here (e.g. MyInst_Start()) */
    DSYNC_Write(0);

    for(;;)
    {
    writeADCCMDRegValue();
    ReadADCCMDRegValue();




    }
    }

    void writeADCCMDRegValue(void)
    {
    while(1 == DRDY_IP_Read());
    CyDelay(1);
    // /*Write */
    CS_Write(0);


    CyDelay(2);
    //adcWrite(ADC_CMD_REG0_ADDRESS, 0x16);
    //CyDelay(100);
    adcWrite(ADC_CMD_REG3_ADDRESS, 0x04);
    //CyDelay(100);
    //adcWrite(ADC_CMD_REG1_ADDRESS, 0xFF);
    //CyDelay(100);
    //adcWrite(ADC_CMD_REG0_ADDRESS, 0x80);
    //CyDelay(100);
    }

    void ReadADCCMDRegValue(void)
    {
    //SPIM_ClearFIFO();
    // SPIM_ClearRxBuffer();
    //CyDelay(100);
    CMDRegValue[0] = adcRead(ADC_CMD_REG0_ADDRESS);
    //CyDelay(100);
    //CMDRegValue[1] = adcRead(ADC_CMD_REG2_ADDRESS);
    CyDelay(100);
    // CMDRegValue[2] = adcRead(ADC_CMD_REG1_ADDRESS);
    // CyDelay(100);
    // CMDRegValue[3] = adcRead(ADC_CMD_REG0_ADDRESS);
    // CyDelay(100);
    }

    void adcWrite(uint8 Address,uint8 Data)
    {

    while(1 == DRDY_IP_Read());
    CyDelay(10);
    /*Write */
    // CS_Write(0);
    // CyDelay(1);
    // SPIM_TxEnable();
    SPIM_WriteTxData(WRITEMASK | Address);
    while(!(SPIM_ReadTxStatus() & SPIM_STS_BYTE_COMPLETE));

    // SPIM_TxDisable();
    CyDelay(10);

    // SPIM_TxEnable();
    SPIM_WriteTxData(Data);
    while(!(SPIM_ReadTxStatus() & SPIM_STS_BYTE_COMPLETE));

    // SPIM_TxDisable();
    CyDelay(10);



    while(1 == DRDY_IP_Read());
    CyDelay(1);


    }

    uint8 adcRead(uint8 Address)
    {
    uint8 SPIData = 0;


    while(1 == DRDY_IP_Read());
    CyDelay(10);

    CyDelay(1);


    SPIM_WriteTxData(READEMASK |Address);
    while(!(SPIM_ReadTxStatus() & SPIM_STS_BYTE_COMPLETE));
    while(!(SPIM_ReadRxStatus() & SPIM_STS_RX_FIFO_NOT_EMPTY));
    CyDelay(10);
    SPIM_ReadRxStatus() ;

    SPIM_WriteTxData(0x00);
    while(!(SPIM_ReadTxStatus() & SPIM_STS_BYTE_COMPLETE));

    CyDelay(1);

    SPIData = SPIM_ReadRxData();
    CyDelay(100);
    while(1 == DRDY_IP_Read());
    CyDelay(1);
    CS_Write(1);

    return SPIData;
    }




    Thanks & Regards.
  • Hi Jayaramulu,

    I haven't been able to look at your code yet, but it appears that you are attempting to read 1 byte (MSB) of the command register.  However, you never initiate any SCLKs for the retrieval of the register byte.  The micro must initiate the clocks for the register byte as well as the instruction.  This can be initiated by sending a dummy byte of data where the result will be transmitted.  This dummy byte can be 0x00.

    Best regards,

    Bob B

  • Hi Jayaramulu,

    After looking at your code it appears you are missing the last byte as I had mentioned in my last post. Were you ever able to resolve the issue reading out the register contents?

    Best regards,
    Bob B