espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.27k stars 7.2k forks source link

Wrong flash size detected for `mxic` flash chip (128 kbytes v 8192 kbytes) with v5.1.1 (IDFGH-11041) #12222

Closed RobMeades closed 5 months ago

RobMeades commented 12 months ago

Answers checklist.

IDF version.

v5.1.1

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

u-blox NINA-W15

Power Supply used.

USB

What is the expected behavior?

Detect the 8 megabyte mxic flash chip used within the u-blox NINA-W15 module (ESP32) as being of size 8192 kbytes, e.g. as below, which is what version 5.0.1 did.

spi_flash: detected chip: mxic
spi_flash: flash io: dio
spi_flash: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
cpu_start: Starting scheduler on PRO CPU.
cpu_start: Starting scheduler on APP CPU.

What is the actual behavior?

With version 5.1.1, ESP-IDF now thinks that the 8 megabyte mxic flash chip only has 128 kbytes of flash:

spi_flash: detected chip: mxic
spi_flash: flash io: dio
spi_flash: Detected size(128k) smaller than the size in the binary image header(2048k). Probe failed.

Steps to reproduce.

Attempt to run a build made with ESP-IDF v5.1.1, as opposed to ESP-IDF v5.0.1, on a u-blox NINA-W15 (ESP32 with 8 Megabyte mxic chip) module, which I am perfectly happy to do to investigate/test any proposed fix.

Debug Logs.

See above.

More Information.

No response

RobMeades commented 12 months ago

Binary-chopping indicates that v5.0.3 does NOT have the issue but both v5.1 and v5.1.1 DO have the issue.

mythbuster5 commented 12 months ago

I didn't remember any changes about this part from 5.0 to 5.1. Could you please get the mxic size by esptool.py flash_id. And did you modify any sdkconfig?

RobMeades commented 12 months ago

Hi, and thanks for the swift response. esptool.py reports:

Detecting chip type... ESP32
Chip is ESP32-D0WD-V3 (revision v3.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: e8:31:cd:da:6a:00
Uploading stub...
Running stub...
Stub running...
Manufacturer: c2
Device: 2537
Detected flash size: 8MB

In terms of sdkconfig, find it attached (renamed as .txt): lots of stuff in it but it is "boilerplate" as far as we are concerned, we haven't touched it in a long time and very little of it matters to us.

sdkconfig.defaults.txt

RobMeades commented 11 months ago

\<cough />

RobMeades commented 10 months ago

Any suggestions as to how to move forward with this?

michaelw-inno commented 6 months ago

I have the same problem with the NINA-W106 10B-00 with 8MB flash. @RobMeades as you said IDF < 5.1 works, IDF >= 5.1 does not work. I investigated the issue today and I found out that there is a patch 4c66d7e which implements a size_detect function for MXIC chips. This function correctly detects the size of the flash used in the u-blox chips. It can be cherry-picked to 5.1 to fix the issue as a workaround. (I only tried 5.1.2, but I assume it also works for other patch versions)

@espressif is there any plan to port this patch to the newer IDF versions?

RobMeades commented 5 months ago

Woohoo! Thank you @espressif!

RobMeades commented 5 months ago

...and @michaelw-inno of course.