My custom ESP32-S3 PCB won't boot; flash settings?

I’m stuck trying to get my custom ESP32-S3 PCB to work. It uses S25FL064LABNFA040 as program flash, a 8 MB quad NOR flash. Two PCBs behave the same. I try to use framework arduinoespressif32.

The board accepts to set fuses and be programmed, but when starting I get:

Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x2b (SPI_FAST_FLASH_BOOT)
Saved PC:0x400454d5
mode:DIO, clock div:1
ets_loader.c 78

I interpret this as failure to read the flash.

From my board JSON file, here are the relevant sections:

"build": {
      "arduino": {
        "ldscript": "esp32s3_out.ld",
        "partitions": "default_8MB.csv",
        "memory_type": "qio_qspi"

      "f_flash": "80000000L",
      "flash_mode": "qio",

I can not change f_flash to for example 40M as that gives compilation error
*** [.pio/build/skh3/bootloader.bin] Source '/home/andpe/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/bin/bootloader_qio_40m.elf' not found, needed by target '.pio/build/skh3/bootloader.bin'.
Likewise with flash_mode. The only files in that directory are:
bootloader_dio_80m.elf bootloader_opi_80m.elf bootloader_qio_120m.elf bootloader_qio_80m.elf

flash_mode is explained in SPI Flash Modes - ESP32 - — latest documentation
I’ve found no explanation of build.arduino.memory_type.

It appears the bootloader uses DIO. Looking at CS/SCK/MOSI/MISO with oscilloscope doesn’t reveal anything strange. There’s traffic every 1-2 seconds as ESP tries to start. When uploading a program, there’s a reasonable amount of SPI traffic. I didn’t try to probe quad-SPI traffic as I don’t know what to expect.

Have you tried changing this to dio? (per Boot loop on ESP32-C3 · Issue #622 · platformio/platform-espressif32 · GitHub)

Memory type is the concatination of flash type and PSRAM type.

Have you tried dio_qspi there yet?

Thanks for your reply.
I change to "flash_mode": "dio"
and build.arduino.memory_type: "dio_qspi" (though I don’t have any PSRAM)
For good measure also build.memory_type: "dio_qspi"

The result is almost exactly the same, the only difference being len:0x3ac. Since it already says mode:DIO perhaps this is the wrong track.

It would be nice to test with lower f_flash than 80M. Is this possible? (Lower values don’t compile as described in my first post.)

Arduino-ESP32 only has 80 or 120mhz available per

I see in your flash chip that in dual data rate mode, the maximum clock frequency is only 54MHz. The flash chip might be too slow.

The bootloader definitely seems to be supporting 40MHz and even lower in the source code, but I’m not sure how to recompile the given .elf files. You can try and direct this question to

For the first transmissions after booting, I see CLK period of 200ns period=5MHz (using oscilloscope). Then it also uses 50ns period=20MHz. Still, this is not that fast.

I desoldered the S25FL064LABNFA040 flash and patched in a XM25QH64C flash (identified by marking “25qh64c”) that I took from a ESP32-S3-WROOM module. This works!
I doubt the flash chip was broken as I’ve tried three of them. The problem is narrowed down to either compatibility or some settings I’m unaware of.
Presumed datasheet:
But this chip is not available from any common distributor.
I don’t see any pinout differences between the two chips.

I see these relevant fuse settings in espefuse. All of them are zero:
FLASH_TPUW - not needed for me
FLASH_TYPE - 0 is correct
FLASH_PAGE_SIZE - 0 means 256 bytes which should be good
FLASH_CAP - not documented
FLASH_TEMP - not documented
FLASH_VENDOR - not documented

The ones I marked with “?” or “not documented” could be relevant, for all I know. I’m stuck again, so I appreciate any ideas.

I had an epiphany and replaced the ESP32-S3 by ESP32-S3FN8, with 8 MB internal flash. After removing the external flash, this worked too!
Still unknown why my external flash of choice didn’t work but using internal flash is better anyway.
Thanks maxgerhardt for your help.