spi_flash: failed to get chip size assertion at boot

RobMeades
Posts: 85
Joined: Thu Nov 29, 2018 1:12 pm

spi_flash: failed to get chip size assertion at boot

Postby RobMeades » Thu Oct 24, 2019 11:06 pm

This afternoon I upgrade my project from v3.1.1 ESP_IDF to the very latest v4 release branch. All the sdkconfig settings were brought across, as far as I can tell, and I sorted out all the CMakeList.txt files reasonably easily to achieve a build.

However, at boot the (2 Mbyte) ESP32 chip that the build had previously worked on complains:

Code: Select all

E (341) spi_flash: failed to get chip size
assertion "flash_ret == ESP_OK" failed: file "C:/Users/rob/esp/esp-idf/components/esp32/cpu_start.c", line 401, function: start_cpu0_default
...repeatedly and does nothing more. I've checked the build size and it's not too big (700 kbytes flash) The partition table is the default "single factory app no OTA". The SPI FLASH settings in menuconfig are the same as they were before (DIO, 40 MHz, 2 Mbytes, VDDSDIO 1.9V). CONFIG_ESPTOOLPY_FLASHSIZE_2MB is set and CONFIG_ESPTOOLPY_FLASHSIZE is set to "2MB"

Can anyone suggest what might be going wrong and how to fix it?

FYI, I've tried enabling the legacy SPI driver but then the build fails to link because it can't find esp_flash_default_chip. I've also tried disabling flash size checking by esp_tool.py but that made no difference (the download process correctly identifies the flash as 2 MB anyway).

RobMeades
Posts: 85
Joined: Thu Nov 29, 2018 1:12 pm

Re: spi_flash: failed to get chip size assertion at boot

Postby RobMeades » Fri Oct 25, 2019 2:49 pm

Turns out that our flash chip, Macronics MX25R1635F, has an ID of 0xC22815:

macronic_mx25r1635f_id.jpg
macronic_mx25r1635f_id.jpg (9.29 KiB) Viewed 3102 times

Even though this does encode the size in the first 16 bits, it fails this check in spi_flash_chip_generic_detect_size():

Code: Select all

    /* Can't detect size unless the high byte of the product ID matches the same convention, which is usually 0x40 or
     * 0xC0 or similar. */
    if ((id & 0x0F00) != 0) {
        return ESP_ERR_FLASH_UNSUPPORTED_CHIP;
    }
Github issue raised: https://github.com/espressif/esp-idf/issues/4248.

Who is online

Users browsing this forum: No registered users and 257 guests