I2C, SPI, and JTAG Communication with NI Digital I/O Devices

Updated Aug 14, 2019

Reported In


  • PXI-6552
  • NI-9375
  • NI-9401
  • NI-9402
  • NI-9403
  • PXI-6541
  • PXI-7953
  • PCI-4652
  • PXI-6513
  • PXI-6515
  • PXI-6259


Digital I/O (DIO), High Speed Digital I/O (HSDIO)

Issue Details

  • I want to communicate with a device using either the I2C, SPI, or JTAG protocols but I don't know which National Instruments Digital I/O devices can do this. What type of cards can do this type of communication?
  • Are there any pre-made libraries that I can use to implement these protocols on my Digital I/O device?


Choosing National Instruments Digital I/O Hardware for SPI, JTAG and I2C Communication:

Any National Instruments hardware-timed digital I/O (DIO) device can be used to communicate with SPI and JTAG devices. Many NI 65XX devices and Multifunction I/O devices are supported. Refer to a device's specifications to verify if hardware-timed DIO is supported.

To communicate with I2C devices, the DIO device needs an additional per-cycle tri-state feature to generate the waveform, as in the HSDIO 655X series.  Devices such as the NI 9402 can also work with I2C protocol because they are capable of bidirectional communication. The one thing to be aware of for these devices is the switching latency of the system which can be checked in the product manuals. 

Developing your Application Software:

NI's Systems Engineering group has developed some reference applications for these three common protocols, I2C, SPI and JTAG.

You can download these libraries using the setup.exe in the Attachments sections of the linked articles for each library. After downloading the library, you will be able to find examples in the Example Finder in LabVIEW by going to Help, Find Examples, then Browse according to Directory Structure. There the example(s) will be located under Library's name (such as I2C Digital Waveform, SPI Digital Waveform, or JTAG Digital Waveform).

Additional Information

The reference applications developed by the Systems Engineering group mentioned above include the the following:
  1. Generation of the protocol packets in software
  2. Interaction with the digital I/O devices to generate the waveform-of-packets into a signal.
The NI-HSDIO driver is used to program 654X/655X series devices and NI-DAQmx is used to program 653X/652X/651X/650X and Multifunction I/O devices . In the linked Serial Protocol Communication Reference Design for Digital Waveform Devices, there are examples for generating protocol packets using NI-HSDIO and NI-DAQmx compatible devices.

In addition, the software-timed digital I/O solutions for these protocols communications do not support the recognition and response of the acknowledge bit in hardware. However, this feature is not typically required in testing setups. For recognition and response in hardware of an acknowledge bit, you will need to look at one of our R Series cards with a programmable FPGA.

Note that for more straightforward implementation of SPI/I2C communication, you should consider using the USB-8451 or USB-8452 with the NI-845x driver: NI-845x.