> OK, I skimmed over your device's datasheet and found that it indeed > doesn't have the concept of a writing "page", it can be written at any > byte boundary, but it has an erase granularity of 4kiB though. > > I think you could round each write size to the next power of 2, so the > 14 -byte packet uses a 16-byte block and the 110-to-128-byte packet uses > a 128-byte block. This way it is easier to locate the beginning of each > packet in the memory. > > If you have plenty of memory you could write each packet to a 128-byte > block, regardless of it being 14- or 128-byte long. This way you would > have direct random access to any packet at any time without scanning the > memory from the beginning until you find the packet you need. > > > Isaac > > I have done this for logging in various products. I put a Unix time stamp in the first field of my record. On power up, I load record 0, see if the time stamp is all Fs. If not, I load the next record. This is repeated until I load a log record with all Fs in the time stamp. That is where I will write my next record. I have a function called UINT32 ExtFlashStreamProgram(UINT32 addr, UINT8 *pData, UINT16 DataLen) It returns the next address to program. It also takes care of write page boundaries and erase sector boundaries. Harold --=20 FCC Rules Updated Daily at http://www.hallikainen.com - Advertising opportunities available! Not sent from an iPhone. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .