NI Labs

cancel
Showing results for 
Search instead for 
Did you mean: 

C Interface to LabVIEW FPGA

Both Cluster and Fixed-Point data types will not be supported in the initial release of this feature, but they are both features we are considering for future releases.

 

Thanks again for all of your feedback. Keep it coming!

0 Kudos
Message 21 of 79
(9,455 Views)

Hello,

        I tried the C Interface example from http://zone.ni.com/devzone/cda/tut/p/id/8638, with only changing on Target to 7842R. But when i excute the code in CVI 9.0, it halts with the fatal run-time error on NiFpga.c line 62, col 11, screen shot is provided below, what's wrong?

        And if i use this tool for mxi CompactRIO 9052, i think examples for PCI/PXI RIO should be used, since the host is working on windows rather than Vxworks, am i right?

        Thanks

0 Kudos
Message 22 of 79
(9,379 Views)
Hey Frank-Fang,

Did you rebuild the C FPGA Interface with the capigen.exe executable? You won't be able to run the example code out of the box with the 7842R without rebuilding the interface (the example was compiled for a 7853R). 

After modifying your LabVIEW FPGA project for the 7842R and recompiling the VI, try following the steps in the "Generating the C FPGA Interface" section of the tutorial to generate a new binary file and header file from your FPGA bitfile. Put the generated files in your project folder and see if it fixes the error.
Regards,

Chris Delvizis
National Instruments
0 Kudos
Message 23 of 79
(9,346 Views)
Can you provide us with a stack trace at the point of the crash? In CVI it is an option on the "run" menu...
NI Software Engineer - RIO
0 Kudos
Message 24 of 79
(9,336 Views)

Hi,

      Thanks for your reply. I did rebuild the FPGA Code and add the file to the CVI project as described in the tutorial. And the first printscreen i  attached in my last post is the stack trace but i would attach it again if it could help.

 

Best regards

0 Kudos
Message 25 of 79
(9,316 Views)

The most likely explanation is a problem with the data file that's output by the generator tool. Try re-running the generator tool to produce a fresh version of that file, and make sure that the "bitfile" parameter to NiFpga_Open() points to it correctly. Note that if the "bitfile" parameter is a relative path it will be interpreted relative to the working directory of your application. Consider making it an absolute path until your application is working.

 

Also be aware that the format for the binary file changed after DMA and array support was added. Most notably, the file extension changed from ".bin" to ".lvbitx". Download the NI Labs package again to make sure you have the latest version, and make sure your application is pointing to a ".lvbitx" file.

 

If the problem persists, try using another debugger (such as WinDBG) and getting a stack trace in that. CVI does not report stack levels outside of CVI managed code, so we cannot the cause of the error yet. 

NI Software Engineer - RIO
Message 26 of 79
(9,302 Views)

koutnym,

 

Could you please give more specifics on the problem you were having with stdint.h? We include stdint.h if you're compiling under C99, or if you're using GCC on VxWorks. Do you fall under both cases, or just the latter? Also, what warnings/errors do you get when it is included? How do the two stdint.h's you mentioned differ?

 

Thanks for your help.

0 Kudos
Message 27 of 79
(9,269 Views)

Hi ,

      I tired again and now the example works. I believe i did someting wrong with the resource name and thanks for your help.
      But now i'm trying some more complicated applications: I have a FPGA code with 2 target to host DMA and 1 target scoped DMA which are defined in the project explorer and other 2 target scoped DMA defined in the code, and i also used the fixed-point toolkit.

      In LabVIEW, the FPGA code can be called and works OK. But when i call it in CVI with C Interface toolkit. It runs into an error -52005 on the 'error check' right after the 'NiFpga_Open()' function (See Fig 1 attached). So it means that even the session can not be opened, doesn't it. And there's no other explain on the message box except the error code. So can you help to find out what does the code mean and what may be the cause for this error? I'm using the lib NiFpga.dll(1.0.0.3) and i believe it's the latest version.
      Btw, i believe the error has nothing to do with the FXP toolkit since i have one code with FXP that works. And all the data i used in target to Host FIFO have been converted to integer. It would be great if the error list for C Interface tools can be provided if it's OK for WEB.
      And any reply or trying to solve the problem will be highly appreciated since i'm on an urgent project.

 

Best regards

Download All
0 Kudos
Message 28 of 79
(9,231 Views)

Hi kentyman,

 

sorry for response delay... as concerning previously mentioned "stdint.h" issue...

 

I am using WindRiver-GPPVE-3.6-PPC-Eval distribution package (VxWorks 6.6) in the same way as is described on NI web pages with VxWorks 6.3 package provided by NI. Previously I tried to evaluate Wind River Workbench 3.0 environment. Since my evaluation period expired I have asked for license price.... uhmmmm pretty tough I would say. So I switched to the Notepad "environment" and command line processing on VxWorks 6.6 distribution package.

 

The difference between VxWorks 6.3 from NI and VxWorks 6.6 I am currently using is "stdint.h" file. In VxWorks 6.6 package is "stdint.h" file located here: "C:\WindRiver-GPPVE-3.6-PPC-Eval\vxworks-6.6\target\usr\h" and I am not able properly compile my files when it is included. The simplified error list tells me:

 

    C:/WindRiver-GPPVE-3.6-PPC-Eval/vxworks-6.6/target/usr/h/stdint.h:26: error: redefinition of typedef 'int8_t'
    C:/WindRiver-GPPVE-3.6-PPC-Eval/vxworks-6.6/target/usr/h/types/vxTypes.h:173: error: previous declaration of 'int8_t' was here

    .

    .

    . 

 

So I took "stdint.h" from NI's VxWorks 6.3 and copied it to my project folder and included it in Makefile paths (like this "IDE_INCLUDES = -I."). Then build went fine, everything is working. I do not why and I do not take care. I do not wish to go deeper, I am happy as it is. I am always kind of lost with the command line processing, environment options and other for me "hidden stuff".

 

Attached you can find "stdint.h" file for VxWorks 6.3 and VxWorks 6.6.

0 Kudos
Message 29 of 79
(9,221 Views)

The most likely explanation for the error you're seeing is a signature mismatch error. Every time an FPGA VI is compiled, a new unique signature is produced. The C API generator puts this signature in a constant (e.g: NiFpga_MCMDemoFpga_Signature) to make it easy to pass to NiFpga_Open() which compares the signature parameter with the signature for the VI and returns error -52005 if they don't match.

 

Try running the C API generator again and look for a change in NiFpga_MCMDemoFpga_Signature in the header that comes out. Let us know if that doesn't clear things up.

 

In the future, we'll be using a proper "signature mismatch" error code for this case. For descriptions of error from the C interface, please refer to the "NiFpga.h" file that the generated header includes.

NI Software Engineer - RIO
0 Kudos
Message 30 of 79
(9,208 Views)