Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

High speed acquisition on a cRIO

Hi,

I have a cRIO which has been used for several years to control and log data in free-running marine vehicle models. Iteration rates have been around 20-50Hz.

I have now been asked whether this system can log 7 analogue channels at 100 kHz. Is this sort of rate possible?

Nick
0 Kudos
Message 1 of 11
(7,074 Views)

I believe it's possible. Have a look at the NI 9221. Also, have a look at some other modules that might be helpful:

Find the Right Data Acquisition Product

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 11
(7,070 Views)
Thanks for that link - looks useful.

However, this article (http://zone.ni.com/devzone/cda/tut/p/id/3268) suggests that there may be a bottle-neck in transferring data from the FPGA to the RIO host.

"When using the CompactRIO Reconfigurable Embedded System, the data transfer rate between the RIO FPGA chipset and the embedded CompactRIO real-time controller is typically limited to about 70-100 kB/s. If the data is transferred as 16-bit words, this is equivalent to transferring the data from a 35-50 kS/s acquisition from one channel. The specific maximum transfer rate depends on the amount of processing and other operations that are performed in the LabVIEW Real-Time application."

Is this a problem, or can the FPGA log data somehow? (Sorry for the ignorance, I've only used the template FPGA VIs to transfer data to my host using front panel values).
0 Kudos
Message 3 of 11
(7,066 Views)

Nick,

 

The transfer rates listed in that article seem to be a bit on the conservartive side, especially for the PXI controller. It is true that the

tranfer rate you will achive from FPGA to RT controller on cRIO will significantly depend on the rest of the code that will be running on the RT controller. In addition the transfer rates will vary with the different cRIO controllers and their different processors.

 

However, even for the older cRIO controllers if you do not do a lot of processing on the RT side, you should be able to achieve a data transfer rate around 1 MB/s, and possibly higher for very simple RT programs or newer cRIO controllers. To achieve these transfer rates you will always have to use the DMA FIFOs on FPGA and RT, so it will be a bit different from your previous programming.

 

Here's a number of additional useful articles:

 

Stream to Disk Benchmarks for cRIO Controllers

 

You can stream data from FPGA to RT and then to local disk at rates between 1.5 and 6.3 MB/s depending on the controller and file format.

 

Reference Applications for cRIO Waveform Acquisition

 

Ready-made application and higher level VIs for waveform acquisition and streaming from FPGA to RT on cRIO. This method achieves similar transfer rates to the previous article (1.64-7.37 MB/s).

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
0 Kudos
Message 4 of 11
(7,054 Views)
Thank you for these links.

I think I am now satisfied that it can be done - particularly now as my customer's sample rate requirement has come down!

I have my local NI field engineer calling in during the next week so we should be able to check out the hardware requirements.

Thanks again, Nick.
0 Kudos
Message 5 of 11
(7,049 Views)

Hi,

my name is Mário and i have a problem with high speed acquisition on my cRIO...i hope i'm not being inconvinient but i'm getting hopeless..

i'm working with a cRIO 9012, a NI 9111 chassis and i'm using a NI 9474 module to generate a PWM and  a NI 9201 module to view the PWM, i've already tried many codes, diferent timing engines and so on...and all i get it's something that is not the signal that i am generating.

i can not realise what's the "wait until next ms multiple" for and how to configure it to have a valid acquisition. I'll attach a pic of my acquisition and the VI's i'm using.

Any kind of help will be very very appreciatted..

 

Thanks a lot.

Mário Silva

0 Kudos
Message 6 of 11
(6,590 Views)

I'm afraid that I can't be of help in your particular application, but my final solution was to use one of the example VIs which shipped with the NI 9205 (Advanced IO). Removed the waveform chart (which slowed it down), added a Write Binary File block and I was away, getting 5-6 kHz.

0 Kudos
Message 7 of 11
(6,583 Views)

The problem is related to the handshaking (or lack thereof) that you use between the FPGA and Host VI to determine when to read data in the host from the FPGA.

 

The FPGA VI starts to acquire data and will acquire data continuously at the rate specified by Loop Rate (ticks). The first time through the loop it will also set the Data Read 0 and Acquisition On flags to true.

 

In the host VI you wait fro Data Ready 0 to be true once at the very beginning, but then you go into your main loop where you read the data from the FPGA and no longer check either of these flags. You read Acqusition On but you do not use it for anything in your program logic. At this point your main loop reads data from the FPGA at the rate specified by the Wait (us) parameter on the front panel of the host VI.

 

If Wait (us) and Freq Loop Rate (Hz) do not macth up, then you will read eitehr too many or to few data points, meeaning you will read the same data point more than once from the FPGA or yo iwll miss some data points altogether. In your case you FPGA Loop rate is set to 20 kHz (50 us) and your Wait time is set to 70006 us (14.3 Hz), so I expect that you are missing a lot of data in your host VI.

 

You need to synchronize the FPGA loop and the host loop to read all of the data points acquired by the FPGA. You can use one of the flags (Data Ready 0) that you have defined on the FPGA for this purpose. After reading a data point in the host VI, reset this flag to False from the host VI. In the same loop on your host VI before you read a data value form the FPGA, check the Data Ready 0 flag and wait for it to be True before reading the next data value. This will then synchronize your host VI loop with the FPGA acquisition loop.

 

 


 

 

However, your best solution is to use DMA instead of transferring data using the front panel indicators. In your example you are trying to acquire data at 20 kHz and transfer a data point every 50 us. On a cRIO 9012 controller this may be too much for the processor to handle in addition to all of the other code (reading/writing chart properties) you have in the same loop on the host VI. With DMA you define a FIFO between the FPGA and host that transfers data in the background from the FPGA to space allocated in the host memory. In the host VI you can read out blocks of data from the DMA FIFO so that you can read 20 points every 1 ms for example. This reduces the overhead in your host VI and you can transfer data much faster than using the front panel indicators.

 

Take a look at the cRIO DMA example to learn how to use this function.

 

C:\Program Files\National Instruments\LabVIEW 2009\examples\CompactRIO\FPGA Fundamentals\DMA\DMA Buffered Acquisition\DMA Buffered Acquisition - cRIO.lvproj

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
0 Kudos
Message 8 of 11
(6,570 Views)

Hi Nick Kimber and Christian L,

 

first of all i'd like to thank you for your cooperation, this will give me some clean air to breathe again...

the flags that have in my code like Acquisition On and PWM On was just to see if i was realy getting into the loops, cause i was about to try everything.

by the way..while i was searching for answers on NI forum and toturials and so on, i notice that almost every host code have a Wait (ms) and i wonder...What's the waiting for when i'm looking for speed?? It's not too much Wait miliseconds?

I've seen an example of transfering data on this link "http://zone.ni.com/devzone/cda/tut/p/id/11198" and i tried it but i didn't get too much from it. I wil try the way you tell me and i'll let you know if i got something interesting.

just in case, my application is about to control an IGBT module 1200V/600A, that's why i need fast acquisition.

 

Thanks again both of you and have a nice day.

Mário Silva

0 Kudos
Message 9 of 11
(6,539 Views)

Hi Christian L,

 

that's me again... i have tried the acquisition the way you said, and i must thank you, it worked almost perfect. The thing is, that, when i push Loop Rate too high (like 200kHz) the Overflow flag turns on, and when i push it to 1MHz i get the Underflow flag on. I'm setting a 18kHz PWM sine and i can see it very well on my scope but in the front panel it doesn't have a really vertical PWM shape...could this be a hardware barrier or it is a bug from the code i'm using?

I couldn't find the location for the example you've told me, seems like i just don't have it, can you provide it to me or some tuturial where i can see an identical code and understand it?

The code i'm using i get it from FPGA wizard. I only tried with one channel, do you think that it can get wors as i'm starting to grow the number of channels??

 

Thanks a lot.

Mário Silva

0 Kudos
Message 10 of 11
(6,528 Views)