Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with logging to USB on a cRIO

I am having some strange issues with a 9076 (and a 9012/9112) logging to a USB thumb drive from RT.

 

Essentially I have a DMA buffer wirtten to in FPGA and read out in a WHILE loop in RT.

 

This code works PERFECTLY WELL when either logging to the embedded flash or to an SSD drive connected via USB.

 

However, when connected to a USB thumb drive, the WRITE functions (I have used both the Write Bytes and the Write Binary) both take too long and my DMA buffer over-runs.

 

The highest data rate we have tried is 189bytes x 2KHz = 378Kb/sec, and we write the byes out in 9,450 or 18,900 byte chunks.

 

We tested several thumb drives on windows, and they move data much faster than this without trouble.  Some work perfectly, some work for a while and then we have errors, some don't work at all.

 

 

So just to reiterate:

  • Basic structure is to read 9450 or 18900 bytes out of DMA and write directly to the USB via the "Write Binary Data" (no array length) in a while loop.
  • Embedded flash and SSD drive on a USB-to-SATA connector work perfectly at 2KHz.
  • Thumb drives have problems.  Some work at lower rates, some don't work.  Only one seems to have no issues
  • These drives handle this throughput easily on Windows.
0 Kudos
Message 1 of 10
(6,692 Views)

Thumb drives are notorious for not running fast.  Most are made as cheap as possible.  Have you tested the actual write speed from Windows?  You can use this tool or make your own.  http://zone.ni.com/devzone/cda/epd/p/id/399

 

If you did find one model that works, buy a bunch and call it good.


--Using LV8.2, 8.6, 2009, 2012--
0 Kudos
Message 2 of 10
(6,690 Views)

Did you ever get any further with this. I'm experiencing a similar problem and I've tested my USB drive and the write speed is better that 3MB/s but I'm not getting any where need this speed when using LabVIEW real-time on the 9076

0 Kudos
Message 3 of 10
(6,155 Views)

Not getting enough speed at 3MBs per second?  If that is in bits then you are looking at writing 93750K double precision numbers a second.  How much faster do you need to record data?  What did you measure your USB stick speed at?

 

Wire_Warrior

Wire Warrior

Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!
0 Kudos
Message 4 of 10
(6,151 Views)

I think you misread what I said, I know the USB drive is capable of 3MB/s and I acheive this using a test program in Windows. Unfortunately when using the same USB drive with 9076 I'm getting a lot less. More like 16KB/second

0 Kudos
Message 5 of 10
(6,149 Views)

Your right I did misunderstand your post.  Sorry about that.

 

Can you post your code?  That would be the best way to help you find out what's happening.

 

Wire Warrior

Wire Warrior

Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!
0 Kudos
Message 6 of 10
(6,146 Views)

Okay I have an answer. I have been using the NI-9222 module example and modified this to write to the USB drive.  When I wrote 4000 elements from the FIFO to the file I was achieving a very low write rate.

 

The solution is to write to a queue in the FIFO read loop and in a separate while loop read from queue and write to the file. Using this method I was able to achieve a write rate of approximately 1MB/second. Still not as fast as the drive is capable of but fast enough for my requirements.

0 Kudos
Message 7 of 10
(6,138 Views)

Sorry I never followed up...

 

The 9076 does not write as fast as a windows machine; It's VERY dependent on the quality/make of the usb stick, even if you code as well as possible.

We tried about a half dozen "high-quality" usb3.0 sticks- the quality is across the board, even on the same brand/model.

 

In the end, we foudn that an SSD drive with a good USB3.0 adapter was the fastest solution.

0 Kudos
Message 8 of 10
(6,134 Views)

Thanks for the feedback.

 

At present I'm just using some USB drives I had which were available to me now and are 1GB drives. I'm going to buy some other drives which are 16GB or 32GB and are supposed to have 8MB write speeds. That probably will meet my requirements.

 

If necessary I'll try a SSD drive since it seem a faster solution so thanks for the advice

0 Kudos
Message 9 of 10
(6,130 Views)

Hi !

I know the thread is a little bit old, but this might be helpfull :

http://forums.ni.com/t5/Data-Acquisition-Idea-Exchange/Hard-Drive-cRIO-Modules/idc-p/3083536#M562

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 10 of 10
(5,173 Views)