Programming by sending hex file over UART? Supported by bootloader?

greets,

I'm interested in how to program (via UART) a atmega8 and/or atmega328 that has the arduino boot-loader installed.

Let's say that my code jumps to the boot-loader section when it receives a specific uart command or the fuses are programmed so that on reset the boot-loader section runs first.

Is there a way to send a hex file over to the UART Rx (at slow baud rate) and for the arduino boot-loader to write the code to the application section of the flash memory?

As an example: 1. PowerOn 2. Bootloader loads/runs and waits (a second or two) for a specific UART byte that tells it to program the next bytes (the hex file) into the application section of memory. 3. Hex file is sent via UART (at slow baud rate) 4. Specific UART byte tells the boot-loader that it's the end of the hex file. 5. Atmega resets

I've looked at the Atmega8 bootloader here https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/bootloaders/atmega8/ATmegaBOOT.c but it's a bit too complicated for me.

Thanks for any input!

It seems that you are describing the normal upload procedure via the serial port.

Please try to explain more clearly what you are actually trying to do.

The current bootloader communicates using the STK500v1 communications protocol, which is:

  • a block-at-time protocol that sends one AVR "page" of flash with a program command, and waits for that to finish before it sends the next page.
  • The data is sent in binary, rather than hex. The PC-side program READS hex files, and then it does the conversion to binary and the more complicated communications protocol.

So... What is it that you really want to do?

So... What is it that you really want to do?

Update the (MIDI) code/firmware via UART Rx only, i.e. without feedback to the computer, simply sending bytes one after another from a hex or binary file.

Huh? Whatever for?

jremington: Huh? Whatever for?

As I've written, to update the firmware on MIDI devices. In any case, I've looked around and found a firmware for such a purpose but I reckon it would just be easier to use USB-TTL chip and just let the user upload firmware updates from the Arduino IDE.