Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eeprom stuff #82

Merged
merged 5 commits into from
Jun 17, 2024
Merged

Eeprom stuff #82

merged 5 commits into from
Jun 17, 2024

Conversation

hairymnstr
Copy link
Contributor

Changes to make EEPROMs work.

  • Changed a bunch of functions to use addr_len passed in as an explicit indicator of address length for the EEPROM. Previously it was just writing two bytes and then trying one if it got an error. That would only throw if your EEPROM was write protected! Otherwise it was writing a byte to the EEPROM.
  • Changed the default block size for littlefs from 512bytes to 64bytes. On small EEPROMs (e.g. 2048 bytes) you'd only get three blocks once metadata was removed which isn't enough for a root directory and a file of any useful size.

Needs testing on 16bit addressed EEPROMS

@eclispe
Copy link

eclispe commented Jun 6, 2024

Was just looking at fixing some of these myself, looks like write_header also needs its address length fixing

Now supports either:
M24C16 EEPROM on all 8 addresses 0x50-0x57 with 1 byte addressing
or
ZD24C64A EEPROM on either 0x50 or 0x57

The smaller EEPROM (16kbit, 2kB M24C16) uses littlefs block size of
just 64 bytes.  The larger EEPROM sticks with the 512byte blocks
so EEPROMs already in the wild should still work
* Fixes a bug where addresses 0x58-0x5F were being assumed to be
EEPROMs but were not contiguous.
* Fixes some bad assumptions on address length in the writing tools
* Adds templates for the two types of EEPROM officially supported
@hairymnstr hairymnstr marked this pull request as ready for review June 13, 2024 21:47
@hairymnstr
Copy link
Contributor Author

Should address all the issues with the M24C16 EEPROM.

  • Leaves block size at 512 bytes for the Zetta EEPROM ( so deployed ones aren't broken)
  • Fixes some dodgy identification of non-EEPROM devices (above 0x57) as non-contiguous EEPROMs
  • Fixes the write_header function so it uses the right address length

Tested on:

  • Matthew Wilkes' Mega Drive Hexpansion (ZD24C64A)
  • Danny Walker's Caffeine Buzz Hexpansion (ZD24C64A)
  • My own Flopagon Hexpansion (M24C16)

@MatthewWilkes
Copy link
Member

Tested on Googly Eye and Flopagon, LGTM also.

@MatthewWilkes MatthewWilkes merged commit 71ba657 into main Jun 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants