Skip to content

ArduinoISP.ino does not properly handle word-based address for EEPROM read/write #2186

@x0urc3

Description

@x0urc3

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions