Corrupted filesystem

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
deshipu
Posts: 1348
Joined: Thu May 28, 2015 5:54 pm

Corrupted filesystem

Post by deshipu » Fri Mar 25, 2016 5:07 pm

I have tried both the v1 and v2 version of the alpha firmware successfully on many boards, but I'm having a hard time with this one. It's an ESP-12 module which I have already soldered onto a printed circuit board for my robot. I originally programmed it with the Arduino IDE, but now I wanted to try to run it in micropython. Anyways, the board has 4MB of flash (as reported by the CheckFlashConfig example in the Arduino IDE), so it should be fine. After flashing v2 firmware, I get:

Code: Select all

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. Otherwase, perfopm
factory reprogramming of MicroPython firmware (completely erase flash, followed
by firmware programming).
OK, so I tried erasing the flash several times, flashing different things, then I decided to try the v1 of firmware, as it doesn't initialize the filesystem right away. After flashing, I tried to import the boot_ module to create the filesystem, and I get:

Code: Select all

>>> import boot_
ioctl(1, 0)
ioctl(5, 0)
readblocks(0, 3ffeedc0(4096))
readblocks(0, 3ffeef90(4096))
ioctl(1, 0)
ioctl(5, 0)
ioctl(4, 0)
writeblocks(0, 3ffef120(4096))

 ets Jan  8 2013,rst cause:2, boot mode:(1,0)
The board restarted. I tried again, and I got:

Code: Select all

>>> import boot_
ioctl(1, 0)
ioctl(5, 0)
readblocks(0, 3ffeedc0(4096))
readblocks(0, 3ffeef90(4096))
ioctl(1, 0)
ioctl(5, 0)
readblocks(0, 3ffef0f0(4096))
ioctl(1, 0)
ioctl(5, 0)
readblocks(0, 3ffef200(4096))
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. Otherwase, perfopm
factory reprogramming of MicroPython firmware (completely erase flash, followed
by firmware programming).
Now, my question is, is this normal, or is my ESP-12 module faulty? Does the alpha firmware support flash sizes larger than 1MB? Is there anything I could do to further troubleshoot the issue?

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Corrupted filesystem

Post by pfalcon » Fri Mar 25, 2016 6:11 pm

For starters, make sure you flash micropython fw with

Code: Select all

--flash_size=8m
param. Well, at least with 8mbit (1Mbyte) specified there. If you don't specify it, it will default to 4mbit (512KByte) and ESP8266 SDK won't allow you to access flash beyond that size. The filesystem is located in flash at offset 0xa0000 and its size is 64 * 4KB. Extra space in 4MB modules aren't used so far (we'll yet need to figure out how to detect flash size reliably). So, if you use bigger value for --flash_size, try using exactly 8m, that's what we use in all our tests so far.

The algo for mounting is simple: it tries to mount FatFS from flash area described above. If mount fails, it checks first sector of the area. If it contains only 0xff (as should be after flash erase), it initializes new FS. Otherwise, it considers it corrupted, outputs that message, and leaves user a chance to extract FS (using esptool.py read_flash) and investigate/recover it (using fsck.vfat/whatever).
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

User avatar
deshipu
Posts: 1348
Joined: Thu May 28, 2015 5:54 pm

Re: Corrupted filesystem

Post by deshipu » Fri Mar 25, 2016 7:31 pm

Yes, I used the -m8 option, and also tried the -m32 option, without any improvement.

I desoldered the board and replaced with a different one, with the same result. Then I tried the desoldered board directly. They all have the same problem. I also noticed, that they restart at random even when not doing anything, and sometimes throws an "Illegal instruction" exception... So I think it's safe to assume that got a batch of modules with corrupted flash or some other problem.

As for checking the flash size, personally I use this script: https://github.com/esp8266/Arduino/blob ... Config.ino
I'm not sure how reliable it is, but worked fine on all the boards I have.

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Corrupted filesystem

Post by platforma » Tue Apr 12, 2016 9:55 am

Hey deshipu,

Did you manage to fix this by simply replacing the module with a different version? I'm having the same issues, but all the previous alpha versions or previous github builds were running without any problems.

User avatar
deshipu
Posts: 1348
Joined: Thu May 28, 2015 5:54 pm

Re: Corrupted filesystem

Post by deshipu » Tue Apr 12, 2016 3:50 pm

I didn't resolve that, to be honest, the project is a on the back burner for a little bit, until I regain motivation for it. I suspect it's the usual problems with power, although the board has an MCP1700-3302E/TO regulator on it, which should be more than adequate...

User avatar
felted67
Posts: 4
Joined: Mon Mar 14, 2016 6:46 pm
Location: Velbert/Germany
Contact:

Re: Corrupted filesystem

Post by felted67 » Tue Apr 12, 2016 5:03 pm

Hi everyone,

well, same issue here. I have an ESP-07-module on breadboard-adaptor with powerful power-supply.
The ESP-07 has 8MBit flash, which I have erased completely with 0xff-file.

I did esp-sdk git-update at first, then the micropython-update and "cleaned" and "make'd" as usual.
Flashing was done with the 'ESP_DOWNLOAD_TOOL_V2.4'(with proper erase) and with the 'NodeMCU_FlashTool'.

Code: Select all

ioctl(1, 0)

ioctl(5, 0)

readblocks(0, 3ffef050(4096))

ioctl(1, 0)

ioctl(5, 0)

readblocks(0, 3ffef160(4096))

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).

Tried that three times - same issue....

After that I reflashed previous version - running fine...

Code: Select all

>>>
MicroPython v1.6-242-g2b302da-dirty on 2016-03-19; ESP module with ESP8266

Type "help()" for more information.

>>> #4 ets_task(401004e8, 3, 3fff89e4, 16)
ets_alt_task: ets_run
q for task 3: queue: 3fff89e4, get ptr: 0, put ptr: 0, qlen: 16
q for task 20: queue: 3ffef740, get ptr: 0, put ptr: 0, qlen: 3
q for task 29: queue: 3fff9390, get ptr: 0, put ptr: 0, qlen: 10
q for task 31: queue: 3ffee9f0, get ptr: 0, put ptr: 0, qlen: 4
q for task 32: queue: 3ffef9b0, get ptr: 0, put ptr: 0, qlen: 34

====
>>>
(partly shortened)

Any further details as needed, please ask .... 8=)

Thanks in advance...

Greetz.......Detlef

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Corrupted filesystem

Post by platforma » Tue Apr 12, 2016 10:21 pm

I have the same breakout board with a regulator on it. The curious thing is that previous alphas work and the HEAD of the master branch used to work, haven't tried it recently. So I am not sure if we can conclude that this is a power issue.

I will try again with a "clean" module tomorrow and try out the master branch as well and report back.

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Corrupted filesystem

Post by platforma » Thu Apr 14, 2016 11:03 am

I used my PC at work to flash the latest master branch and everything worked okay. To my great surprise, I reflashed the v03 alpha and it worked as it should! No FS errors, exactly the same breakout board and module. I would like to understand what exactly happened before, so I'll try again at home and hopefully be able to pin down the problem.

User avatar
deshipu
Posts: 1348
Joined: Thu May 28, 2015 5:54 pm

Re: Corrupted filesystem

Post by deshipu » Thu Apr 14, 2016 1:14 pm

One question: are you using an USB hub, or connecting it directly to the computer?

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Corrupted filesystem

Post by platforma » Thu Apr 14, 2016 2:27 pm

This is actually something that I thought of after seeing it working today: I do use a (separately powered) USB hub at home, but it posed no problems before. I'll try to flash it directly from the PC port this evening.

Post Reply