ESP32 Sparkfun Thing Plus - flash read err, 1000

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
ltmerlin
Posts: 5
Joined: Fri Jun 28, 2019 12:34 pm

ESP32 Sparkfun Thing Plus - flash read err, 1000

Post by ltmerlin » Fri Jun 28, 2019 12:38 pm

Hi,

I flashed a brand new Sparkfun ESP32 Thing Plus with a recent MicroPython firmware binary (from https://micropython.org/download/#esp32). (first erased properly and then flashing with the esptool as described below)

Code: Select all

esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART --baud 460800 --before default_reset --after hard_reset erase_flash

Code: Select all

esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART --baud 460800 write_flash -z --flash_freq 40m --flash_mode dio --flash_size=16MB 0x1000 esp32-20190529-v1.11.bin
Everything works fine except at startup I see the error message "flash read err, 1000
ets_main.c 371
" like you can see below at the first few lines:

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4928
ho 0 tail 12 room 4
load:0x40078000,len:9332
load:0x40080400,len:6216
entry 0x400806e8
I (433) cpu_start: Pro cpu up.
I (433) cpu_start: Application information:
I (433) cpu_start: Compile time:     07:44:16
I (435) cpu_start: Compile date:     May 29 2019
I (441) cpu_start: ESP-IDF:          v3.3-beta1-268-g5c88c5996
I (447) cpu_start: Starting app cpu, entry point is 0x4008294c
I (0) cpu_start: App cpu up.
I (458) heap_init: Initializing. RAM available for dynamic allocation:
I (465) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (471) heap_init: At 3FFB9B88 len 00026478 (153 KiB): DRAM
I (477) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (483) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (490) heap_init: At 40093398 len 0000CC68 (51 KiB): IRAM
I (496) cpu_start: Pro cpu start user code
I (67) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
MicroPython v1.11 on 2019-05-29; ESP32 module with ESP32
Type "help()" for more information.
>>>
Using other firmware versions does not help to resolve it.


When I run the following commands to get the filesystem sizes:

Code: Select all

import os
fs_stat = os.statvfs('/')
fs_size = fs_stat[0] * fs_stat[2]
fs_free = fs_stat[0] * fs_stat[3]
print("File system size {:,} - Free space {:,}".format(fs_size, fs_free))

File system size 2,072,576 - Free space 2,068,480
I only get 2MB of availble or free space while I should get 16MB right?

Running

Code: Select all

import esp
esp.flash_size()
16777216
I get 16777216, which is the correct 16MB... I would like to write files to the filesystem (which SHOULD have 16MB of space) but I only can write max 2MB to the filesystem. Any ideas to resolve this flash memory issue? Or what am I doing wrong?

User avatar
Roberthh
Posts: 1744
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP32 Sparkfun Thing Plus - flash read err, 1000

Post by Roberthh » Fri Jul 05, 2019 7:08 pm

Sorry for replying late, I had seen your post but answered late. The problem is in the SD card driver flashbdev.py at https://github.com/micropython/micropyt ... ashbdev.py.
The last line sets a fixed file of the file system:

Code: Select all

    bdev = FlashBdev(2048 * 1024 // FlashBdev.SEC_SIZE)
 
The following change will use all available flash:

Code: Select all

    bdev = FlashBdev(size // FlashBdev.SEC_SIZE - FlashBdev.START_SEC)
 
You have to build your own image to get that, and have to rebuild the file system once you loaded the firmware. Erasing the flash and reloading the firmware will recreate the file system too.
See also viewtopic.php?f=5&t=6325

ltmerlin
Posts: 5
Joined: Fri Jun 28, 2019 12:34 pm

Re: ESP32 Sparkfun Thing Plus - flash read err, 1000

Post by ltmerlin » Tue Jul 09, 2019 3:29 pm

Thanks, it shows now almost 16MB. So that worked!

I first had to deal with some building issues before I could try it. (I had to use the xtensa-esp32-elf 5.0.2 version instead of the newer 8.0.2 to get "make" working properly)

Post Reply