To download NI software, including the products shown below, visit ni.com/downloads.
This example showing a SPI implementation on NI FlexRIO with digital FlexRIO Adapter Module. The implementation is bassed on NI SPI IP. You can run this example in simulation mode or with real IO.
Description-Separate-2
Download the attached .zip file and unzip the file.
Install the NI SPI IP with help of the VI-Package Manager. You can either search in the VI-Package Manger for NI SPI IP or you can use the package in the following location: Exercise>>FlexRIO SPI Example with Simulation>>NI SPI IP for offline installation>>national_instruments_lib_ni_spi_ip-1.3.0.1.vip
Open the FlexRIO – NI SPI FPGA Simulation.lvp
Open the VI in project FlexRIO - NI SPI FPGA Simulation and Real IO - FPGA.vi and analyze the Frontpanel and Blockdiagram.
Note:
- The FPGA Execution mode is: Simulation
- All hardware related funktions are disabled by using conditional case structures.
- The SPI Master and Slave are connected in the Master/Slave Connection loop via Local Variables and Wires instead of using a physical connection.
Run the VI, change the values in the Master Data Write and Slave Data Write controls. Press the Start button to send the new values.
Stop the VI.
For better understanding how SPI works, open FlexRIO - NI SPI FPGA Simulation - Host.vi and run it. This VI running cycle accurate the FPGA Simulation and show the signals in a Digital Waveform graph.
Stop the VI
For using Real IO, only switch the Execution mode to FPGA Target and compile the FPGA VI.
Connect the four DIO lines Chip Selecct, Clock, MOSI and MISO to get a loop back setup.
Note: If the FlexRIO boad or the adapter module don’t fit to your setup and you want to use another Digital FlexRIO Adapter, add both to the project and copy or move the FPGA files to the new target.
How-Separate-2
Software
Hardware
Additional-Separate-2
Helpful Knowledge Base: Understanding the SPI Bus with NI LabVIEW.
Related-Separate-2
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.