How Can I Make the Aardvark I2C/SPI Host Adapter Provide Interrupts to Get My Devices out of IDLE State?

Question from the Customer:

I am analyzing a device that supports NVMe MI 1.1, which also supports five Control Primitives.

To see how my device sends and receives MI Commands through the Side Band (OOB),

I am using two Aardvark I2C/SPI Host Adapters: one as a Master; one as a Slave.

My challenge is I am trying to work with a device that is in a constant IDLE state.  The device works very quickly with the MI Commands through the Side Band. Sending several MI Commands before Control Primitive does not hold the device in a state of TRANSMIT or PROCESS. Instead, the device is in IDLE state.

So far, sending PAUSE, RESUME, and ABORT Control Primitives has no effect. Using the Aardvark adapter, how can I get the devices out of the IDLE state?  Is there a way I can use the Aardvark adapter to send an INTERRUPT signal?

Response from Technical Support:

Thanks for your question! The Aardvark I2C/SPI Host Adapter does not have pins that are dedicated for interrupts. However, you can program the Aardvark adapter GPIO pins to mimic interrupt signals, which we’ll describe in the following sections.

GPIO and Interrupt Signals

When the Aardvark adapter is in either I2C or SPI mode, unused pins are available for use as GPIO. We provide the free Aardvark Software API, which you can use to mimic the desired interrupt signal via GPIO.  The API is provided with functional programs, one of which is aagpio.c. The complete program is included with the Aardvark Software API.

The aagpio.c function blocks until either a change occurs on the input GPIO lines or the function times out. With those attributes, it is possible to use any GPIO pin for an interrupt signal.

Interrupt Example

This is a summary of the information provided in the article Using the Aardvark I2C/SPI Host Adapter GPIO Feature to Support Interrupts.

Following is a code snippet that shows how the function aagpio.c can be used:

// Demonstrate use of aa_gpio_change
aa_gpio_direction(handle, 0x00);
u08 oldval = aa_gpio_get(handle);
printf("Calling aa_gpio_change for 2 seconds...\n");
u08 newval = aa_gpio_change(handle, 2000);
if (newval != oldval)
printf("  GPIO inputs changed.\n");
else
printf("  GPIO inputs did not change.\n");

How the “Interrupt” Command Works

The aa_gpio_change function takes two arguments:

  • aardvark: the handle to the Aardvark adapter
  • timeout: time to wait (milliseconds)

When a change occurs on the GPIO lines or the timeout elapses, the function returns the current value of the GPIO lines. Please note it is important that the code stores the old value of the GPIO lines for comparison.

For more information about aa_gpio_change and other details, please refer to the section API Documentation  and the subsection GPIO Interface of the  Aardvark I2C/SPI Host Adapter User Manual

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