SPI and I2C Communication Using a CompactRIO

Updated Oct 22, 2020

Reported In


  • NI-9401
  • NI-9402
  • CompactRIO Single-Board Controller
  • CompactRIO Controller

Issue Details

Is is possible to implement SPI or I2C communication using a CompactRIO?


Yes, it is possible. NI provides a free SPI and I2C driver API which uses the FPGA digital I/O lines to communicate with SPI or I2C devices.

When selecting the digital hardware there are three options to consider:
  • NI Single-Board RIO hardware works with both SPI and I2C drivers.
  • NI 9401 C Series module works best with SPI drivers.
  • NI 9402 C Series module works best with I2C drivers.

Additional Information

I2C communication requires the device to tri-state the DIO lines on the fly. The 9401 is unable to do this without external hardware. NI thus recommends the 9402 for I2C communication.

Note: Support for this product is provided on the NI Developer Forums at forums.ni.com