Uploading sketch to Arduino via flash drive

Hello there,

I was wondering if it is possible to upload a sketch from a flash drive by usb cable to the Duemilanove board?

for example, at program startup, the arduino checks/ reads the usb for any sketch file and uploads it?

The idea is to use a MIDI-enabled Duemilanove board in a multi-switch foot controller (arduino reads switches being pressed and sends out corresponding MIDI), but allow for quick parameter change by upload from a flash drive (pretty much just over-writes original code with pretty much the same code, but different midi messages for the switches..

any ideas?

Thank you!

No. You could store your midi messages on an SD card and read them from the arduino. I don't know how much resources the midi stuff takes up, though. Reading/writing to SD cards makes for a LARGE program by itself. Someone with more experience dealing with SD and midi probably knows better.

Again.. You can't upload sketches from a flash drive through the USB port on the arduino. The arduino is a "slave" device and so is a flash drive. You cannot connect two slaves together. Slave devices are meant to be very simple while the master(your computer) handles more of the burden/complexity of driving the slaves. This is to make the slaves smaller and cheaper to make.

MIDI is very light (particularly if you're just reading instructions from somewhere and spewing them out i.e. no processing) but requires a baud rate that is too high* for the software serial library (31250). So you'd have to use the main serial port...

  • I'm not 100% on the capabilities of the NewSoftSerial library - but I'm pretty sure it didn't work when I tried midi with it.

I'm guessing reading from an SD card would also require the main serial port; but maybe you could the software serial library for that???

Or get a Mega. :)

Reading from the SD card is done over SPI, usually, and I am sure that NewSoftSerial can handle 31500 baud. You could do all of this without losing your USART pins. The sdFatLib and associated libraries make reading from an FAT-formatted SD card trivial. We aren't worried about the size of the application as long as it fits in the Arduino's flash, so go ahead and make things easy for yourself.

I would save the MIDI messages to a .CSV file or a .TXT file that is editable easily on the computer, and then tell the Arduino to read in their values on boot. To change the MIDI mapping, you'd change the values in the .TXT or etc. file and then reset the Arduino.

I think it would be pretty easy to accomplish - check out the docs for sdfatlib: http://code.google.com/p/sdfatlib/

Good luck!

This make for a very limiting situation. I have a project that could use the arduino for the processor of a project, but I can't because it will be situated in a place where the purchaser will not want to take their computer. I need a way to upgrade the application, and upload date for the application. I would send the user the information via email.

It seems to me that if the mega had this capability, it would enable the cheaper arduino boards to be used in situations where taking a computer is not reality.

Just my thoughts.

Earlier this year, someone posted (in "Exhibition", I think) about some code that bootloaded sketches from flash (I'm pretty sure it was an SD card).

Be sure to include variants of "boot" or "bootloader" in your forum search: there are zillions of posts about using SD cards for other purposes.