How can I detect a 64KB EEPROM
Bobb Fwed
Posts: 1,119
I have several different pieces of hardware that all run the same software. It all works fine, but recently some versions of the hardware have 64KB EEPROMs. Is there some way (programmatically) to detect the larger EEPROM?
Comments
First read $0000 and $8000. Then write something to $8000 other than what you originally found at $0000 and $8000. Then read $0000. If $0000 has what you wrote to $8000, then you have a 32KB eeprom. If $0000 has what you originally found in $0000, then you have a 64KB eeprom.
Make sure you put whatever you originally found at $0000 and, if the test finds the EEPROM has 64KB, at $8000, back! This test messes them up, and they probably had something important! $0000 did, at least (clkfreq).
The part to detect the size of the EEPROM works but the rest of the code is buggy.
Try this:
I just tested it over a Telnet connection and it came back "-1 ok"
Why not just compare the low 32K to the high 32K?
If they are different it's a 64K device.
If they are the same it's most likely a 32K device, do the write/read test to be sure.
This saves a writing to the EEPROM in the majority of cases.
It relies on address wrap over in 32K devices. Is that always true?
Yes, the address wraps over but the test is just in case you have an identical image in the top 32K (for some reason)
... which could easily be the case if you're loading to RAM and the EEPROM had never been programmed.
-Phil
It just saves 0.000001% of the life time of the EEPROM in a lot of cases and the 10E-20 chance that the write/read/write test gets interrupted in the middle and corrupts the EEPROM content