I2C SPI USB CAN eSPI Cable Testing View All Videos Quick Start Guides Software Downloads App Notes White Papers User Manuals Knowledge Base Sales Support About Us
Products Blog Sales Support Contact Search
How Do I Accelerate LabVIEW Write and Read Timing for I2C Devices?
Rena Ayeras

Question from the Customer:

I’m testing an LED Driver for a rear lamp project. The LED is a slave device. The master device is an Aardvark I2C/SPI Host Adapter. I started the tests using the Control Center Serial Software. The slave device responded correctly and the delay between writes and reads was very small, as expected.

After that, I started using the other tests. Initially, the slave device was in timeout and not answering. I fixed that by including the NOT STOP flag. However, the timing between the master device writing to and reading registers was too long – 300-400us.  Here are views of the timing per Control Center Serial Software and LabVIEW.

User Shows Software Timing Faster with Control Cetner Serial Software Control Center Serial Software Timing


User shows slower timing with LabVIEW LabVIEW Timing

How can I improve the timing performance with LabVIEW?

Response from Technical Support:

Thanks for your question! We provide functional examples with our Aardvark LabVIEW drivers. However, the examples we provide only use i2c write and i2c read: two separate functions that affect the timing in your setup.  Based on your information, if looks like you need to use register read in a program sequence, which is described below.

Write-Read Sequence

As previously stated, our examples use i2c write and i2c read. However, you can create a script that should produce the speed that you need for your setup. Here is an overview of the recommended read-write operation:

Start -> Address (Write) ->Register Offset -> Restart -> Address(Read) -> Read data from slave register -> Stop

How it works:

  1. Call the I2C write function aa_i2c_write() with the AA_I2C_NO_STOP Specify the device register address from which you will read the data.
  2. Follow with the I2C read function aa_i2c_read(). Specify the number of bytes to read.

This sequence combines the write-read together; effectively, this operates as a single register write-read function, which should greatly improve your write-read timing.

We hope this answers your questions. Additional resources that you may find helpful include the following:

If you want more information, feel free to contact us with your questions, or request a demo that applies to your application.

Request a Demo