Unified EEPROM command updates

I’ll post further updates to the 1-Wire, I2C, SPI, etc unified EEPROM command in this thread.

TODO:

  • Handle write/verify gracefully when file is longer or shorter than EEPROM size. Handle partial page write gracefully by reading current page and overwriting region.
  • Check out UNI/O EEPROMs.
1 Like

Partial page writes are now handled properly. Most I2C and SPI EEPROMs can do partial page writes, but not all. 1-Wire eeproms cannot, and a full 8 or 32 bytes need to be written each time. This is all handled below the hood, so the user doesn’t need to worry about anything.

If you have any EEPROMs I’d appreciate some test reports! I have only tested with 24x02, 25x020, and DS2431. It will be a miracle if I managed to add full catalogs of EEPROMs without a single bug.

Bugs aside, it seems like this is the end of the work on EEPROMs for now. Not sure why I decided now was the time to add this, and it took over the last week or so. The results, especially the updated hex viewer, are super spiffy though. Much more professional and easier to read.

To do:

  • what is this memory chip decoding page/helper
2 Likes

I should have studied some existing programmer instead of brute force building my own list of devices :slight_smile: Came across one of these universal programmers on Taobao, and reading the compatible device list was really illuminating.

Aside: In an effort to ape the competition this programmer lists “26” devices all over the sales material. No such device is listed in the supported parts, and in fact I can’t seems to find any EEPROM with a 26x designation. They also list “95” which is really just STM’s name for the common 25x. Gotta collect them all!

Device Type Mode
25Q SPI Flash SPI
25x (& “95x”, by STM) SPI EEPROM SPI
24x I2C EEPROM I2C
93x Weird SPI EEPROM 3WIRE

Thus far we have:

  • SPI flash command for 25Q (among others) flash memory
  • SPI EEPROM command for 25X EEPROMs. I read every STM M95 EEPROM datasheet and confirmed they can be used with the equivalent 25x device settings.
  • I2C EEPROM command covers all the 24x I2C EEPROMs I can find
  • 93x is an older EEPROM, but it’s still around so I want to add support as well

93x is weird, mainly because it doesn’t use 8 bit bytes. It won’t work with most standard SPI peripherals without some funny business.

  • Start bit required (1bit)
  • Op code is the command to execute (2 bits)
  • A 7 or 6 bit address, depending on 8 or 16 bit read/write mode pin
  • A single 8 or 16 bit word for each write
  • Continuous reads seem to be supported

In 8 bit mode the command/address is 10 bits, in 16 bit mode it takes 9 bits. Neither align with the standard 8 bit data read/write format of the data word.

Here’s the write sequence. Start bit (1) opcode (01) address (6 or 7 bits), 1 data word. Busy is indicated by raising CS after >tCS (250ns) and waiting while DO is low (so use pull-up resistor).

Device Size Bytes Organization Dummy bits Address Total bits
93x46A 1Kbit 128 x8 only 0 7bits 10
93x46B 1Kbit 128 x16 only 0 6bits 9
93x46C/E 1Kbit 128 x8 or x16 0 7 or 6bits 10 or 9
93x56A 2Kbit 256 x8 only 1 8bits 12
93x56B 2Kbit 256 x16 only 1 7bits 11
93x56C 2Kbit 256 x8 or x16 1 8 or 7bits 12 or 11
93x66A 4Kbit 512 x8 only 0 9bits 12
93x66B 4Kbit 512 x16 only 0 8bits 11
93x66C 4Kbit 512 x8 or x16 0 10 or 9bits 12 or 11
93x76A 8Kbit 1024 x8 only 1 10bits 14
93x76B 8Kbit 1024 x16 only 1 9bits 13
93x76-/C 8Kbit 1024 x8 or x16 1 10 or 9bits 14 or 13
93x86A 16Kbit 2048 x8 only 0 11bits 14
93x86B 16Kbit 2048 x16 only 0 10bits 13
93x86-/C 16Kbit 2048 x8 or x16 0 11 or 10bits 14 or 13

x8 or x16 bits is selected by the ORG pin. If ORG is low, the device is x8, if ORG is high, the device is x16.

Total bits = Start Bit (1) + Opcode (2) + Dummy bits (0/1) + Address bits

Here are the potential devices, at least the Microchip and Atmel range: 46/56/66/76/86. A parts are fixed 8 bit words, B are 16 bit words, and C have a ORG pin that determines the organization.

From here.

Ah, so that makes sense. 8 bit bytes can be used, but the initial bits are 0, then after the start bit the data is accepted.

1 Like

93x EEPROM support integrated into the SPI mode eeprom command. This took a rework of how the hardware abstraction layer works, but the result has an improved structure.

This is untested for now as I don’t have any 93x EEPROMs to test against. Some are on the way.

1 Like

New documentation page with all the information I collected on various memory chips.

2 Likes

One of every eeprom arrived for testing.

3 Likes
Bus Chip Tested
1-Wire GX2431 OK
1-Wire DS24B33 OK
SPI 25x020 OK
SPI 25x040 OK
SPI 25x320 OK
SPI 25x640 OK
SPI 25x128 OK
SPI 25x256 OK
SPI 25x512 OK
SPI 25x1024 OK

Started testing a few EEPROMs at a time.

  • Fixed issue where EEPROM writes ended after a single 256 byte page is finished
  • Fixed write issue when page size >=256 bytes
  • Fixed issue with 1-Wire EEPROM incorrect ES value for 4K chips
2 Likes
Bus Chip Tested
I2C 24x01 OK
I2C 24x02 OK
I2C 24x04 OK
I2C 24x08 OK
I2C 24x16 OK
I2C 24x32 OK
I2C 24x64 OK
I2C 24x128 OK
I2C 24x256 OK
I2C 24x512 OK
I2C 24xM01 OK

No issues found.

1 Like

Trying to get the 93x EEPROMs going, but it’s been slow.

  • CS is active HIGH (fixed)
  • Can write, can read, but values are 1 off.
  • Switched clock phase to trailing, but then the chip stops working

From here. So the incoming and outgoing clock phases need to be different, but the RP2040 SPI module doesn’t support that as far as I can tell.

This is technically a Microwire EEPROM, not SPI, but it is really close. RP2040 has a Microwire mode, but it seems WAY more involved than SPI. When enabled it’s sending double the data I intend plus weird changes on MOSI, probably the normal SPI way of using it doesn’t apply.

The data is coming out of the chip, but the RP2040 can’t see any of it.

Maybe I can just change the clock phase before reads?

    hwspi_deselect(); // deselect the EEPROM chip NOTE: 93X are CS active HIGH
    hwspi_set_cphase(0);
    hwspi_write_n(address_array, 2); // send the address bytes
    hwspi_set_cphase(1);
    hwspi_read_n(buf, read_bytes); // read bytes from the EEPROM
    hwspi_select(); // select the EEPROM chip NOTE: 93X are CS active HIGH
    hwspi_set_cphase(0);

Got it :slight_smile: I just needed to manipulate the clock phase between write and read. Will need to store the current setting and restore after I guess.

What an annoying little thing, and it’s so old demonstration projects for RP chips are non existent.

Now I will continue verifying all the chips in 8 and 16 bit modes.

ETA:

Evidently the app note was clear. I assumed the pic had different settings for read and write clock phase, but that clearly just says to switch it.

1 Like
Bus Chip Tested
SPI 93x46(-16) OK
SPI 93x56(-16) OK
SPI 93x66(-16) OK
SPI 93x86(-16) OK

Tested the set of 93x EEPROMs in 8 and 16 bit address mode.

  • Fixed 93x bug where odd sized files in 16 bit mode did not write the final byte
  • ST: why do you use a faint silkscreen to mark pin one? I’ll avoid ST parts just for this reason
  • One vendor sent a set of chips loose in a single plastic bag, which was a pain to sort
  • The other vendor sent a set of chips in individual antistatic bags still in the cut tape, which made the loose bag seem fun in comparison.

Missing devices

Bus Device
I2C 24x1025
I2C 24x1026
I2C 24xM02
SPI 25X010
SPI 25X080
SPI 25X160
SPI 25XM01
SPI 25XM02
SPI 25XM04
SPI 93X76(C)

I’ve sourced all the missing chips, but I’m going to skip 25xm04 as it only has a single supplier and costs 25RMB+.

I’m happy to tack the ST (M95M04) and Microchip (25CSM04) components onto a Digikey order and test them, if that would be helpful?

1 Like

Yes! If it’s not a faf. I’m buying a lot of ewaste chips on Chinese websites and this one is not common.

1 Like

Microchip 25CSM04 just passed eeprom test. Will solder the ST part onto a breakout and test after lunch.

1 Like

Yep, check 25xM04 off your list, the ST part (M95M04) tested fine as well.

1 Like

Thank you so much! I’ve updated the docs and will push shortly.

1 Like

I pushed an organizational update to the docs with pinout illustrations, tables, and info on key pins.

  • Cleaned up the microwire 93x docs
  • Added pinout info
  • Added voltage info for SPI flash chips