From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Building a C API for NI 9222 DAQ Modules

Hi All

I've been playing around with the C API Generator for the cRio and come across a problem I'm having issues solving

I have attached a  LabView which has a FPGA vi which simply reads two NI9222 cards and sends data to the FIFO. I can build and compile the .lvbitx for the FPGA and then use the C API Generator to generate a .h file to use in a C program. I have done this and all seemed to work OK. Recently I went back to the same project, recompiled the FPGA and my .h file no longer contains the methods required to read the FIFO.

I get a message on completing the C API Generation that some resources were omitted because they're not types supported by the FPGA but i'm trying to send int16 elements to the FIFO and there's nowhere that says these are not supported by the C API generator.

I've attached two files NiFpga_NI_9222_Anologue_DAQ2_FPGA.h (working) and NiFpga_NI_9222_Anologue_DAQ2_FPGA_new .h (not working) so you can compare the difference.

The only difference I can think of is that I'm compiling on my computer instead of an NI cloud server. Could that cause this?

I've spent all afternoon looking at this and haven't made any progress so any nudges in the right direction would be appreciated.

Thanks for the help!

0 Kudos
Message 1 of 8
(4,767 Views)

Hi jamie_mac,

I would also expect I16 FIFOs to work just fine. I'll try the header file generation process with your FPGA VI and see what I find. What version of the C API Generator are you using?

Could you also attach the lvbitx file that you used to produce NiFpga_NI_9222_Anologue_DAQ2_FPGA_new .h? If you still have the original lvbitx file that would also be helpful.

Sebastian

0 Kudos
Message 2 of 8
(3,685 Views)

What change did you make that necessitated a recompile of the bitfile?

0 Kudos
Message 3 of 8
(3,686 Views)

Hey jamie_mac,

I tried compiling your FPGA VI and generating the C API header for it. I did find that I got an error dialog about some types not being supported, but the generated header still had the constant for the I16 Target to Host FIFO.

I found that I could eliminate the error about unsupported types by removing the error cluster and recompiling, since clusters are not supported by the C API. After removing the cluster I didn't get any errors and the FIFO was correctly added to the header file.

At this point, I think I need to see the problematic lvbitx file in order to figure out why it's not working for you.

Sebastian

0 Kudos
Message 4 of 8
(3,686 Views)

Hey Brad. I just wanted an indicator for the number of channels sampled. Very simple change

0 Kudos
Message 5 of 8
(3,686 Views)

Hi Speleator. After three attempts, last night I managed to get a .lvbitx file to compile properly and produce the correct header. I have no idea why things are working now as opposed to before which leaves two possibilities. 1) I did something stupid and haven't realised what or (more likely) 2) there's a bug somewhere which is hard to replicate (less likely).

Just to be thorough I tried this morning using the exact same setup and now the compiler is showing up an error (attached in text file). I've also attached the .lvbitx file although I messing around so much I can't remember wehtehr the FIFO was set to FXP or int16.

Cheers

Download All
0 Kudos
Message 6 of 8
(3,686 Views)

The attached lvbitx has an FXP FIFO in it, so it makes sense that the FIFO doesn't show up in the generated header.

As for the xilinx error, was there a change to the design? Or were you simply trying to re-compile an existing design? If you still have the FPGA VI that generated the error that would be helpful for debugging purposes.

0 Kudos
Message 7 of 8
(3,686 Views)

Hi Speleator. Thanks, yeah I suspected it might. I should have been thorough and kept a .lvbitx that didn't work with int16. Anyway, as for current problem here's the FPGA vi.

One I think I noticed is that I get a brief message which flashes for a few seconds telling me something about my compiler not being set up properly (also attached)

Thanks for your help- really appreciated.

Download All
0 Kudos
Message 8 of 8
(3,686 Views)