Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

fpga configure trigger

Solved!
Go to solution

Quick question:   How do you configure the trigger in the FPGA C interface API? 

 

More details:

I am attempting to interface to an NI (7965R) through Matlab MEX (C) function.  I have programmed most the FPGA functions, including the NiFpga_ReadXXXX functions, the FIFO configuration functions, etc.   I call  NiFpga_Initialize,  NiFpga_Open and they return status 0.   The NIFpga_ReadArray functions return with status 0 but they don't return meaningful data (all zeros). 

 

However there is one function that appears in our Labview code that I can't seem to find a C interface equivalent for, and that is a function to configure the trigger.  Thsi is important because our FPGA is triggered externally.   When I call the ReadFIFO functions I am getting a timeout, no matter how long a timeout or how small of a buffer I give it.  I think because the trigger is misconfigured somehow.   

 

Update: OK, in the configure trigger VI, they call a 'Read/Write Control' VI, I'm assuming this means it calls an NIFpga_WriteXXX function ? 

 

 

0 Kudos
Message 1 of 6
(6,169 Views)

Hi Patrick,

 

Typically FPGA triggering is done with interrupts.  Our FPGA Interface provides an interrupt example.  If you have the latest version installed, you should be able to access the example by going to Start>>All Programs>>National Instruments>>NI FPGA Interface C API X.X>>NI FPGA Interface C API Examples>>IRQs.

Dave C.

Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(6,153 Views)

Actually I think I may have found the solution - I looked at the LabView code and it uses Read/Write Control.  So I need to call the WriteXXXX functions (for controls) and the ReadXXXX functions(for the indicators).   The mapping from the control/indicator name that I see in Labview to the integer values is defined in the header file when you use the conversion wizard.   

 

However, one of the controls is a cluster, which isn't supported by the conversion wizard.   I'm assuming I will have to change the cluster to a series of values or an array, and recompile the bits file, then re-run the conversion wizard? 

0 Kudos
Message 3 of 6
(6,150 Views)
Solution
Accepted by PatrickR

The conversion wizard wasn't able to convert the cluster because there isn't an exact correlation in C.  The closest representation would be a struct.  Changing to a series of values is probably the better option, unless the items in your structure are all the same data type.

Dave C.

Applications Engineer
National Instruments
Message 4 of 6
(6,131 Views)

Have tried the same memory dump four times with repeated calls of each of:

NiFpga_ReadArrayU32

NiFpga_ReadArrayU16

NiFpga_ReadI16

NiFpga_ReadU32

the array functions just repeat the first 4 bytes

the ReadI16 cannot cope with addresses which are only multiples of 2 rather than 4

no errors are reported

I advise you restrict yourself to using NiFpga_ReadU32.

Even then may need to consider swapped bytes? though this is more an Intel feature than an NI fault.

(was using a 7831R with 12.0 API)

Message 5 of 6
(5,981 Views)

Thanks, but we decided to just do everything in LabView as it was much easier.

0 Kudos
Message 6 of 6
(5,955 Views)