SPI Erase Sector OTA
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
SPI Erase Sector OTA
Postby AgentSmithers » Tue Jul 10, 2018 1:01 am
Hi everyone,
Does anyone know what SPI Erase sector actually do to the SPI rom. It seems if I overwrite the sector's with my OTA firmware it does not work unless I call to erase it first. Shouldn't overwriting the data with other data have the same effect or does Erase set some sort of flag behind the scene's allowing for the firmware to work when calling the reboot swap? I even call it on the last sector as I'm writing the last part of the rom and still no dice. I have to erase then write from start to end to have my OTA work. Any background?
Does anyone know what SPI Erase sector actually do to the SPI rom. It seems if I overwrite the sector's with my OTA firmware it does not work unless I call to erase it first. Shouldn't overwriting the data with other data have the same effect or does Erase set some sort of flag behind the scene's allowing for the firmware to work when calling the reboot swap? I even call it on the last sector as I'm writing the last part of the rom and still no dice. I have to erase then write from start to end to have my OTA work. Any background?
Re: SPI Erase Sector OTA
Postby blubb » Tue Jul 10, 2018 5:36 pm
That is for technical reasons. In flash memory only zeros can be written as single bits.
https://en.wikipedia.org/wiki/Flash_mem ... ck_erasure
https://en.wikipedia.org/wiki/Flash_mem ... ck_erasure
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Re: SPI Erase Sector OTA
Postby AgentSmithers » Wed Jul 11, 2018 4:05 am
blubb wrote:That is for technical reasons. In flash memory only zeros can be written as single bits.
https://en.wikipedia.org/wiki/Flash_mem ... ck_erasure
Thank you for your input, I am not sure if that is the answer to my question.
AS I am looping through the total amount of firmware data, Why is erase even required when all the data underneath is going to be overwritten anyways.
Now for the last sector of 4096 bytes, I understand because the firmware may not cover the whole sector and there could be trailing data from the previous firmware version left in that sector, however for the sector's before that still makes no sense to me unless erase set's some flag for the sector in the background that FOTA read's on reboot before trying to load it.
Re: SPI Erase Sector OTA
Postby blubb » Wed Jul 11, 2018 5:12 pm
You can only write zeros (0) into a flash memory. If you need to put a one (1) into a bit that was zero before, you have to erase the whole block and after that zero out the bits that need to be zero. Erasing is a totally different from writing. That is the short summary of how all flash memories work (low level). On e.g. usb key drives the only difference is that you have a controller which does all that for you (and also distributes new writes across all the flash space, so that it wears evenly).
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Re: SPI Erase Sector OTA
Postby AgentSmithers » Sat Jul 14, 2018 1:37 am
blubb wrote:You can only write zeros (0) into a flash memory. If you need to put a one (1) into a bit that was zero before, you have to erase the whole block and after that zero out the bits that need to be zero. Erasing is a totally different from writing. That is the short summary of how all flash memories work (low level). On e.g. usb key drives the only difference is that you have a controller which does all that for you (and also distributes new writes across all the flash space, so that it wears evenly).
Interesting, Got any YouTube videos that talk about this topic? I am used to conventional harddrives but I would like to dive deeper into the subject if you have any links?
Thanks!
Who is online
Users browsing this forum: No registered users and 131 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
-
- All times are UTC+08:00
- Top
- Delete all board cookies
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.