Standalone uploading hex file from SD Card using STK500v2 protocol

Thread Starter

dpetican

Joined Jan 13, 2016
38
I want to be able to upload a hex file to an Atmega2560 from a 328P with attached SD Card. Since the target is a 2560 I have to use v2 of the protocol. Additionally, I want to be able to upload the code through the bootloader on the 2560 not over ICSP (SPI).

I have designed a board with 2 processors. The programming processor does not have enough free pins to bit bang SPI otherwise i would have totally done that. So I've found two almost complete solutions to solve my problem:

http://www.gammon.com.au/uploader

It will program an Atmega2560 using STK500v2. However, the problem is that it uses SPI not normal serial.

http://baldwisdom.com/bootdrive/

It does upload over regular serial, but does not use the v2 protocol so it won't program a 2560

So the very basic question is uploading using the bootloader and over SPI versus TTL serial almost the same thing or significantly different as far as the STK500 protocol is concerned? I know the the reset sequence is somewhat different.

Right now I'm working on changing Nick Gammon's code from SPI to TTL serial. Any thoughts would be helpful. Thanks.
 
Top