LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Communication with FPGA

I'm trying to do simple SPI communication with FPGA using a PCI-7813R. I have used "Simple SPI Communication" example as the basis (the part I used is below). Once the vi is running, I power the device used to send the information. If the timeouts are set at 40000 and 40000, it loops through the specified number of times, but returns no data (Boolean). If the timeouts are set at 40000(CS) and -1(CLK), the loop will increment by a random number (it's been 3, 8, 13, 25, etc) and stop. If I power off the device, the loop increments by one. Once I power on the device, it again increments by a random number. This generally results in True data when the device is powered, and False data when the device is off. I know the device is producing all three signals, as I have attached an oscilloscope with SPI bus capabilities to the device, and all the signals are perfect and work as expected. I'm not sure if it's the clock or the data portion of the program that's not working properly, or what's happening really. The chip select is active for 80 microseconds and the clock runs at 8MHz. Any help would be appreciated.

 

 

 

 

0 Kudos
Message 1 of 5
(2,956 Views)

Hello,

 

Did you try running the example as it is? And if so did it work for you?  My suggestion if not, is to get the example working as it is on the developer zone (I assume you are using this example: http://zone.ni.com/devzone/cda/epd/p/id/3458).  Then you should try removing parts that you think are unneccesary and try it again.  If there are errors, then the parts you cut out must be important (I am not directly familiar with this example, but it should work with no problems as it is posted).  I did notice that the example uses SCLK and your VI uses CLK.  I am unsure if this is significant, but you might consider checking to see how this affects it.  

 

0 Kudos
Message 2 of 5
(2,927 Views)

David,

 

I am using that example, yes. If I understand the code correctly, it should take a user input and write to the PCI card, then read it back. It doesn't need any external wiring or accessories as far as I know. However, when I run the example as downloaded, it doesn't return any value.  The only thing I changed about the project was to change the target from a PCI-7811R to a PCI-7813R. My knowledge of FPGA is limited, but in my research it seems like those two cards should function very similarly. Consecutive alterations to the actual code don't make it work properly. Since the example doesn't work, I'm guessing something is amiss with the PCI card??

 

Thanks,

Ryan 

0 Kudos
Message 3 of 5
(2,910 Views)
I wouldn't neccessarily say right away that the card is broken because one example doesn't work.  Have you tried running other examples on it?  Do they work as expected?
0 Kudos
Message 4 of 5
(2,887 Views)

HI, David_L 

 I am also now doing some research related with SPI communication based on PXIe-7846R fpga,glad you have some experience for this. Now i am trying to download the example for the link: http://zone.ni.com/devzone/cda/epd/p/id/3458, but it seems the attachment of the link is invalid now. is it possible for your side to send the example:FPGA SPI.lvproj to the email: lizongzongqi@163.com, thank you very much for your help! 

0 Kudos
Message 5 of 5
(2,012 Views)