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: http://www.atmel.com/Images/doc2525.pdf

And I have seen a Python implementation of the programming side: https://translate.google.com/translate?hl=en&sl=es&tl=en&u=http%3A%2F%2Fwww.sistemasorp.es%2F2014%2F11%2F11%2Fprogramando-un-arduino-remotamente-con-el-modulo-esp8266%2F

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.

Cheers, -Steve

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: https://github.com/Optiboot/optiboot/wiki/HowOptibootWorks 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. http://www.crossroadsfencing.com/BobuinoRev17/ |500x315 |500x440

stevensam2012: 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.