From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting, copying files from USB device

I have a USB device that I am trying to write a binary firmware file to. The device will initially have a generic binary file on it. The sequence of events should be:

Delete generic binary file

Copy new binary file(stored locally on the PC) 

Do other test commands

 

Just for reference, The USB will initially enumerate as a Mass Storage device then when the new firmware is loaded, it will enumerate as a generic USB device. 

 

Is there already built in VIs to do this? Or maybe some documentation on it? My searches haven't turned up anything useful. 

 

Thanks.

0 Kudos
Message 1 of 6
(2,479 Views)

Do you mean a drive unit letter is NOT assigned to the device?

Is it a special device rather than a trivial USB flash disk?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 6
(2,468 Views)

It is a special USB device that will be used in tandem with PC software to check diagnostic codes on many different snowmobile engine brands.

 

So the idea is that with the generic binary loaded it will load as 'USB Mass Storage' under drive 😧 (just an example). Then you will delete the generic binary, load the specific version, short power and ground to reboot and load the new binary, then it will show up under a different name but with the same drive. Hope that helps. 

 

 

0 Kudos
Message 3 of 6
(2,456 Views)

Ok, it's clearer now. You would like to replace the firwmare into the device (which I would not refer to as a 'file' however).

I'm not experienced in this, but I guess it would be rather complicated - if ever possible with a standard USB port - and very device specific - strong need of more documentation.

I hope someone else can help you Smiley Sad

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 4 of 6
(2,432 Views)

I have solved my own issue. I left it alone for a while and came back to it this morning. I have attached what I came up with. You're welcome to critique it if it's not very good (I am not that experienced with LV, yet). 

 

Because I know this device will enumerate with the same drive every time it is plugged in, I just used a flashdrive to simulate this. 

The code follows this order: 
Establish connection with Arduino Uno>Create file Path for old firmware>Delete filepath for the old firmware>move the new firmware to the device(stored locally)>Write Pin 8 on Arduino High(eventually will short VCC and GND to turn off)>wait>Write Pin 8 on Arduino LOW(restarts device)

 

This was my quick and dirty way of doing it. I'm sure there's more elegant ways to do it. 

0 Kudos
Message 5 of 6
(2,404 Views)

Your design is ok for me.

But your code is ugly. lol

Benoit

0 Kudos
Message 6 of 6
(2,391 Views)