Hi,
i am accessing flash memory where i read/write/erase but am unable to erase less then 4kB at a time using spi_flash_erase_range() API. In the document mentioned only multiple of 4kB is able to erase but i want to erase let's say 10 bytes means less then 4kB, how do i achieve this. Any other API's to solve this.
Thanks
Erase only 10 bytes from the flash
-
- Posts: 9727
- Joined: Thu Nov 26, 2015 4:08 am
Re: Erase only 10 bytes from the flash
That's not an option, as the flash chip itself does not support it; it's a hard limit in the design of flash chips. Note that flash does allow writes to an un-erased sector; these writes can only change 1s into 0s, not the other way around. Perhaps you can use that to your advantage?
Alternatively, you can read the 4K into memory, change it there to what you want, erase the sector, then write the data back. Do note that this is not safe against power-offs during that operation, and that flash only has a limited amount of erase cycles.
Also, if you only need to erase/write 10 bytes, why not use NVS?
Alternatively, you can read the 4K into memory, change it there to what you want, erase the sector, then write the data back. Do note that this is not safe against power-offs during that operation, and that flash only has a limited amount of erase cycles.
Also, if you only need to erase/write 10 bytes, why not use NVS?
Who is online
Users browsing this forum: aygh4266 and 135 guests