Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Using I2C or SPI communication with cRIO and NI 9403 Module and Scan Engine

Hi, I have a cRIO 9074 and the 9403 DIO module, and was hoping someone could help me figure out how to interface with a device that communicates over I2C or SPI.  I do not have access to the labview FPGA package, only the RT module and scan engine.  If anyone could help out, that would be greatly appreciated.  Thanks.

0 Kudos
Message 1 of 14
(14,057 Views)

Hello andrewp97,

 

I would have to strongly advise against doing this through RT instead of the FPGA. The scan engine period is only reliable down to about 1ms, which is too slow to be used at standard speeds for either communication protocol. The maximum typical SPI clock frequency is 50 kHz and the slowest standard speed for I2C is 100 kHz. RT is designed to be deterministic, but not necessarily fast -- the FPGA is where this type of communication should be done. Additionally, I2C would be difficult to implement with your hardware because the protocol uses bidirectional communication. Although the DIO lines on the 9403 can be configured as input or output, there will still be some latency in switching them from sinking to sourcing and vice versa.

 

You have a couple of options to interface with your I2C/SPI device. You can buy the FPGA module and use pre-made drivers for SPI and I2C communication or buy the USB-8452 SPI/I2C module instead of using the cRIO. With the USB-8452, the communication would be done with your Windows computer using pre-made libraries rather than to the cRIO.

Message 2 of 14
(14,032 Views)

"You can buy the FPGA module and use pre-made drivers for SPI and I2C communication "

 

Hello Siana

 

to which pre-made drivers you're referring to?

I'm trying to use the programs I've written Myrio I2C communication in a CRIO project.

Is this possible?

 

 

 

 

0 Kudos
Message 3 of 14
(13,959 Views)

Hello Maloya,

 

I am referring to the SPI and I2C driver API found here:
http://sine.ni.com/nips/cds/view/p/lang/en/nid/210637

It is based on the Real-Time and FPGA modules, so if you have that software available to you on your host computer you should be able to use this driver API. However, there might be an even easier option for you. The myRIO Toolkit has Express VIs that would allow you to configure I2C or SPI communication on the myRIO with very little work on your part. Here is a link to that:

http://www.ni.com/download/labview-myrio-toolkit-2014/4854/en/

Message 4 of 14
(13,951 Views)

Thanks Siana for the quick anwser.

I will check out the driver API.

I've already used the myRio I2C Express VI's. But now I want to integrate "I2C-sensors" in the CRio 9074, and those Express Vi's are not available there, if I'm not mistaken.

0 Kudos
Message 5 of 14
(13,943 Views)

I'm using the CRrio 9074 and the module NI 9401

0 Kudos
Message 6 of 14
(13,936 Views)

Hey Maloya,

 

So you know, the 9401 isn't officially supported with this driver API. It can be difficult to communicate over I2C on this module because its sinking and sourcing properties can make switching communication direction slow/difficult to control. Since I2C uses bidirectional communication on each line this adds some uncertainty in the system. If you already have the hardware, feel free to try it out! Otherwise, I might suggest either using the SPI protocol or switching to a USB-8451 SPI/I2C interface card instead.

0 Kudos
Message 7 of 14
(13,930 Views)

The 9403 due to his "Bidirectional, configurable by line with shift-on-the-fly capability" is more suitable for the I2C Communication?

Do you have experience with the Tangent Blue I2C/SPI Module?

http://www.tangentblue.com/products/index.php?main_page=product_info&products_id=181

 

Using the DAQ USB 8451 probably isn't our preferred solution, due to the need of an additional element (outside the Crio 9401).

 

Which Module would you recommend in general and specifically, when it comes to the I2C communication?

 

 

0 Kudos
Message 8 of 14
(13,926 Views)

Hello Maloya,

 

The switching times on the 9403 are well-defined, which would make communication easier to predict than with the 9401. However, as described in the NI 9403 Specifications document, the DIO lines take 18us to switch from input to output and vice versa. If that is suitable latency for your system, you can consider that card as an option!

0 Kudos
Message 9 of 14
(13,906 Views)

Side question since this thread is active. Would you expect the 9074+9403 to be reliable with these drivers/SPI due to the  monodirectional nature?

0 Kudos
Message 10 of 14
(13,868 Views)