I2C Interface Usage Requirements and Guidelines

The I2C interface does not support asynchronous behavior. Therefore, functions such as fprintf, fscanf, and query do not work. Use fread and fwrite to communicate using this interface.

You need to have either a Total Phase Aardvark host adapter or a NI USB-845x adapter board installed to use the i2c interface. The following sections describe requirements for each option.

Aardvark-specific Requirements

To use the I2C interface with the Aardvark adapter, you must download the Hardware Support Package to obtain the necessary files. You must also download the USB device driver from the vendor.

If you do not have the Aardvark driver installed, see Install the Total Phase Aardvark I2C/SPI Interface Support Package.

You must install the Aardvark Software API and Share Library appropriate for your operating system.

The aardvark.dll file that comes with the Total Phase Aardvark adapter board must be available in one of the following locations for use on Windows® platforms.

  • The location where MATLAB was started from (Bin folder).

  • The MATLAB current folder (PWD).

  • The Windows folder C:\winnt or C:\windows.

  • The folders listed in the PATH environment variable.

The aardvark.so file that comes with the Total Phase Aardvark adapter board must be in your MATLAB path for use on Linux platforms.

If you repower your Aardvark board, set the GPIO pins to output to get communication with a device to work. By default they are configured as input.

NI USB-845x-specific Requirements

To use the I2C interface with the NI USB-845x adapter, you must download the Hardware Support Package to obtain the latest driver, if you do not already have the driver installed. If you already have the latest driver installed, you do not need to download this Support Package.

If you do not have the NI USB-845x driver installed, see Install the NI-845x I2C/SPI Interface Support Package.

Devices differ in their use of pullups. The Aardvark and NI USB-8452 adapters have internal pullup resistors to tie both bus lines to VDD, and can be set programmatically. The NI USB-8451 adapter does not have this type of internal pullup resistor and, therefore, requires external pullups. Consult your device documentation to ensure that you are using the correct pullups.

Related Topics