← index #2335Issue #17198
Related · medium · value 0.998
QUERY · ISSUE

esp8266: Support up to 16 MB of flash

openby Ratfinkopened 2016-08-21updated 2023-01-01
port-esp8266

The ESP8266 supports up to 16 megabytes of SPI flash (source, page 12). NodeMCU has supported this much flash for about two months now, and I notice that MicroPython does not. I don't know all the nuances of the ESP8266, but from what I understand there are three things that should all encode the same size: the flash chip's ID, the SpiFlashChip structure from the SDK, and the bootloader size ID. They might not all agree about the flash chip's size, so we try to make them all agree in flashbdev.py. It looks like in the similar routine from NodeMCU, they use size IDs 8 and 9 for 8 MB and 16 MB, respectively. Setting these IDs in MicroPython seems to make mpy think that it has only 512 kB of flash, and I'm not sure why. Ignoring the bootloader size ID and only calculating flash size from the flash chip's ID seems to work, but somehow that seems like the wrong thing to do.

Long story short, I want to add support for 8 and 16 MB of flash to MicroPython, but I don't know what the right way to do it is. Any advice would be greatly appreciated.

CANDIDATE · ISSUE

Bootloop when using 64MBit flash with ESP8266

closedby mikhan253opened 2025-04-27updated 2025-04-27
bug

Port, board and/or hardware

ESP8266 ESP-07 with W25Q64F

MicroPython version

ESP8266_GENERIC-FLASH_2M_ROMFS-20250415-v1.25.0.bin
ESP8266_GENERIC-FLASH_1M-20250415-v1.25.0.bin
ESP8266_GENERIC-OTA-20250415-v1.25.0.bin
ESP8266_GENERIC-20250415-v1.25.0.bin

Reproduction

programmed with the following commands:

esptool --port COM3 --baud 115200 write_flash --erase-all --flash_size=detect -fm dout 0 ESP8266_GENERIC-FLASH_2M_ROMFS-20250415-v1.25.0.bin
esptool.py v4.8.1
Serial port COM3
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting...
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 18:fe:34:9d:5c:bb
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 8MB
Erasing flash (this may take a while)...
Chip erase completed successfully in 16.0s
Flash params set to 0x0380
Compressed 639680 bytes to 428052...
Wrote 639680 bytes (428052 compressed) at 0x00000000 in 37.8 seconds (effective 135.5 kbit/s)...
Hash of data verified.

Expected behaviour

No response

Observed behaviour

Initially starts with the message: "Writing init data" and then bootloops forever.

ets Jan 8 2013,rst cause:2, boot mode:(3,0)

load 0x40100000, len 31264, room 16
tail 0
chksum 0x7a
load 0x3ffe8000, len 1060, room 8
tail 12
chksum 0xc8
ho 0 tail 12 room 4
load 0x3ffe8430, len 1124, room 12
tail 8
chksum 0x2b
csum 0x2b
Writing init data
rf_cal[0] !=0x05,is 0xFF

ets Jan 8 2013,rst cause:2, boot mode:(3,0)

load 0x40100000, len 31264, room 16
tail 0
chksum 0x7a
load 0x3ffe8000, len 1060, room 8
tail 12
chksum 0xc8
ho 0 tail 12 room 4
load 0x3ffe8430, len 1124, room 12
tail 8
chksum 0x2b
csum 0x2b
rf_cal[0] !=0x05,is 0xFF
....
....

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied