Multiple SPM writes to the same page

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I suppose my question can be summed up as.. If a flash page is all 0xFF's, can portions of that page be changed to some real data, later changing other portions, all without erasing the page between the 2 writes?

The reason I ask is because for a project I am working on, I write 2kb of data to the flash on a mega8515. The data is received in 16 byte blocks, and the page size of the mega8515 is 64 bytes.

If each 16-byte block of data was received in order, this would be no problem.. just keep a 64 byte buffer in sram. However, the 16-byte blocks can be received in any order.

The datasheets suggest a Read-Modify-(Erase)-Write approach to writing partial pages, requiring 4 erasures in this case (16 bytes at a time, 64 byte pages).

AFAIK, when the flash is erased, it is filled with 0xFFs. So I was pondering what would happen if I erase the entire area of the flash that I will be using, and then write to each page multiple times, with no erase inbetween writes....

For simplicity, lets say that I want to fill the flash page with 0xAA's.. first I would erase the page. Then fill 64 byte buffer with 0xFF's. I write 16 0xAAs to the first quarter of my buffer. Write the buffer to the flash page. Then when i have another set of 0xAAs to write, read the page into my buffer, change the 2nd quarter of the buffer to 0xAAs, and write the page again.

From what I know about Atmel's flash, this would work, because I would only be turning bits off, never trying to turn them back on without an erase. Does anybody see a problem with this approach?

Thanks

John Butera

/* John Butera */