Steps to reproduce
Reading and writing EEPROM using Adafruit ArduinoISP.ino will cause Bad EEPROM data. The official Arduino ArduinoISP.ino does not have similar issue. See avrdudes/avrdude/issues/990
Possible solution
The read and write EEPROM function does not handle word-based address. The high address byte is 0x00 in both function.
|
char eeprom_read_page(int length) { |
|
// here again we have a word address |
|
for (int x = 0; x < length; x++) { |
|
byte ee = spi_transaction(0xA0, 0x00, _addr*2+x, 0xFF); |
|
Serial.write( ee); |
|
} |
|
return STK_OK; |
|
} |
|
byte write_eeprom(int length) { |
|
// here is a word address, so we use here*2 |
|
// this writes byte-by-byte, |
|
// page writing may be faster (4 bytes at a time) |
|
for (int x = 0; x < length; x++) { |
|
spi_transaction(0xC0, 0x00, _addr*2+x, buff[x]); |
|
delay(45); |
|
} |
|
return STK_OK; |
|
} |
Steps to reproduce
Reading and writing EEPROM using Adafruit ArduinoISP.ino will cause Bad EEPROM data. The official Arduino ArduinoISP.ino does not have similar issue. See avrdudes/avrdude/issues/990
Possible solution
The read and write EEPROM function does not handle word-based address. The high address byte is 0x00 in both function.
Adafruit_Learning_System_Guides/ArduinoISP/ArduinoISP/ArduinoISP.ino
Lines 550 to 557 in 0090edd
Adafruit_Learning_System_Guides/ArduinoISP/ArduinoISP/ArduinoISP.ino
Lines 487 to 496 in 0090edd