Hi again,
well, I have been trying with the lates ESP8266 1.3.0 SDK but the problem still persists. Sometimes, when the WIFI connection is lost (switching off the router for example), and the WIFI network comes back, the ESP8266 module does not recover, and from that moment on, it will NEVER recover. A network scan does not show the network. And even if you reset the system, the ESP8266 does not recover.
However, if you ERASE the full flash and you flash your program again with esptool.py, the system recovers.
The reason is that the internal firmware stores something in the flash that is not correct, and the system cannot recover from that situation without cleaning the sector where this wrong information has been written.
We have done an experiment. We place this at the begining of the user_main function (after UART initialization):
uint16_t s,res;
os_printf(“Erasing sectors\n”);
for (s=0x70;s<=0x7F; s++)
{
res = spi_flash_erase_sector(s);
os_printf(“Sector erased 0x%02X. Res %d\n”,s,res);
}
And when the system hangs, it recovers after reset always!!!
Now, we inspect:
python esptool.py erase_flash
python esptool.py read_flash 0x00000 0x80000 erased.bin
python esptool.py write_flash 0x00000 firmware\0x00000.bin 0x40000 firmware\0x40000.bin
python esptool.py read_flash 0x00000 0x80000 written.bin
then we corrupt the system by switching on and off the wifi, and we read back the result:
python esptool.py read_flash 0x00000 0x80000 corrupted.bin
And wow!! It is there! We have changes in 0x7D000 0x7E000 and 0x7F000
0x7E000
0x7F000
This is not a real surprise:
config ADDR_BLOBSETTING1 hex "Adress of blob settings in flash (copy 1)" default 0x7d000 config ADDR_BLOBSETTING2 hex "Adress of blob settings in flash (copy 2)" default 0x7e000
But 0x7F000 ???? What is this doing there??