LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cRIO: build path to write tdms file on USB flash drive

Solved!
Go to solution

I've written the code in the 1st figure below, to open & create a tdms file on my USB flash drive which is plugged into cRIO USB port. 

 

The appended tdms path is shown in the 2nd figure below. 

 

But I'm getting the error in the 3rd figure below. I'm wondering how I can fix this problem. 

 

undefined

undefined

 

undefined

 

0 Kudos
Message 1 of 13
(7,535 Views)

- are you sure the driver letter is D:? Shouldn't be U:?

- Create a .txt file on your PC and then just try to open it and see what happens.

Message 2 of 13
(7,524 Views)

When I use "U:\" I get the following error. 

 

My code is running on cRIO I can not run it on my PC. 

 

undefined

0 Kudos
Message 3 of 13
(7,522 Views)

Just to make sure the dive letter is correct, try creating a .txt file using your PC and your USB drive.

Then, on your target, create a test Vi to read the .txt that is in the USB. Try different drive letters (V:, X:, etc) until you find the correct one.

 

 

 

0 Kudos
Message 4 of 13
(7,515 Views)

I created a sample TDMS file on my flash with my PC, then I tried to open it with my cRIO but I got the same error which says "File not found. The file path..."

 

When using the MAX (Measurement & Automation Explorer) for file transfer, I see the following window. 

The point is that the file transfer does NOT show my USB flash drive which is connected to cRIO. 

 

Also, the file path of cRIO are Linux-like, I mean like "/" NOT like windows "C:\" or "D:\" or...

 

 

undefined

0 Kudos
Message 5 of 13
(7,512 Views)

Also, when I use the "Current VI Path" function, I get the following path: 

 

undefined

0 Kudos
Message 6 of 13
(7,508 Views)

By the way, when I use a "c:\" path like the figure below, the code saves the proper file on the cRIO internal memory without error. 

 

undefined

0 Kudos
Message 7 of 13
(7,504 Views)

I tried all the alphabetical letters: 

 

For "c:\" the code saves the file on the local cRIO memory. 

For "d:\" the code gives the 1st error below.

For all other letters, the code gives the 2nd error below. 

 

Error for "d:\"

 

undefined

 

 

Error for all the letters except "c:\" and "d:\"

 

undefined

 

0 Kudos
Message 8 of 13
(7,498 Views)
Solution
Accepted by topic author Cashany

Cashany,

Make sure the USB drive is formated to FAT32 as the cRIO cannot mount NTSF or other file systems.

 

Also, and this is potentially incredibly important:

 

There is a known memory leak issue that is easy to prevent (without code changes!) assoicated with using TDMS on cRIO's.

This issue only happens on vxWORKS targets (e.g. cRIO 9014), not on the PharLap targets (as far as I know).

The issue happens when you close a TDMS file reference, the vxWORKS OS is unable to properly unload the TDMS library. Next time you open a TDMS reference, the library is loaded again, so over a very long time you will run out of memory.

 

The fix is super-simple:

on your cRIO, find the ni-rt.ini file, then scroll to the [LVRT] section of the ini file and locate the key called "StartupDlls"

Make sure that "tdms.out" is included. For example, depending on your cRIO, it may look like this:

StartupDlls=nisysrpc.out;NiRioRpc.out;NiViSrvr.out;

In which case you would edit the line to look like this:

StartupDlls=nisysrpc.out;NiRioRpc.out;NiViSrvr.out;tdms.out;

 

This will prevent the LabVIEW runtime engine on the cRIO from trying to unload the tdms library, forcing it to be in memory from boot-up until forever. This eliminates the memory leak you would otherwise experience.

 

Good luck!

Q

QFang
-------------
CLD LabVIEW 7.1 to 2016
Message 10 of 13
(7,482 Views)