Go Down

Topic: How to Flash Arduino Program through "Micro sd card" without using Arduino IDE (Read 1 time) previous topic - next topic

sailaja

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


https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560

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  :)

pert

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?
Of course.


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:
https://github.com/zevero/avr_boot
unfortunately it does not have official support for ATmega2560. Supposedly it was discovered how to get it working:
https://github.com/zevero/avr_boot/issues/4#issuecomment-328269783
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

sailaja

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
https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560


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



Code: [Select]
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  :)

pert

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:
https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560/issues/2
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:
https://github.com/arduino/Arduino/wiki/Arduino-Hardware-Cores-migration-guide-from-1.0-to-1.6

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:
Code: [Select]
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.

sailaja

hi sir,i tried to check second method of this link...
https://mechatronicscraze.wordpress.com/2015/05/31/flashing-an-arduino-mega-2560-with-firmware-stored-on-a-micro-sd-card/

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 :)


pert

  • 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.

sailaja

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:)

pert

i kept that .bin file name as FIRMWARE.BIN.....
The readme says it should be named firmware.bin.

sailaja

sir,

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

sailaja

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 ??

Go Up