I am using the Aardvark I2C/SPI Host Adapter with an I2C device and need to access specific registers. For example:
0x02
0x03What is the best way to do this?
Response from Technical Support:Thanks for your question! For register-level I2C communication, we recommend using our free Control Center Serial Software in Batch Mode, which allows you to create custom XML scripts for I2C transactions..
When using the GUI dialog, register reads are simplified by automatically combining the I2C write and read transactions into a single operation. While this makes basic register reads easy, it does not support writing to one register and then reading from a different register.
Batch Mode gives you full control over the I2C transactions, allowing you to create custom sequences such as writing to one register address and reading from another.
For example, to read 4 bytes from register 0x11 on an I2C device with slave address 0x55, you can do the following:
<i2c_write addr="0x55" count="1" nostop="1" radix="hex">11</i2c_write><i2c_read addr=" count="4"/>
Shown below is an example of a full I2C transaction that is sent on the I2C bus for master register write/read.
Master Register Write:
Control Center Serial Software displays a transaction log showing the exact I2C traffic sent on the bus. Comparing this log with your device's datasheet can help verify that the communication sequence matches the device's requirements.
For an example of implementing writing to an I2C device and then reading from a specific register, please refer to the article Which Software Tool Should I Use with the Aardvark I2C/SPI Host Adapter to Read the Status Register Information?
You can also watch the following video to learn more about using Batch Mode, which demonstrates how to create XML scripts and view the resulting transaction log.
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.