Upload Hex files to arduino from SD card- Nick Gammon's Programmer

I am very new to microcontrollers and had one basic question about the SD card hex uploader/programmer that uses an Arduino UNO to upload a HEX file to an AtMega chip. Can it be used to program another arduino UNO without erasing the bootloader or changing anything with it. To clarify, i am asking if i could use one arduino running your programmer program with an sd card with hex file attached to program another arduino UNO without deleting the bootloader so i could program it later normally with Arduino IDE?

Yes - but your hex file would need to contain the appropriate bootloader as well as the code to upload (this could be made by uploading it onto a board via the bootloader, and then dumping the flash via ISP)

To write to the flash, you need to erase what's there; with ISP/ICSP programming, the only option you have is "chip erase", which erases the whole flash and resets the lockbits. (when the chip is self-programming, for example through the bootloader, it can erase page-by-page).

What DrAzzy said is correct. ICSP programming erases the whole chip, including the bootloader. One option is to make a big file with the bootloader appended. That would increase the upload time.

A simpler thing (and less mucking around) is just to put the bootloader back afterwards.



That only takes a few seconds.

Thank you for your reply. I have one more question. Let’s say I use the Hex uploader to upload a program to the arduino via SD card. If I upload the bootloader, will it erase the program I uploaded earlier. thank you.

Yes, that has the same issue. An upload like that has to erase the chip. Only the self-programming method (ie. uploading via the bootloader) erases pages at a time rather than the whole chip. If it didn't it the bootloader would erase itself.