Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use SPI with NI 9403 and cRIO-9014?

Hello, I'm trying to use the compact rio 9014 and an NI 9403 to talk to an external board via SPI.  Every example I have found at NI won't work with the 9403 because of method restrictions to the module.  I was looking at adis16060_example.zip to try to get it ported over to my target but the 9403 module doesn't support the methods in the example.  I first tried to code it myself using arrays, but the compilation failed due to overmapping. Does anyone have any ideas how to implement SPI using the NI 9403? Any examples I can find?

 

Thanks,

 

tcmoore

 

0 Kudos
Message 1 of 4
(4,172 Views)

It sounds like you've found some examples already. I stumbled upon this one, which you may find useful: Simple SPI Communication with LabVIEW FPGA and the PXI-7831R

 

All of these examples will probably require some modifications to the code in order to work with the 9403. The example above, for instance, uses only 4 DIO channels of an R series board. You can probably modify this code for your needs. Which methods of the 9403 were you referring to? 

Misha
0 Kudos
Message 2 of 4
(4,157 Views)

Thanks Misha for the example.  It has been helpful.  Yes, I have found a few examples @ NI which implement SPI.  I can now get SPI to work but my problem is that I have to transfer large amounts of data from the slave to the cRIO Master. I have to transfer 176 bits for one command. I have to transfer 262,064 bits for another command! The large number of bits is because I am getting the bits from non-volatile memory on the slave and transferring them using SPI to the cRIO Master.  I used arrays to hold the values.  But when I compile, the FPGA compilation fails due to over-mapping issues.  I have read that some of the steps to optimize the code is: to remove as many front panel objects as necessary, and to use as few arrays as necessary.  What can be used besides arrays that will allow the compilation to succeed?

 

Thanks for your help,

 

tcmoore

0 Kudos
Message 3 of 4
(4,142 Views)

Sure, there are many optimization techniques out there. One of the best resources available on our website is this powerpoint

on this page of FPGA training modules.  Specifically, you may want to look into bit packing your bits into larger integers for your application. You can find many other techniques in that document. 

The array you're talking about is the primary reason for not being able to compile your code. See if you can replace this array with a lookup table. There are a couple shipping examples in the example finder on the use of lookup tables. 

Hope this helps!

Misha
0 Kudos
Message 4 of 4
(4,128 Views)