How To Use Scan Engine and FPGA Simultaneously on a CompactRIO (Hybrid Mode)

Updated Apr 29, 2024

Environment

Hardware

  • CompactRIO Controller
  • CompactRIO Chassis

Software

  • LabVIEW Real-Time Module
  • LabVIEW

I want to use some of my C Series modules in Scan Interface and some in LabVIEW FPGA Interface. There is no explicit option to do this in the chassis properties. How can I set up my project to do this?

Using the Scan Interface and LabVIEW FPGA Interface at the same time on a CompactRIO target is known as Hybrid Mode. This will allow you to use some of the modules with the Scan Interface using I/O variables while other modules are programmed using FPGA. Be aware that some C Series modules are not compatible with the Scan Interface, so using Hybrid Mode may help reduce the amount of programming for the final application. 

Note: A given module can only be used in either Scan Interface mode or FPGA mode, but not both.
Note: Some CompactRIO controllers support NI-DAQmx. For these controllers, it is recommended to use the DAQmx API instead of Real-Time Scan Interface mode. 

Using Hybrid Mode will have two effects on the final application:
  • The compile time will significantly increase because the compiler has to compile the default RIO Scan Interface logic with your custom FPGA code into one bitfile.
  • The number of DMA FIFOs that can be used by your FPGA code will be reduced since the Scan Interface uses two DMA FIFOs. To verify the number of DMA FIFOs available on your target, please refer to KnowledgeBase How Many DMA Channels are on My FPGA Target ?

To set up your CompactRIO in Hybrid Mode, use the following steps:
1. Create a new LabVIEW project and right-click the top-level project item in the Project Explorer window. Select New»Targets and Devices to display the Add Targets and Devices dialog box.



2. If you have hardware installed, ensure Existing target or device is selected, expand Real-Time CompactRIO, and select your CompactRIO controller. Click OK.



3. If you do not have hardware installed, check New target or device, expand Real-Time CompactRIO, and select your CompactRIO controller. Click OK. If you do not have an integrated controller and chassis, right-click on the target and select New»Targets and Devices. Select New target or device, expand CompactRIO Chassis, and select your chassis. Click OK.
4. If the Select Programming Mode dialog box appears, select Scan Interface. Click Continue.



5.If the Discover C Series Modules? dialog box appears, click Discover. This will add the C Series modules to your project under the chassis.



6. Add a FPGA target to your chassis by right-clicking on the chassis and selecting New»FPGA Target.



7. If you see the Deploy CompactRIO Chassis Settings? dialog box, choose Deploy Later. You will put the chassis in LabVIEW FPGA Interface mode after setting up the project.



8. Drag any modules that you want to interface with using the LabVIEW FPGA Interface mode under the FPGA target. The module I/O will also appear in a folder underneath the FPGA Target and disappear from the chassis.



9. If you have any modules that are not compatible with the Scan Interface, add them to the FPGA Target by right-clicking on the FPGA Target and selecting New»C Series Modules. Add an existing module or manually add the module to your project.



Note: Starting with the RIO 17.0 drivers, a new folder is added to the project tree under the Chassis item called "RSI Resources" or "Real-Time Scan Resources". This item contains all the modules that you choose to program in Scan Interface mode. To add a C Series module to the project in Scan Interface mode, right-click on Real-Time Scan Resources and select New » C Series Modules. This is the same process used for adding modules to the FPGA Target in FPGA Interface mode, described above. 



10. If you are connected to the target, right-click the chassis in the project and select Deploy. If you are not connected to the target, ensure that you deploy the chassis in LabVIEW FPGA Interface mode once you connect to the hardware and before you run your application.



11. Create a new VI under the FPGA Target by right-clicking on the FPGA Target and selecting New»VI. Implement your FPGA code using the FPGA I/O nodes for the modules that are being used in the LabVIEW FPGA Interface mode.
12. Compile the VI. This will add the RIO Scan Interface logic into your FPGA code and allow the application to simultaneously use the Scan Engine and FPGA.

Note: The cRIO-904x and 905x controllers also support DAQmx programming. To add a C Series module to the project in Real-Time CPU mode (for NI-DAQmx programming), right-click on Real-Time Resources and select New » C Series Modules. This is the same process used for adding modules to the project for other programming modes, as described above. For these devices, you can choose DAQmx or FPGA mode on a module-by-module basis.

Additional Information

Using hybrid mode means there will be some C Series modules under the RT Target and some C Series modules under the FPGA Target in the LabVIEW Project.


If you receive the following error when trying to run your application, ensure the chassis is in LabVIEW FPGA Interface mode.
 
Error -61141: LabVIEW FPGA: The operation could not be performed because the FPGA is busy. Stop all activities on the FPGA before requesting this operation. If the target is in Scan Interface programming mode, put it in FPGA Interface programming mode.




1. Right-click the chassis in the project and select Properties.


2. Ensure LabVIEW FPGA Interface is selected. Click OK.


3. Right-click the chassis and select Deploy.