Could not erase flash

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
engin
Posts: 1
Joined: Wed Oct 26, 2016 10:35 pm

Could not erase flash

Post by engin » Mon Nov 07, 2016 9:04 pm

Hi,
I have ESP8266_01 1Mb version. I connected its Rx-Tx pins to arduino and arduino is connected to computer. I provide 3.3V power supply for ESP so its voltage source is seperated from arduino. In my computer i have windows os, and i know python language. From windows cmd i sent 'esptool.py --port COM3 erase_flash' and it is ok. Then i tried flash with 'esptool.py --port COM3 --baud 115200 write_flash --flash_size=8m 0 esp8266–20161017-v1.8.5.bin' and it is also OK. I can connect to ESP with Tera Term, there is no problem.
But, then, i tried to do some os process on ESP, it gives an error with code no: 28. I checked the code and saw it is realted with memory (http://www.ioplex.com/~miallen/errcmp.html). this is the listdir result:
>>> import os
>>> os.listdir()
['\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', ..., '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00']
>>>

I think, the number of '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00' are increased each time i tried to rease_flash and reflash it and now it is on the limit.
I tried resetting the filesystem using:
>>>import uos
>>>import flashbdev
>>>uos.VfsFat.mkfs(flashbdev.bdev)

Then
>>> os.listdir()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 19] ENODEV

Then i reset the ESP, it gives again:
>>> os.listdir()
['\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', ..., '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00']

and sometimes it gives:
FAT filesystem appears to be corrupted. If you had important data there, you
may want to make a flash snapshot to try to recover it. Otherwise, perform
factory reprogramming of MicroPython firmware (completely erase flash, followed
by firmware programming).

And sometimes it gives memory allocation error.

So, i can use the other python modules such as GPIO, network etc. from repl command window but i could not write boot.py or main.py. Also i could not connect to webrepl because it gives an error with code no: 28 again.

So how can i solve this problem, how can i remove the all flash?

User avatar
ernitron
Posts: 89
Joined: Fri Jun 03, 2016 5:53 pm
Location: The Netherlands

Re: Could not erase flash

Post by ernitron » Fri Nov 11, 2016 7:00 pm

It looks like a bad flash / corrupted file system.

Check again all the toolchain. The xtensa compiler, the esp_sdk, the esptool.py. It can be also a corrupted flash but most likely is the software toolchain. Some people had some result shifting from Windows to Ubuntu or Mac. This is kinda magic I cannot say but just in case...

Good luck ;)

Post Reply