os.listdir() garbage values.

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
Thunder
Posts: 1
Joined: Fri Jul 20, 2018 6:43 am

os.listdir() garbage values.

Post by Thunder » Fri Jul 20, 2018 6:58 am

Hi guys,

Let me start off by saying that I am very excited about micropython. I am trying to get it running on an ESP8266 with some success.

I am new to python but have been doing basic coding in C++ and working on microcontrollers such as Arduino.

I'm not sure if I have correctly set up micropython on my ESP12F. I have managed to flash it and input commands to turn the led on/off but when I say;

import os
os.listdir()

I get garbage in the form of," ['\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', "

When I connect to the device with putty and press the restart button the console also displays some junk values.

▒▒▒▒▒s#4 ets_task(40100130, 3, 3fff83ec, 4)
OSError: [Errno 2] ENOENT
OSError: [Errno 2] ENOENT

MicroPython v1.9.4-8-ga9a3caad0 on 2018-05-11; ESP module with ESP8266
Type "help()" for more information.
>>>




Additionally when I try to get webrepl working I get the following error:

>>> import webrepl_setup
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "webrepl_setup.py", line 102, in <module>
File "webrepl_setup.py", line 71, in main
File "webrepl_setup.py", line 40, in get_daemon_status
OSError: [Errno 2] ENOENT
>>>


I am using windows 7 and I have tried loading the latest stable release and daily release using esptool.py in windows powershell, nodeMCU flashing tool and the ESP flash download tool. I've used the erase_flash command to clear the flash too.

Am I doing something wrong? I have tried to search for solutions but my limited understanding of the problem has got me stuck.

chh55
Posts: 2
Joined: Wed Sep 05, 2018 12:23 pm

Re: os.listdir() garbage values.

Post by chh55 » Wed Sep 05, 2018 6:25 pm

I have a similar problem.
Chip is ESP8266EX (ESP-12F)
Manufacturer: e0
Device: 4016
Detected flash size: 4MB

esptool.py --chip esp8266 --port /dev/cu.SLAB_USBtoUART --baud 115200 erase_flash

esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash --flash_size=detect 0 esp8266-20180511-v1.9.4.bin
(also tried with option --flash_mode dio)

In boot I see a lot of garbage during boot
MicroPython v1.9.4-8-ga9a3caad0 on 2018-05-11; ESP module with ESP8266
Type "help()" for more information.
>>>
ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x40100000, len 31108, room 16
tail 4
chksum 0x28
load 0x3ffe8000, len 1100, room 4
tail 8
chksum 0x4e
load 0x3ffe8450, len 3268, room 0
tail 4
chksum 0x09
csum 0x09
[snip]garbage[snip]
OSError: [Errno 2] ENOENT
OSError: [Errno 2] ENOENT

import os
os.listdir()
\x00\x00\x00\x00\x00\x

I have flashed the chip with tasmota (6.2.0)
(esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash --flash_size=detect 0 ../../Downloads/sonoff.bin)
And after some struggle with getting it to connect the wifi, it seems to be running ok.

What am I doing wrong?

Regards Claus.

PS. I have a similar esp8266 from another vendor, that is working fine with the same firmware.

jbay
Posts: 1
Joined: Wed Oct 03, 2018 8:01 am

Re: os.listdir() garbage values.

Post by jbay » Wed Oct 03, 2018 8:03 am

Hi,
Same problem for me with esp8266-20180511-v1.9.4 and ESP12
I tried erase_flash and reflash the firmware but still same issue.

It worked with another board (nodemcu esp12e).

:?: :?: :?:

efahl
Posts: 15
Joined: Sat Dec 23, 2017 2:02 pm

Re: os.listdir() garbage values.

Post by efahl » Wed Oct 03, 2018 2:46 pm

Corrupt file system?

Try:

Code: Select all

import uos
import flashbdev
uos.VfsFat.mkfs(flashbdev.bdev)

launchpad
Posts: 1
Joined: Mon Dec 17, 2018 7:31 am

Re: os.listdir() garbage values.

Post by launchpad » Mon Dec 17, 2018 8:15 am

Thanks efahl. It solved my problem. initially was able to write only 4000 bytes even if my file size was over 12000 bytes.
then i never saw the garbage values with os.listdir(). Later it wrote only 0 bytes. and started getting garbage values. i thought the flash got corrupted. what had happened actually? how can one differentiate between corrupt file system and corrupt flash?

Post Reply