I am starting to use the Aardvark I2C/SPI Host Adapter and I have some questions about the GPIO pins, including how to program them with your software. I am using the Aardvark adapter with an I2C device.
The Aardvark I2C/SPI Host Adapter is compatible with both 3.3V and 5V signal levels out of the box. The I2C bus is open-drain and the Aardvark adapter contains pull-up resistors for the SCL and SDA lines. These lines are pulled up to 3.3V. We will go over controlling the signals using Aardvark Software API.
The Aardvark GPIO mode has six GPIO signals:
Which pins you can program is related to which mode the Aardvark adapter is enabled in:
For example, enabling the Aardvark adapter in I2C mode via aa_configure(handle, AA_CONFIG_GPIO_I2C) allows SPI pins 5, 7, 8 and 9 to be controlled with API calls. The I2C signal pins cannot be used as GPIO pins.
GPIO pins can be configured for input signals or output signals. For input signals, the internal pull-ups can be enabled for disabled.
When using the handle aa_configure(handle, AA_CONFIG_GPIO_I2C), the Aardvark adapter is set with GPIO+I2C configuration in which the SPI pins (pins 5, 7, 8, 9) are used as GPIO pins (GPIO# 02, 03, 04, 05).
The table below shows the corresponding GPIO number, pin number, and value. Please note, all six pins that could be used as GPIO are listed. The pins that apply for your I2C configuration are 5, 7, 8, and 9.
The values are assigned per bitmasks of six GPIO pins starting from GPIO00 to GPIO05.
For setting direction, when a line's bit is 0, the line is configured as an input. Otherwise, that will be an output. The value passed is 0x0C which sets GPIO00 and GPIO01 as input lines; this is not valid as these are I2C lines, not GPIO lines. Other available GPIOs (GPIO04 and GPIO05) are inputs. GPIO02 and GPIO03 are configured as output lines.
Setting Logic: aa_gpio_set(handle,0x0C)The 0x0C value is a bitmask that specifies which outputs are set to logic high and which outputs are set to logic low. With the value 0x0C, GPIO# 02 and GPIO# 03 are set to logic high.
We hope this answers your questions. Additional resources that you may find helpful include the following:
If you need more information, feel free to contact us with your questions, or request a demo that applies to your application.