I am trying to use a NOR flash memory device: SST25VF016B (with STM32 discoveryboard F407VG). However, I am confused on some terms on their datasheet. You can find the datasheet here: https://www.elfa.se/Web/Downloads/_t/ds/SST25VF016Bx_eng_tds.pdf

In the datasheet, it is mentioned that this device have 16Mega bits of memory. However, in the erase section, it state that it has: 1. Full Chip Erase 2. 4KByte sector erase 3. 32 Kbyte block erase 4. 64 Kbyte block erase

What I understand after looking some references is that sector is the smallest section in a memory device, and then we have blocks. But, in that case, 4KByte sector means that it will erase from address 0 for example, until address 4000?

And one more question, when I tried to program this device, it said that we need to erase the chip first before programming. Will it be the same if I use the full chip erase, or should I erase it block by block (or sector by sector)

Can someone help me try to understand this? Thanks a lot!!



1 Answer 1


First thing to understand about NOR flash is that programming individual bytes can only change 1-bits to zero but cannot modify a bit already set to zero. To set a bit back to one, the entire smallest-erasable-section must be erased.

In this chip, the smallest erasable section is a 4Kbyte sector (4096 bytes, for example bytes 0-4095). The 32Kbyte (32,768 byte) and 64Kbyte (65,536 byte) block are simple groups of sectors that can be erased as a single operation. It doesn't matter if you erase a sector, either size block, or the entire chip. All bytes in the range will be set back to all ones (0b11111111).

In most NOR chips, it is not actually required to erase a byte before programming. However, such a re-programming again, can only change ones to zeros. Writing all zeros to an already programmed non-zero byte or bytes can be useful for thing like quickly marking a block of data as invalid or obsolete.

  • \$\begingroup\$ Hi there ,thank you for your explanations! Now I am having trouble as well.. so I don't know why but after deleting the whole chip, when I read some addresses, it still reads the last data which i wrote there. And when I tried to write a different data, in a different location, the output is "ÿ". Do you have any suggestion what should I do to address this issue? Thanks! \$\endgroup\$ Commented Dec 1, 2018 at 19:12
  • 1
    \$\begingroup\$ Are you polling for erase completion? A full chip erase will take a long time (relatively speaking). If you try other operations before the erase completes, it will abort. \$\endgroup\$
    – DoxyLover
    Commented Dec 1, 2018 at 20:27
  • \$\begingroup\$ What I did was after the operation, I waited for 1 seconds with a delay function. Is that what you meant by polling? I'm sorry for the stupid question, but I'm quite new :) thanks! \$\endgroup\$ Commented Dec 2, 2018 at 10:34
  • 1
    \$\begingroup\$ @Stanleyaley What I was referring to was reading the status register until you read the BUSY big as zero. However, that datasheet says the chip erase time is 50 ms so your delay should work. Second question: are you executing the write-enable instruction before you do the chip erase? \$\endgroup\$
    – DoxyLover
    Commented Dec 3, 2018 at 6:16
  • 1
    \$\begingroup\$ Hi @DoxyLover ! I have tried again with your suggestions and yes it worked!! I just noticed that I forgot to use write-enable instruction in one part of my code. Thank you for the great explanations!!! Cheers \$\endgroup\$ Commented Dec 3, 2018 at 10:53

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.