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.

Ads1255 settings

Other Parts Discussed in Thread: ADS1255

Hi,

      I am facing of output continuously varying of ads1255. I have posted my initialisation function please tell whether it is correct or there are issues of timing.  

void init_adc1255(void)
{
select_slave();
spi_write_byte(0x00); //wakeup
release_slave();
_delay_us(100);

select_slave();
spi_write_byte(0x0F); //stop continuous reading
release_slave();
_delay_us(1000);

select_slave();
spi_write_byte(0xFE); //reset
release_slave();

while(bit_is_set(PIND,0));

write_reg(IO,0x0,0x30); //write gpio register
_delay_ms(10);

write_reg(DRATE,0x0,0x03); //drate
_delay_ms(10);
write_reg(ADCON,0x0,0x07); //adcon
_delay_ms(10);

write_reg(MUX,0x0,0x01); //mux
_delay_ms(10);
write_reg(STATUS,0x0,0x06); //status
_delay_ms(10);

}

  • Hi,

        I am using atmega 16 controller with 16Mhz clock signal.

  • Hi Abhinav,

    What clock rates are you using for the ADS1255 master clock and SPI clock?

    Have you scoped the SPI pins to verify that communication is working as you expect? Very often I find setting up the SPI clock in a microcontroller requires some debugging.

    Regarding your initialization function:

    • I would recommend removing the first "WAKEUP" command. "WAKEUP" is only used following a "SYNC" or "STANDBY" command. It is also best to start with the "SDATAC" command that you have as the second command in your code.

    • At the end of your initialization, add the "SYNC" and "WAKEUP" commands to restart conversions.

    • I don't see a "select_slave();" issued before you write to the ADS1255 registers. You may not be communicating with the device at all at this point if /CS is held HIGH.

    • Also when pulling /CS HIGH, you may want to check that /DRDY is HIGH. I have seen some instances where the finite state machine that controls the ADS1255 SPI can get out of sync with the SPI controller when /CS is released while /DRDY is LOW.

    Most often when I check codes for the ADS1255 I find that no delays are added between commands, but I see you're implementing them!

    Best Regards,
    Chris

  • Hi Chris,

        Thanks for the reply. My SPI clock frequency is 0.125 MHz. The problem I am facing is while reading the data with read data command continuously my MSB and mid byte changes with the same value. Am I collecting the data in the wrong sense?

  • Hi again,

       My SPI works good as I can read the values in the registers correctly whatever I have written in it.

  • Hi,

       This is my write reg code,

     

    void write_reg(uint8_t regAddr,uint8_t count,uint8_t data)
    {
    select_slave();
    spi_write_byte (0x00);
    _delay_us(50);
    spi_write_byte(regAddr|0x50);
    spi_write_byte(count);
    spi_write_byte (data);

    spi_write_byte(0xFC); //sync
    spi_write_byte(0x00); //wakeup
    release_slave();

    }

  • Hi Abhinav,

    For the "write_reg" function you need to add delays before and after the "SYNC" command. Refer to "t11" on the timing characteristic table on page 6 of the data sheet. 

    void write_reg(uint8_t regAddr,uint8_t count,uint8_t data)
    {
    select_slave();
    spi_write_byte (0x00);
    _delay_us(50);
    spi_write_byte(regAddr|0x50);
    spi_write_byte(count);
    spi_write_byte (data);
    
    //ADD DELAY
    spi_write_byte(0xFC); //sync

    //ADD DELAY

    spi_write_byte(0x00); //wakeup release_slave(); }

    For the problem your having with reading data, can you give me an example of what's happening? You said the data looks like it's coming in the wrong order? The ADS1255 should be giving you the MSB first, mid-byte second, and LSB last as shown in figure 32 on page 35.

    Regards,
    Chris

  • Hi again,

         I am facing the problem of stable reading .Readings are not stable for lower voltages.

  • Hi Abhinav,

    Have you tried applying a mid-supply common-mode voltage two both inputs while shorting them together and checking the stability of the readings?

    Your input source may not be stable, therefore, the shorted input test will tell you the highest repeatability you can achieve with your system.

    If the voltage reading is still unstable with shorted inputs then you'll have to debug where the source of noise is that is causing the problem. Do you have any data you can show me? If you give me something to work with then I can at least see if the unstable data results look likes random noise noise or if there is some deterministic interference.

    Regards,
    Chris

  • Hi Chris,

        I want to know why sync and wakeup commands are needed to be sent in my write reg function. 

  • Hi Abhinav,

    You are right, they are not needed here. However, after you finish configuring the device by performing all the register writes then you will use these commands to restart the conversion.

    Regards,
    Chris