How Do I Emulate Multiple I2C Slave Devices with a Single Aardvark I2C/SPI Host Adapter?

Question from the Customer:

I am using my Aardvark I2C/SPI Host Adapter as an I2C slave. Currently, I am able to set a single required response in the message window for a request from the Master.

Can I set up my Aardvark adapter to emulate multiple I2C slave devices each with separate slave addresses?  My setup is simple:

  • I need to send the data from the Slave to the Master every 0.25 seconds.
  • The frequency of the I2C device is 100KHz.

My questions:

  • How can I emulate multiple I2C slave devices each with separate slave addresses using the Aardvark I2C/SPI adapter?
  • Will you provide an example for changing the slave address, setting the response, and enabling and disabling the I2C Slave operations?

Response from Technical Support:

Thanks for your question! In response to your very first question; YES, you can use your Aardvark host adapter to emulate multiple I2C slave devices even with separate slave addresses. It’s simple to do using the Aardvark Software API. The API allows you to write a script using one of the supported languages (such as C, Python, Visual Basic and others). Examples are included in the API and can be used as-is or modified for your specifications.  For your purposes, you will need to modify the script as follows:

  1. Set the I2C slave address
  2. Set the response data
  3. Enable the slave
  4. Wait for an external event (or, in your case, specify your wait time of  0.25 seconds).
  5. Disable the slave.
  6. Repeat steps 1 - 5 with a different slave address and different response data.

Make sure your I2C Master does not attempt to communicate with the Aardvark adapter slave while it is not enabled, or while the Aardvark adapter is executing one of the steps listed above.

For more information about the API, please refer to the section API Documentation in the Aardvark I2C/SPI Host Adapter User Manual.

Additional resources that you may find helpful include the following:

We hope this answers your question. If you have other questions about our host adapters or other Total Phase products, feel free to email us at sales@totalphase.com, or if you already own one of our devices and have a technical question, please submit a request for technical support.

Leave a Reply