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.

ADS1219 pseudo code

Other Parts Discussed in Thread: ADS1219

Hello,

i was looking at the ads1219 datasheet, and it is stated that before an i2c transaction a high to low on the SDA line while SCL is high is a most to initialize a start operation, however, my question is that an alternative of the start command. Moreover, i would like to know the size and format of the ACK and NACK sent by the device. Last if i want read the status register,

is the following steps correct

i2c start 

i2c set ADC by reset pin high to low

send the device (if select pins are both ground  i sent 0x40) 

release i2c bus, should i get an ack message or send the the command 0x20

should i get ack here again ?

thanks for the help 

  • Hi Mohamad,

    Welcome to the E2E forum! I think there is some general confusion on how I2C communication works. This is a standard protocol with lots of information on how it works that can be found using your favorite search engine. In general terms I2C is a byte transfer initiated from the I2C master where depending on the action (or direction of communication), either the slave or the master will will pull the SDA line low on the 9th clock. So there are 8 clocks of data followed by a 9th clock for ACK (8 + 1). When the ACK takes place the acknowledging device will pull the SDA line low during the 9th clock signalling an ACK. Each I2C communication is initiated with a Start or Repeated Start, and ends with a Stop.

    Also, when using the RESET pin of the ADS1219 device, all action on the ADS1219 will halt and be held in a reset state. The RESET pin must be logic high for the device to operate. You will never get an ACK if the RESET pin is low.

    Best regards,
    Bob B
  • Hi Mohamad,

    I see that you rejected my answer, so let me attempt this again.  You may be confusing the START command of the ADC converter to the I2C Start condition.  I2C follows a specific protocol as a industry specification.  All I2C devices must follow this protocol.  You send the I2C Start condition followed by the address of the device you wish to communicate with (usually a seven bit address but sometimes 10) and the 8th bit signifies whether you wish to read or write to the device being addressed.  The next byte (and possibly bytes following) that is transmitted may be a register, command, data, etc..  If the address, command, data, etc. is successfully received, on the 9th clock of the I2C frame the responding device sets the SDA line low for an ACK.  If the communication was not a success, then the responding device leaves the SDA line high for a NACK.

    If you are writing commands or data to the ADS1219, you should always see an ACK after each byte.  This may not be true with respect to the master when you read data from the ADS1219.  Usually the I2C peripheral in a micro will not ACK the last byte.

    Make sure the RESET pin is high on the ADS1219 or you will not be able to communicate to the ADS1219.  If you want to read the contents from the Status register you need to do two actions by first writing the RREG command to the ADS1219 followed by a read of the register data.  This is shown in Figure 37 of the ADS1219 datasheet.  The slave address and the read/write bit are transmitted as a single byte.  Slave address is 0x40 (when A0 and A1 are at ground) and read is 1 and write is 0.  What is transmitted in the slave address frame is (0x40<<1) + R/W bit.  So what gets transmitted is 0x80 for a write and 0x81 for a read.

    The RREG command itself is 0x20.  The bit 2 is the register you desire to read from.  If 0x20 is transmitted, then you are requesting register 0, and 0x24 is register 1 (the Status register).

    Putting it all together:

    Send I2C Start condition

    Send Slave address as write (0x80) (ADS21219 should ACK)

    Send RREG command (0x24) (ADS1219 should ACK)

    Send I2C Repeated Start condition

    Send Slave address as read (0x81) (ADS1219 should ACK)

    Send SCL clocks to retrieve register from ADS1219 (master may or may not ACK)

    Send I2C Stop condition

    I hope this makes it a little more clear.

    Best regards,

    Bob B