Testing EEPROM Size
Duane Degn
Posts: 10,588
I have several projects that use multiple Propellers all loaded with the same code. I assign an ID number to each Prop and store the ID number in upper EEPROM.
This ID number is read by the Propellers and is used in several of my Prop to Prop communication protocols.
I'm trying to make my "Assign ID" program a bit more user friendly. I have the program check the EEPROM to see if anything is already written to the area of upper EEPROM where I store the ID number, prior to writing the ID number. I also want the program to check if the EEPROM is at least 64K (hopefully without writing to the EEPROM).
My current technique is to read 64 bytes from lower EEPROM starting at address $30 and then reading 64 bytes from address $8030. If the two 64 byte samples are the identical to each other, then I assume it's only a 32K EEPROM. (I believe that's the way a 32K version work; it treats addresses higher than $7FFF as if they were $8000 locations lower.)
I've learned from Mike Green's FemtoBasic (and the chips' datasheet) that Winbond memory chips use a JEDEC device number. I couldn't find information about any sort of ID number in the EEPROM datasheet.
Do any of you have suggestions on why to tell a 32K EEPROM from a 64K EEPROM? I know I could write to the EEPROM to test its size but I was wondering if there were a different way.
This ID number is read by the Propellers and is used in several of my Prop to Prop communication protocols.
I'm trying to make my "Assign ID" program a bit more user friendly. I have the program check the EEPROM to see if anything is already written to the area of upper EEPROM where I store the ID number, prior to writing the ID number. I also want the program to check if the EEPROM is at least 64K (hopefully without writing to the EEPROM).
My current technique is to read 64 bytes from lower EEPROM starting at address $30 and then reading 64 bytes from address $8030. If the two 64 byte samples are the identical to each other, then I assume it's only a 32K EEPROM. (I believe that's the way a 32K version work; it treats addresses higher than $7FFF as if they were $8000 locations lower.)
I've learned from Mike Green's FemtoBasic (and the chips' datasheet) that Winbond memory chips use a JEDEC device number. I couldn't find information about any sort of ID number in the EEPROM datasheet.
Do any of you have suggestions on why to tell a 32K EEPROM from a 64K EEPROM? I know I could write to the EEPROM to test its size but I was wondering if there were a different way.
Comments
Then write a different byte to that adddress and read it back in.
If you get back what you wrote, rewrite the original byte back where it came from.
Not elegant but should work.
Ron, as Mike points out I have check the EEPROM in two places because a 32K EEPROM will read and write the value from an address 32K lower than the 64K EEPROM (the 32K version just wraps the address back to zero at address $8000).
Mike, Thank you for your answer. I was just admiring the way your Winbond driver sets "maxSize" based on the JEDEC code and hoping for something as elegant to use with EEPROM chips. I'll use your suggestion.
I've posted the program that checks the EEPROM size here.
I'm also attaching the program to this post to make easier for others to find it.
It uses a baud of 57,600bps. It gives you a couple of seconds to open a terminal window before displaying the EEPROM information.
See the post linked to above for the expected output.