Skip to content
Prajwal Bhattaram edited this page Mar 8, 2018 · 2 revisions

Erase functions

Erasing Flash memory

To erase a NOR flash cell (resetting it to the "1" state), a large voltage of the opposite polarity is applied between the CG and source terminal, pulling the electrons off the FG through quantum tunneling. Modern NOR flash memory chips are divided into erase segments (often called blocks or sectors). The erase operation can be performed only on a block-wise basis; all the cells in an erase segment must be erased together. Programming of NOR cells, however, generally can be performed one byte or word at a time 1

1. Taken from Wikipedia on 08.03.2018


Custom size Erase

eraseSection(address, size)

Erases one (or) a number of sectors or blocks as defined by the size of the data provided to the function.

Takes an address and the size of the data being input as the arguments and erases the block/s of memory containing the address.

This function is useful when the size of the incoming data is unknown and the erase needs to be adaptable. It can replace all the functions below if required, but will run slower than an equivalent fixed size erase.


Fixed size Erase

eraseSector(address)

Erases one 4KB sector containing the address to be erased. The sectors are numbered 0 - 255 containing 4096 addresses each.

Takes an address as the argument and erases the block of memory containing the address.

eraseBlock32K(address)

Erases one 32KB block - 128 pages - containing the page to be erased. The blocks are numbered 0 - 31 containing 32,768 addresses each.

Takes an address as the argument and erases the block of memory containing the address.

eraseBlock64K(address)

Erases one 64KB block - 256 pages - containing the page to be erased. The blocks are numbered 0 - 15 containing 65,536 addresses each.

Takes an address as the argument and erases the block of memory containing the address.

eraseChip()

Erases entire chip.

This function can take a while to run and its speed depends on the flash memory architecture. Flash memory chips of identical capacities can have varying chip erase times if they are from different manufacturers.

Use with care.