STK500 protocol - Command Sequence

Hi All,

I am trying to figure out what the sequence of STK500 commands is to program an Arduino.

I would like to have a hex file stored on an SD card and have a processor read the hex file and burn it to an Arduino using the standard bootloader.

I have had a look through the commands in the protocol:

And I have seen a Python implementation of the programming side:

But I don't have a clear idea of what the minimum required message flow is to program the Arduino.

If someone could point me towards some appropriate documentation, or could explain to me what is required to implement a programmer that would be great.


p.s - Also, I'd be interested in doing this for the SAMD21 bootloader that is on an Arduino Zero. Any info that would help me get started would be appreciated.

I think that Nick Gammon has a way to program an hex file stored on the SD slot/card from an Ethernet shield but I can't seem to find that post ....


Nick's program using ISP to program files from the SD card; I don't think I've seen a sketch that implements the serial (bootloader) protocol.

This might help: HowOptibootWorks · Optiboot/optiboot Wiki · GitHub
Optiboot implements a very small subset of the stk500 commands; you can probably get by with a sequence of
LOAD_ADDRESS(address) and PROGAM_PAGE(one_page_of_data) commands.

I have this card all set to read from SD card and write via ICSP to the target chip. It runs Nick's program.
One version lets you select 1 of 16 files to transfer, another will let you select one of 256 programs.

have a processor read the hex file and burn it to an Arduino using the standard bootloader.

op seems to imply serial not isp. like the other thread a week or so back and many others before that most replies do no involve using the standard bootloader. i have versions that do this using a much simpler bootloader like the one i posted here a couple days ago. however it would be useful to have one that works with "mainstream" ones like opti or mega.

This other thread was brewing at the same time:

AdrianZa and George Caley got that concept working with mainstream bootloaders.