« Close

Datasheets and User Guides

App Notes

Software & Driver

 

13.3.1 I2C Simulation Tool [T-Series Datasheet]

I2C Simulator

This JavaScript application is designed to help give an understanding of the LabJack T4 and LabJack T7's I2C functionality. For more information about the T4 and T7's I2C functionality and register descriptions, see 13.3 I2C. Each I2C register that affects the output is shown below. The two registers that are omitted are I2C_GO and I2C_ACKS:

  • I2C_GO: Executes the configured I2C request.
  • I2C_ACKS: Reads the received ACKs & NACKs packed into a binary array.

Test out various I2C configuration settings and view the expected result.

  • I2C Op:
  • SDA/FIO0:
  • SCL/FIO0:

Enter I2C Configuration Settings Below

I2C_SDA_DIONUM:

I2C_SCL_DIONUM:

I2C_SPEED_THROTTLE:

I2C_OPTIONS:

Enable Reset-On-Start:

Enable No-Stop on Restart:

Enable Clock Stretching:

Result:

--Input below in hexadecimal--

I2C_SLAVE_ADDRESS:

I2C_NUM_BYTES_TX:

I2C_NUM_BYTES_RX:

I2C_DATA_TX:

I2C_DATA_RX:

Key:

  • A: Indicates an I2C-Ack bit writing a byte of data
  • C: Indicates an I2C-Clock stretch occurring to slow down transmission
  • N: Indicates an I2C-Nack bit writing a byte of data
  • P: Indicates an I2C-Stop Condition
  • R: Indicates an I2C-Read bit appearing after the slave address is sent
  • RESET: Indicates an I2C-Reset Condition
  • S: Indicates an I2C-Start Condition
  • W: Indicates an I2C-Write bit appearing after the slave address is sent

Please feel free to leave comments below.

Referenceable: I2C FAQ/Common Questions

I2C FAQ/Common Questions

 

Q: Why are no I2C ACK bits being received?
 - Double check to make sure pull-up resistors are installed.
 - Double check to make sure the correct I/O lines are being used.  It is preferred to do I2C communication on EIO/CIO/MIO lines instead of the FIO lines due to the larger series resistance (ESD protection) implemented on the FIO lines.
 - Use an oscilloscope to verify the SDA and SCL lines are square waves and not weird arch signals (see "I2C_SPEED_THROTTLE" or use EIO/CIO/MIO lines).
 - Use a logic analyzer (some oscilloscopes have this functionality) to verify the correct slave address is being used.  EEVblog post on budget friendly options.  It is common to not take into account 7-bit vs 8-bit slave addresses or properly understand how LabJack handles the defined slave address and the read/write bits defined by the I2C protocol to perform read and write requests.
 - Make sure your sensor is being properly powered.  The VS lines of LJ devices are ~5V and the I/O lines are 3.3V.  Sometimes this is a problem.  Consider buying a LJTick-LVDigitalIO or powering the sensor with an I/O line or DAC channel.

 

Q: I've tried everything, still no I2C Ack Bits...
 - Try slowing down the I2C bus using the "I2C_SPEED_THROTTLE" register/option.   Reasons:
    - Not all I2C sensors can communicate at the full speed of the LabJack.  Check the I2C sensor datasheet.  
    - The digital signals could be getting corrupted due to the series resistors of the I/O lines on the LabJack.
 - Consider finding a way to verify that your sensor is still functioning correctly using an Arduino and that it isn't broken.

Q: Why is my device not being found by the I2C.search function?
 - See I2C ACK bits.

Q: What are I2C Read and Write functions or procedures?
 - There are a few really good resources for learning about the general flow of I2C communication.  TI's application report titled "Understanding the I2C Bus" by Jonathan Valdez and Jared Becker is one really high quality resource.   A second application note is published by NXP: I2C-bus specification.  Robot Electronics Using the I2C Bus is a second, and a third is published by i2c.info I2C Bus Specification.