LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI and I2C Driver API with NI-9401

Hi,

I'm planing to control two SPI devices using a cRio with 9401 module. The examples shows only slave devices that runs with the same clock frequency. In my application I have two devices that are rated with 2 Mhz and 20 Mhz respectively, also the Cpol and Cpha differs as well as the bit numbers. So my question is if it possible to configure the 9401 to run at two different configurations in parallel (not simultaneous of course). Both devices share a common spi bus which means that I could use one 9401 to set two CS outputs, the other two output would be data out and clock.

 

Best regards

Ahmed   

0 Kudos
Message 1 of 5
(559 Views)

I don't see why you cannot do that. You are just using FPGA IP to drive individual DIO ports.

Which IP are you using? Is it NI SPI IP Toolkit for LabVIEW?

0 Kudos
Message 2 of 5
(527 Views)

That is what I thought as well but it is not clear from the examples that come with the SPI and I2C Driver API how to do that (there is not much documentation on the VIs included in this package). No I'm not using the SPI IP Toolkit but the toolkit in the driver mentioned above. 

 

Best regards

Ahmed

 

0 Kudos
Message 3 of 5
(466 Views)

I did some time spending on the API but didn't really figure out how to do that. So I wrote my on "SPI bus". Haven't got the cRio and the 9401 modules yet so I'm not able to test the code. Anyhow I have included the FPGA VI just to illustrate what I wand to do. Note that the host will make sure that these two loops will not run at the same time. It is the first time I'm working with SPI interface so I would appreciate if I get any feed back on this VI.

 

Best regards

Ahmed

 

0 Kudos
Message 4 of 5
(439 Views)

After carefully reading the data sheets of the DAC and ADC, I wrote another version of the code. Hopefully this one will work.

0 Kudos
Message 5 of 5
(411 Views)