Skip to content

Unable to write 0xFF to the eeprom on atmega328p. #406

@zignig

Description

@zignig

Unable to write 0xFF to the eeprom on atmega32p.

I was attempting to save some configurations onto eeprom that loads on boot so I can keep a callibration.

https://github.com/zignig/steves_brain/blob/c84cc40a48b77447823c9748c828ccb39eae7bd4/joybox/joycontroller/src/joystick.rs#L98

Serializing with hubpack. I noticed that the negative numbers were not reloading correctly.

Overwriting with an 0xFF left the cell unchanged, so i16's were wrong.
After chasing through the hal and the I found the folowing code.

fn raw_write_byte(&mut self, address: u16, data: u8) {

when the byte is FF is does not appear to write correctly.

I took out the 'if' with a bare write

zignig@898ab15

and it worked for write but the erase function is borked.

I have tried this on other boards same result, so I think it's a bug.

I am running

  • rustc 1.70.0-nightly (5e1d3299a 2023-03-31)
  • promini
  • ubuntu

Simplified example:

https://github.com/zignig/steves_brain/tree/main/scraps/eepromtest

There appears to be a bit overwrite strategy for eeprom , I am reading the AVR documentation to grok it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions