LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

detect usb drive on crio

Hi all,
 
I'm using a crio-9014 to build a small data logger which saves its data onto an external USB hard drive. For usability and data safety reasons, I would like to add an indication wheter the USB drive was recognized correctly or not (e.g. fast flashing of the user LED at startup when there is no drive detected).
 
My problem is: How do I detect if there is a proper mounted, accessible USB drive at the port? If I just perform a write to, say, "u:\test.txt" and there is no USB drive, I don't get an error from the write function - it just writes the file to "c:\u\test.txt". So just trying to write something to the USB drive and looking for an error doesn't seem to work.
 
Does anybody know of a way of checking if the u:\ drive is correctly mounted on a VxWorks controller?
 
Thanks,
 
Stefan
0 Kudos
Message 1 of 7
(7,428 Views)
You should get the contents of the root:

The 'folders' are the volumes currently available on the computer.

Ton

Message Edited by TonP on 08-17-2007 12:20 PM

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 7
(7,421 Views)

Thanks Ton,

this will work - but only if you don't have a folder called "u" on your crio (which is created if you try to access the u:\ drive without a USB drive attached).

So my problem is - if somebody disconnects the drive while the logger is running, it will create this folder and then not be able to detect a missing drive anymore at the next startup.

Regards,

 

Stefan

0 Kudos
Message 3 of 7
(7,404 Views)

I just found out one more thing:

What Ton proposes works on a Windows Machine - on the VxWorks cRIO controller listing the folders of the Root will list the folders of the Root of the flash drive - which is drive c:\!

So this will not work on the cRIO controller. Any other ideas?

 

Stefan

Message Edited by StGl on 08-17-2007 01:45 PM

0 Kudos
Message 4 of 7
(7,406 Views)
OK - I screamed out too fast - it's really as easy as this: (see attachment)
 
Sorry
 
Stefan
0 Kudos
Message 5 of 7
(7,399 Views)


@StGl wrote:

I just found out one more thing:

What Ton proposes works on a Windows Machine - on the VxWorks cRIO controller listing the folders of the Root will list the folders of the Root of the flash drive - which is drive c:\!

So this will not work on the cRIO controller. Any other ideas?

 

Stefan

Message Edited by StGl on 08-17-2007 01:45 PM



Could you show the code that performs this error?

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 7
(7,394 Views)

Hi Ton,

 

I used exactly the code you posted - on a Windows machine it outputs an array of drive letters (C,D,E etc.), but on the VxWorks controller, it outputs the root of the flash disk (ni-rt, temp etc.). I guess that's due to the fact that in VxWorks there is no such filesystem root in front of all drives as in Windows ("My Computer"...).

 

However, trying to get the drive info for the U:\ drive fails if you don't have an U:\ drive - also on VxWorks; so that's a good solution for my initial problem.

 

Regards,

 

Stefan

Message Edited by StGl on 08-17-2007 04:02 PM

0 Kudos
Message 7 of 7
(7,387 Views)