Testing EEPROM Size

Duane DegnDuane Degn Posts: 10,002
edited January 2012 in Propeller 1 Vote Up0Vote Down
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.


  • 5 Comments sorted by Date Added Votes
  • Ron CzapalaRon Czapala Posts: 2,411
    edited December 2011 Vote Up0Vote Down
    Duane, why don't you read a byte from the highest possible address and store it.
    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.
  • Mike GreenMike Green Posts: 22,601
    edited December 2011 Vote Up0Vote Down
    Ron has the right idea, but you read a value from $7FFF and then another from $FFFF. You then write the 1's complement of the $7FFF value into $FFFF and read from $7FFF again. If the value at $7FFF is the same as the saved $7FFF, you have a 64K or larger EEPROM and you restore the $FFFF value from where you saved it. Otherwise you have a 32K EEPROM and you restore $7FFF from the saved $7FFF.
  • Duane DegnDuane Degn Posts: 10,002
    edited December 2011 Vote Up0Vote Down
    Thanks Ron and Mike.

    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.
  • Duane DegnDuane Degn Posts: 10,002
    edited January 2012 Vote Up0Vote Down
    This topic has come up a couple of times lately.

    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.
Sign In or Register to comment.