Closed Alfrederson closed 4 years ago
The quick answer is that STK500v2 added what is essentially a networking "layer" around each message it sends, to decrease the chances of errors due to communications problems. While they were changing things, they fixed some limitations and changed everything else, too.
Whereas a STK500v1 command might look like
STK_LOAD_ADDRESS lowbyte highbyte STK_EOP
to "load address" for the next flash page to be programmed, STK500v2 would send
START SEQNUM SIZE TOKEN DIFFERENT_LOAD_ADDRESS byte0 byte1 byte2 byte3 CHECKSUM
So while the "protocols" have similar names, the v2 is substantially different, and needs different code. They only have similar names because they both talked to Atmel's original "STK500" programmer board.
Default arduino config files for Atmega2560 tell avrdude to use protocol=wiring (avrdude .... -cwiring) to program the mcu, but optiboot needs protocol=arduino (avrdude .... -carduino), or else it won't work. Optiboot works just fine when using -carduino. From digging around I take it that Arduino Mega by default uses the stk500boot_v2_mega2560.hex , which is much larger, however, since both work, both use the same baud rate, I can't help but ask what is the practical difference between the two? Why won't optiboot answer to avrdude with -cwiring and vice-versa?