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
Can I Use a Single Software Application to Operate I2C and SPI Host Adapters?
Rena Ayeras

Photo by Geralt

Question from the Customer:

I am working on a system that supports both I2C and SPI data buses. What I am trying to do is use a single program to operate both the Aardvark I2C/SPI Host Adapter and the Cheetah SPI Host Adapter. Here are the key steps of a continuous operation:

  1. An I2C GPIO port expander will set the Chip Selects for selected SPI devices.
  2. The Aardvark adapter will be used for I2C write.
  3. The Cheetah adapter will be used for SPI write/read.

I want to be able to run some batch scripts that will first use the Aardvark adapter for I2C write, then use the Cheetah adapter for SPI write/read. Then repeat.

On this system, the SPI bus runs much faster than the I2C bus, which is why I need to use both host adapters.

 Do you have any examples of what I want to do – use a single script to run the Aardvark adapter for I2C functions and the Cheetah adapter for SPI interactions? I am aware that I could use two instances of the Control Center Serial Software, one for each adapter, but that would be a cumbersome process to develop and maintain.

Response from Technical Support:

Thank you for your question! Normally we recommend using separate instances of the Control Center Serial Software for each device. For your request, we also provide Aardvark Software API and Cheetah Software API, which you can use to create a single script to run both adapters. Each API supports multiple programming languages and operating systems and comes with documented functional examples. If the script is complex, you could use batch scripting with the Control Center Serial Software to quickly try out ideas before creating the API scripts.

API Software for Custom I2C and SPI Scripts

Here is an overview of what we provide with API, which can be used as is or customized for your system.

Aardvark Adapter API

You can use Aardvark API examples and modify them as needed. All the scripts were written for writing/reading from the  Aardvark adapter to the Atmel SPI EEPROM AT25080A, which is on the I2C/SPI Activity Board.

  • aadetect: Detect Aardvark devices attached to the system.
  • aalights: Flash LEDs attached to a Philips PCA9554D I/O port expander as found on the Activity Board.
  • aai2c_eeprom: Read from or write to an I2C serial EEPROM, such as the Atmel AT24C02 on the Activity Board.
  • aaspi_eeprom - Read from or write to an SPI serial EEPROM, such as the Atmel AT25080A found on the Activity Board.
  • aai2c_file, aai2c_slave: Demonstrate the I2C slave functionality of the Aardvark device. This example requires two Aardvark devices. First run aai2c_slave with the first Aardvark device to wait for a new slave transmission. Then, in another shell, run aai2c_file to transmit a binary file with the second Aardvark device.
  • aaspi_file, aaspi_slave: Demonstrate the SPI slave functionality of the Aardvark device. This example requires two Aardvark devices. First run aaspi_slave with the first Aardvark device to wait for a new slave transmission. Then, in another shell, run aaspi_file to transmit a binary file with the second Aardvark device.
  • aagpio: Perform some simple GPIO tests with a single Aardvark adapter. The results can be verified using an oscilloscope or multimeter.

For more  information, please refer to the Aardvark API documentation.

Cheetah Adapter API

Here is a list of the Cheetah API examples:

  • detect - Detect Cheetah devices attached to the system.
  • blast - Shift a running 8-bit counter via SPI.
  • timing - Demonstrate the insertion of user defined delays in the middle of an SPI shifting sequence.
  • eeprom - Read from or write to an SPI serial EEPROM, such as the Atmel AT25080A found on the Activity Board.
  • flash - Read, write, verify, or erase a high-speed SPI Flash memory such as the ST Micro M25P32 found on the High-Speed SPI Flash demo board.
  • async - Demonstrate the use of the advanced asynchronous SPI shifting API.

For more  information, please refer to the Cheetah API documentation.

We hope this answers your question. 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.