Marzogh / SPIMemory

Arduino library for Flash Memory Chips (SPI based only). Formerly SPIFlash
http://spimemory.readthedocs.io/en/latest/
GNU General Public License v3.0
438 stars 138 forks source link

Cannot erase memory partially( Winbond W25Q16BV ) #202

Open Sabuto776 opened 4 years ago

Sabuto776 commented 4 years ago
. Every function i use erase all the memory(**eraseBlock32(addr), eraseSector(), eraseSection()** ). But i want to erase just one address.

Thank You!

Sabuto776 commented 4 years ago

String sc = "678000000"; String sc1 = "DCDBBBBV"; //Serial.println(arrayLen(wr_dt)); //for (uint8_t i = 0; i < arrayLen(wr_dt); i++) { if (pin6_flash.eraseBlock32K(2096992)) { Serial.println("Sector has been erased"); delay(3000); if (pin6_flash.writeStr(2096992, /*wr_dt[0]*/sc)) { Serial.print("'"); Serial.print(wr_dt[0]); Serial.print("' written to :"); Serial.println(2096992); delay(500); } delay(500); } if (pin6_flash.eraseBlock32K(2096944)) { Serial.println("Sector has been erased"); delay(3000); if (pin6_flash.writeStr(2096944, sc1/*wr_dt[1]*/)) { Serial.print("'"); Serial.print(wr_dt[1]); Serial.print("' written to :"); Serial.println(2096944); delay(500); } }

Sabuto776 commented 4 years ago

Sorry !

Now, i understand the functions.

Takes an address as the argument and erases the block containing the

address.

Thank!

Sabuto776 commented 4 years ago

Please i want to know is possible to erase just one address not block

Thank You !

03sarath commented 4 years ago

@sabuto26 ,I hope you doing good,

Do you get any solution for erasing one address?I'm facing the same problem

intensite commented 4 years ago

I think for erasing one full block at a time is a limitation/design of Flash Memory in general. According to this: https://computer.howstuffworks.com/flash-memory1.htm

The electrons in the cells of a flash-memory chip can be returned to normal ("1") by the application of an electric field, a higher-voltage charge. Flash memory uses in-circuit wiring to apply the electric field either to the entire chip or to predetermined sections known as blocks. This erases the targeted area of the chip, which can then be rewritten. Flash memory works much faster than traditional EEPROMs because instead of erasing one byte at a time, it erases a block or the entire chip, and then rewrites it.

03sarath commented 4 years ago

@intensite well said thank you.