Shop OBEX P1 Docs P2 Docs Learn Events
EEPROM: 256-byte pages? 128 bytes? — Parallax Forums

EEPROM: 256-byte pages? 128 bytes?

DreamwriterDreamwriter Posts: 22
edited 2007-03-19 14:30 in Propeller 1
Hey,

I been having a heck of time programming the darned EEPROM within SPIN. I FINALLY got it all working (hooray!), but one last mystery: the Atmel 24c1024 documentation says pages are 256 bytes large (which would make sense, 2 banks of 256 pages, 256 bytes each page). But it seems that if I write more than 128 bytes to a page, it wraps and starts overwriting the beginning again, as if they were only 128 bytes each. Any ideas?

Here's what the docs say:

AT24C1024, 1024K SERIAL EEPROM: The 1024K is internally organized as 512 pages of
256 bytes each. Random word addressing requires a 17-bit data word address.

Thanks,
- Josh

Comments

  • mahjonggmahjongg Posts: 141
    edited 2007-03-14 11:18
    Josh,

    it's like you say. p0 is the most significant bit of the 17-bit address. When doing a sequential read the AT24C1024 will only increment the lowest 8-bit of the 17 bit address, and will wrap around at 256 Byte intervals.

    Can you access the "missing" bytes using random access?

    Are you sure you are really using an AT24C1024, because the behaviour you are describing exactly fits an AT24C512 !

    Mahjongg
  • AndreLAndreL Posts: 1,004
    edited 2007-03-14 22:41
    Also, dreamwriter, we created a nice eeprom driver for the hydra, contact keebler to get the latest version of it, but its on the CD as well.

    Andre'
  • DreamwriterDreamwriter Posts: 22
    edited 2007-03-19 06:38
    Unfortunately, all the hard work was already done before I looked around and discovered other EEPROM libs [noparse]:([/noparse] Oh well, this way I learned more about how the EEPROM works (the Hydra book DOES just say to check out the official EEPROM docs and go for it :P ). I figured out the problem, I wasn't ever waiting for writes to finish; there must be a 128-byte buffer in the chip, so writing more than 128 bytes at a time without giving it a chance to write the first 128 caused problems.
  • AndreLAndreL Posts: 1,004
    edited 2007-03-19 07:19
    Yup, you have to wait in a loop or give it enough time to finish.

    Andre'
  • Jasper_MJasper_M Posts: 222
    edited 2007-03-19 13:59
    Umm by the way, would it be possible to do sequential writes that are smaller than one page, but stay within one page? Or do I have to copy the page to RAM, work on the page in RAM and do a page write?
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-19 14:08
    I believe that's what the EEPROM does internally. Once it gets the EEPROM address, it reads the specified page into its internal RAM buffer. Any bytes you write to the EEPROM go into this buffer with an autoincrement buffer pointer (that wraps around at the end of the page). When the Stop Sequence occurs at the end of the "WritePage", the internal buffer gets written back to the EEPROM.
  • Jasper_MJasper_M Posts: 222
    edited 2007-03-19 14:30
    Ah, thanks Mike ^_^ That's what I suspected, but the datasheet only describes Byte Write and Page Write. But for reads, it describes Sequential Read and Page Read... Maybe they just didn't want to document it because sequential writes would work only inside page boundaries... Oh well, gotta try it... I'm gonna tell if I succeed.
Sign In or Register to comment.