I am using a W25X10CL spi data flash to store data.

Following is the data sheet for the data flash:-


I need to read data from multiple sensors every one hour and store them in the data flash till i get a request to read back this data.

Once i get a request to read the data, i need to fetch it from the data flash and transfer it.

I had some questions which i was not able to find in the data sheet.

I am aware that:-

  1. The mentioned data flash allows only sector/block/chip erase
  2. I need to erase the address locations before writing any new data
  3. Data cannot be overwritten at the same address locations

My questions are:

  1. Can i write data to different addresses in the same page (where data was not written previously)?
  2. Can i keep appending the data into the data flash?
  3. Is there a way to erase only certain addresses instead of doing sector erase?

1 Answer 1

  1. Yes.

  2. Yes.

  3. No.

Most of such devices can only erase their contents by at least one sector at time. This is due to their hardware design. There is no other way.

Erased bits are '1'. So you can write in any byte that is 0xFF.

Further I assume that every single '1' bit can be written as '0', but not the other way. For example it's possible to write the following values into the same byte successfully in sequence: 0xFF, 0xFE, 0x7E, 0x5E, 0x5C, 0x4C, 0x44, 0x04, 0x00. Just run an experiment to verify this assumption if you need that functionality.

If you need to erase only one byte or a few in a sector, you have to read the whole sector into your controller's RAM, erase the sector, change the erased byte in RAM to 0xFF, and write the new data back.

  • \$\begingroup\$ Thanks a lot! Will definitely try the experiment. One more question, suppose i write 8 bytes of data to address 0x1b000. Next time, can i write some bytes of data to address 0x1b009 assuming that my previously written 8 bytes are intact? Or do i need to read all previously written data, append new data, erase the sector from 0x1b000 and write again? \$\endgroup\$ Oct 12, 2019 at 8:31
  • 1
    \$\begingroup\$ Yes, you can just write to 0x1b009 and further. There's no need to erase the sector. Remember, you can write any bit '1' to '0'. Only if you need to replace a '0' with a '1' you need to erase. \$\endgroup\$ Oct 12, 2019 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.