If the compiled AVRISP-MKII Clone firmware is flashed into a previously used chip without writing the corresponding initial EEPROM data, the code could not detect that the stored parameter data was not valid, and blindly used whatever values were left in the EEPROM. This was especially problematic when the reset polarity happened to be set wrongly, because avrdude does not have any options to set that parameter (it sends the corresponding commands only if it detects STK500 or STK600, and does not send that command for AVRISP-MKII).
Add a check for a 4-byte magic number in the EEPROM, so that any data which was left there by some different code could be properly ignored and erased before using the EEPROM storage for AVRISP-MKII Clone data.
This change makes it easier to use the AVRISP-MKII Clone firmware in cases when you need to ISP flash something, but have only some random AVR-based development board around (no need to figure out how to flash EEPROM data, especially if the board happens to have a bootloader like Halfkay which does not support EEPROM writes).
If the compiled AVRISP-MKII Clone firmware is flashed into a previously used chip without writing the corresponding initial EEPROM data, the code could not detect that the stored parameter data was not valid, and blindly used whatever values were left in the EEPROM. This was especially problematic when the reset polarity happened to be set wrongly, because avrdude does not have any options to set that parameter (it sends the corresponding commands only if it detects STK500 or STK600, and does not send that command for AVRISP-MKII).
Add a check for a 4-byte magic number in the EEPROM, so that any data which was left there by some different code could be properly ignored and erased before using the EEPROM storage for AVRISP-MKII Clone data.
This change makes it easier to use the AVRISP-MKII Clone firmware in cases when you need to ISP flash something, but have only some random AVR-based development board around (no need to figure out how to flash EEPROM data, especially if the board happens to have a bootloader like Halfkay which does not support EEPROM writes).