How to Flash Arduino Program through "Micro sd card" without using Arduino IDE

Hello sir,

I want to upgrade/uplopad a new Arduino program .hex or .bin file through micro sd card without using arduino IDE many times...

As per my requirement,
If we insert micro sd card in micro sd adapter and that adapter is connected to Arduino mega 2560,if we keep .bin file in that micro sd card,it should flash that .bin code to arduino mega 2560 ....

for that i searched in forum....finally,i found below link

in above link,they are saying
"if it is set to 0xF0 bootloader will look for a bin file on the sdcard named
firmware.bin and use it to flash the firmware then reset the byte to 0xFF so it
does this only once"

In the above only once means,if we want to upgrade more times code through sd card ... is it possible?

so,
can you please suggest correct procedure to upload code from sd card multiple times??

Thank you in Advance :slight_smile:

sailaja:
in above link,they are saying
“if it is set to 0xF0 bootloader will look for a bin file on the sdcard named
firmware.bin and use it to flash the firmware then reset the byte to 0xFF so it
does this only once

In the above only once means,if we want to upgrade more times code through sd cardis it possible?

Of course.

sailaja:
can you please suggest correct procedure to upload code from sd card multiple times??

You just need to set EEPROM address 0x1FF to 0xF0. The easiest way to do this is by simply adding the code to your sketch to either do this automatically in setup() or to do it on demand according to some input of your choice. For information on how to write to EEPROM see:
https://www.arduino.cc/en/Reference/EEPROM
or:
http://www.nongnu.org/avr-libc/user-manual/group__avr__eeprom.html

Some possible alternatives:

unfortunately it does not have official support for ATmega2560. Supposedly it was discovered how to get it working:

but I haven’t had any time to try it out yet.

If you want a separate programmer to do this, here’s instructions and code to make one:
http://www.gammon.com.au/forum/?id=11638
or if you want to buy one:
http://www.crossroadsfencing.com/BobuinoRev17/Programmer.html

Thank you for your reply…According to ur post

After changing EEPROM value to 0xF0…

I copied hardware folder to my windows arduino path…then i opened arduino IDE…but i didn’t see under tools → boards → Arduino mega 2560 (Dual sd bootloader)

I follwed below link

In my arduino IDE i checked in tools…but i didnt get any new board…but warning showing in arduino IDE console…that warning is below

Could not find boards.txt in C:\Users\Admin\Documents\Arduino\hardware\microbridge\bootloaders. Is it pre-1.5?
WARNING: Error loading hardware folder C:\Users\Admin\Documents\Arduino\hardware\microbridge
  No valid hardware definitions found in folder microbridge.
Could not find boards.txt in C:\Users\Admin\Documents\Arduino\hardware\microbridge\bootloaders. Is it pre-1.5?
WARNING: Error loading hardware folder C:\Users\Admin\Documents\Arduino\hardware\microbridge
  No valid hardware definitions found in folder microbridge.

can you please tell me,how to get that Arduino mega 2560 (Dual sd bootloader)
display in tools of arduino IDE?…And im using windows7 laptop…

Thank you in advance :slight_smile:

The problem is that hardware package is in the Arduino IDE 1.0.x format so it's not compatible with the recent versions of the Arduino IDE. This issue was reported:

But unfortunately it appears that project has been abandoned years ago.

You should be able to use it with Arduino IDE 1.0.6, which you can download here:
https://www.arduino.cc/en/Main/OldSoftwareReleases#1.0.x
It should also be fairly easy to update the hardware package to work with Arduino IDE 1.6.x and newer. You will find a guide to the changes that need to be made here:

The immediate problem is that the 1.5.x hardware package format requires the package to be within an architecture folder. So you're getting this error:

Could not find boards.txt in C:\Users\Admin\Documents\Arduino\hardware\microbridge\bootloaders. Is it pre-1.5?

because it's treating the bootloaders folder as the architecture folder, which is wrong. That's an easy fix, you only need to create a folder C:\Users\Admin\Documents\Arduino\hardware\microbridge\avr and then move everything from C:\Users\Admin\Documents\Arduino\hardware\microbridge to C:\Users\Admin\Documents\Arduino\hardware\microbridge\avr. After doing that and restarting the IDE the board will appear in the Tools > Board menu but you will likely encounter some other errors. The solution for those are explained in the link above.

hi sir,i tried to check second method of this link...

In the above link,
they mentioned like below "After recompiling the bootloader’s source files, I flashed the new bootloader using AVR ISP MK II. I also had to make sure that the BOOTRST fuse was set in the ATmega2560’s fuse settings."....here new bootloader means exactly,which file i need to flash....

can u please suggest linux commands to flash bootloader using arduino uno as isp programmer to arduino mega 2560?
Thank you in advance :slight_smile:

  • Install Arduino IDE 1.0.6
  • File > Preferences > Show verbose output during: upload (check) > OK
  • Select the board from the Tools > Board menu
  • Tools > Programmer > Arduino as ISP
  • Tools > Burn Bootloader

After the process completes examine the output in the black console window at the bottom of the Arduino IDE window. You will need to scroll up to see it all. There you will find the necessary commands. Note that there are two processes. First the fuses are set. This only needs to be done once. Next the bootloader is flashed.

hi sir,

i follwed watever you suggested above...

" Install Arduino IDE 1.0.6
File > Preferences > Show verbose output during: upload (check) > OK
Select the board from the Tools > Board menu
Tools > Programmer > Arduino as ISP
Tools > Burn Bootloader "

After above procedure, I converted basic blink example .hex file to .bin file....
i kept that .bin file name as FIRMWARE.BIN.....
i copied .bin file into formatted sd card....

i connected arduino mega 2560 with micro sd card adapter(i kept sd card inside adapter)

connections like
micro sd card adapter arduino mega 2560
cs 53
sck 52
mosi 51
miso 50
vcc 5v
gnd gnd

After above connections,I pressed reset button then on board led is not glowing....TX led is blinking

can you please tell me ,what i should proceed ?

Thank you in advance:)

sailaja:
i kept that .bin file name as FIRMWARE.BIN.....

The readme says it should be named firmware.bin.

sir,

i renamed that bin file as firmware.bin....
again i tried ....then also it is not glowing on board led

Hi sir,

I tried what ever you suggested all those ....but i didnt get "uploading/flashing .hex or .bin from sd card to arduino mega 2560 without using arduino ide ".....

sir,can you please suggest exact procedure ??

this thread seems to have died a couple of years ago but i want to do the same thing, flash program from sd card but to a nano with a 328P chip

can anyone point me to a working procedure to do this? thanks

avr_boot should work fine for the Nano:

The main problem for sailaja was that they are using an ATmega2560, which is not well supported by avr_boot (though people have provided solutions for that issue since the last time I posted here.

Does anyone know how to do this with an ARM processor, rather than AVR? I'm specifically looking M4 (SAMD51) on an Adafruit Feather M4.

Also, would prefer to do it using the SPI flash on the Feather board as a "pseudo" SD.

Ideas?

jjuni:
Does anyone know how to do this with an ARM processor, rather than AVR? I'm specifically looking M4 (SAMD51) on an Adafruit Feather M4.

Also, would prefer to do it using the SPI flash on the Feather board as a "pseudo" SD.

Ideas?

write SAMD51 version of this ArduinoOTA/InternalStorage.cpp at master · jandrassy/ArduinoOTA · GitHub