Hi i am using SST25VF032B flash memory. Before writing ,it has to be erased to 0xFF. But my doubt is that how it stores real 0xFF. Will is store 0xFF or some other value?

  • \$\begingroup\$ If it can't store 0xFF, how does it store any other value? \$\endgroup\$ Commented May 22, 2013 at 5:56
  • \$\begingroup\$ Consider an empty glass in your kitchen cabinet, which (in a sense) does not contain any information. As soon as this glass is in use by someone, you can may want to check if it is empty and to change its contents. So empty does suddenly mean something, its just a matter of context :P :) \$\endgroup\$
    – Rev
    Commented May 22, 2013 at 7:53

1 Answer 1


I'm not sure what you mean.

When you store 0xFF, it stores 0xFF - that is, it sets all 8 bits of the register. The exact same thing happens when you erase the chip. Look at erasing as bulk writing 0xFF to all registers.

In both cases, a read operation would return 0xFF.

  • \$\begingroup\$ What i meant is when we erase the flash it stores 0xFF in the erased location. That means when i read the erased location i get 0xFF. But when i write the actual data 0xFF , how it stores? \$\endgroup\$
    – user24206
    Commented May 22, 2013 at 5:37
  • \$\begingroup\$ @user24206, they will both read 0xFF. If you want to keep track of erased sectors versus data you'll need to come up with a scheme to do that. \$\endgroup\$
    – PeterJ
    Commented May 22, 2013 at 5:40
  • \$\begingroup\$ I suspect the reason flash memory needs to be erased first is that you can't actually write individual 0xFF bytes (only as block, i.e. 'erase' them). Thus when writing 0xFF bytes as part of a regular data write, nothing actually happens for those (other then moving to the next position), but since it has been erased before, it will still read them as 0xFF. \$\endgroup\$
    – fm_andreas
    Commented May 22, 2013 at 6:17
  • 2
    \$\begingroup\$ @CamilStaps that makes no sense to me. If that was the case, couldn't the programmer simply fill the remainder of the block with 0xFF's? I vaguely remember reading (hence my "I suspect") that individual bits in flash can only be changed in one direction, i.e. from 1 to 0. Thus when writing it must start with a 0xFF (all bits 1). The wikipedia page seems to agree. \$\endgroup\$
    – fm_andreas
    Commented May 22, 2013 at 6:37
  • 3
    \$\begingroup\$ @fm_andreas - You are correct. Block organized FLASH memory must be erased by the block (or page, or sector, or whole chip) to the background pattern (which is usually all 1's). Programming individual locations consists of writing the opposite pattern to the background (usually 0's) to bits being programed. Most FLASH parts need to be programmed at some minimal block size and not one bit or byte at a time. \$\endgroup\$ Commented May 22, 2013 at 7:19

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