ESP32-S3 with large FLASH resets before second-stage bootloader

Julien1138
Posts: 12
Joined: Mon Dec 05, 2022 4:38 pm

ESP32-S3 with large FLASH resets before second-stage bootloader

Postby Julien1138 » Mon Dec 05, 2022 5:22 pm

Hello,

I have issues with my custom board. The FLASH is 64MB (S25FS512S) and connected as follow:
Capture d’écran du 2022-12-05 18-09-23.png
Capture d’écran du 2022-12-05 18-09-23.png (196.83 KiB) Viewed 5919 times
I manage to download the code to the flash:

Code: Select all

julien@Fozzy:~/Projets/hello_world$ /home/julien/.espressif/python_env/idf5.0_py3.10_env/bin/python ../../esp/esp-idf/components/esptool_py/esptool/esptool.py -p /dev/ttyACM0 -b 460800 --before default_reset --after hard_reset --chip esp32s3 --no-stub write_flash --flash_mode dio --flash_size 64MB --flash_freq 20m 0x0 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/hello_world.bin
esptool.py v4.4
Serial port /dev/ttyACM0
Connecting...
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 7c:df:a1:e0:ed:ec
Changing baud rate to 460800
Changed.
Enabling default SPI flash mode...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x00041fff...
Erasing flash...
Took 1.77s to erase flash block
Wrote 21504 bytes at 0x00000000 in 0.5 seconds (331.5 kbit/s)...
Hash of data verified.
Erasing flash...
Took 0.24s to erase flash block
Wrote 3072 bytes at 0x00008000 in 0.1 seconds (453.0 kbit/s)...
Hash of data verified.
Erasing flash...
Took 1.99s to erase flash block
Wrote 201728 bytes at 0x00010000 in 4.8 seconds (335.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
But it never boots. This is what I get in the monitor:

Code: Select all

Executing action: monitor
Running idf_monitor in directory /home/julien/Projets/hello_world
Executing "/home/julien/.espressif/python_env/idf5.0_py3.10_env/bin/python /home/julien/esp/esp-idf/tools/idf_monitor.py -p /dev/ttyACM0 -b 115200 --toolchain-prefix xtensa-esp32s3-elf- --target esp32s3 /home/julien/Projets/hello_world/build/hello_world.elf -m '/home/julien/.espressif/python_env/idf5.0_py3.10_env/bin/python' '/home/julien/esp/esp-idf/tools/idf.py' '-p' '/dev/ttyACM0'"...
--- idf_monitor on /dev/ttyACM0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x1a (SPI_FAST_FLASH_BOOT)
Saved PC:0x400454d5
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78 
device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Waiting for the device to reconnect
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x1a (SPI_FAST_FLASH_BOOT)
Saved PC:0x400454d5
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78 
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x1a (SPI_FAST_FLASH_BOOT)
Saved PC:0x400454d5
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78 
device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Waiting for the device to reconnect
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x1a (SPI_FAST_FLASH_BOOT)
Saved PC:0x400454d5
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78 
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x1a (SPI_FAST_FLASH_BOOT)
Saved PC:0x400454d5
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78 
device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Waiting for the device to reconnect
This goes on forever. It looks like the watchdog is failing but the entry point is not even reached.

Here is an extract of sdkconfig:

Code: Select all

#
# Serial flasher config
#
CONFIG_ESPTOOLPY_NO_STUB=y
# CONFIG_ESPTOOLPY_OCT_FLASH is not set
# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set
# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set
CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set
CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y
CONFIG_ESPTOOLPY_FLASHMODE="dio"
# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_20M=y
CONFIG_ESPTOOLPY_FLASHFREQ="20m"
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE_64MB=y
# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE="64MB"
# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set
CONFIG_ESPTOOLPY_BEFORE_RESET=y
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
CONFIG_ESPTOOLPY_BEFORE="default_reset"
CONFIG_ESPTOOLPY_AFTER_RESET=y
# CONFIG_ESPTOOLPY_AFTER_NORESET is not set
CONFIG_ESPTOOLPY_AFTER="hard_reset"
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
# end of Serial flasher config
Any idea what I'm missing?
Communication with ESP32-S3 and with FLASH seems ok...
I spent two days on this and I'm out of things t try.

Julien

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 with large FLASH resets before second-stage bootloader

Postby ESP_Sprite » Tue Dec 06, 2022 3:31 am

You're using the internal USB-serial-JTAG controller, right? Could be that you're missing some info that the chip spits out just before it resets in that case. It may make sense to see if you can read what's on the U0TxD serial pin, see if that hints at anything.

Julien1138
Posts: 12
Joined: Mon Dec 05, 2022 4:38 pm

Re: ESP32-S3 with large FLASH resets before second-stage bootloader

Postby Julien1138 » Tue Dec 06, 2022 8:35 am

You're right, I'm using the internal UUSB-serial-JTAG controller.
Here is what I have on U0TxD:

Code: Select all

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x1a (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x1a (SPI_FAST_FLASH_BOOT)
Saved PC:0x400454d5
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x1a (SPI_FAST_FLASH_BOOT)
Saved PC:0x400454d5
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x10 (RTCWDT_RTC_RST),boot:0x1a (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x1a (SPI_FAST_FLASH_BOOT)
Saved PC:0x400454d5
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x1a (SPI_FAST_FLASH_BOOT)
Saved PC:0x400454d5
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x10 (RTCWDT_RTC_RST),boot:0x1a (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:4
load:0x3fce3810,len:0x167c
ets_loader.c 78
Sadly, not much difference...

Julien1138
Posts: 12
Joined: Mon Dec 05, 2022 4:38 pm

Re: ESP32-S3 with large FLASH resets before second-stage bootloader

Postby Julien1138 » Tue Dec 06, 2022 4:55 pm

I tried flashing via build-in JTAG and it's even worse.

Code: Select all

julien@Fozzy:~/Projets/hello_world$ openocd -f board/esp32s3-builtin.cfg -c "program_esp build/hello_world.bin 0x10000 verify exit"
Open On-Chip Debugger v0.11.0-esp32-20221026 (2022-10-26-14:47)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
Warn : Transport "jtag" was already selected
Info : esp_usb_jtag: serial (7C:DF:A1:E0:ED:EC)
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 40000 kHz
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : starting gdb server for esp32s3.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000001
Info : [esp32s3.cpu0] Reset cause (3) - (Software core reset)
Info : Set GDB target to 'esp32s3.cpu0'
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Reset cause (3) - (Software core reset)
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : [esp32s3.cpu0] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu0] Reset cause (3) - (Software core reset)
Info : [esp32s3.cpu1] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Reset cause (3) - (Software core reset)
Info : [esp32s3.cpu0] Reset cause (3) - (Software core reset)
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Error: Failed to get flash maps (4294967295)!
Warn : Failed to get flash mappings (-4)!
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Error: Failed to get flash size!
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Error: Failed to get flash size!
Error: Failed to probe flash, size 0 KB
Error: auto_probe failed
Error: Failed to find bank 'esp32s3.cpu0.flash'!

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32-S3 with large FLASH resets before second-stage bootloader

Postby chegewara » Tue Dec 06, 2022 5:27 pm

GPIO45 level on reboot? (page 23 and table 2-10)
https://www.espressif.com/sites/default ... eet_en.pdf

I dont know much about hardware, but maybe C38 is too small? You could try to burn efuse to set VDD_SPI and to see if its flash voltage.

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 with large FLASH resets before second-stage bootloader

Postby ESP_Sprite » Wed Dec 07, 2022 3:28 am

Another thing is that your flash simply may not be compatible with the mode you selected (although from the datasheet, it should support DIO...) Could you try to select any of the other flash SPI modes? (for instance, QIO)

Julien1138
Posts: 12
Joined: Mon Dec 05, 2022 4:38 pm

Re: ESP32-S3 with large FLASH resets before second-stage bootloader

Postby Julien1138 » Wed Dec 07, 2022 8:52 am

Thanks for your help.

GPIO45 is hi on startup. Well actually it's 2.45V because of internal pull-down. Maybe I should decrease R48 (external pull-up).
What is strange is that VDD_SPI is 1.9V instead of 1.8V. It should be working anyway, but it's not normal, right?

P.S.: I tried replacing R48 with a wire, it does not change VDD_SPI.

Julien1138
Posts: 12
Joined: Mon Dec 05, 2022 4:38 pm

Re: ESP32-S3 with large FLASH resets before second-stage bootloader

Postby Julien1138 » Wed Dec 07, 2022 8:57 am

Flashing error changed! I don't think I change anything on my part...

Code: Select all

esptool.py v4.4
Serial port /dev/ttyACM0
Connecting...
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 7c:df:a1:e0:ed:ec
Changing baud rate to 460800
Changed.
Enabling default SPI flash mode...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00010000 to 0x00041fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Erasing flash...
Took 1.74s to erase flash block
Wrote 22528 bytes at 0x00000000 in 0.5 seconds (330.7 kbit/s)...
Hash of data verified.
Erasing flash...
Took 2.06s to erase flash block
Writing at 0x00040000... (97 %)
A fatal error occurred: Failed to write to target Flash after seq 192 (result was 01053237: Requested resource not found)
Maybe this will ring a bell?

Julien1138
Posts: 12
Joined: Mon Dec 05, 2022 4:38 pm

Re: ESP32-S3 with large FLASH resets before second-stage bootloader

Postby Julien1138 » Wed Dec 07, 2022 9:13 am

ESP_Sprite wrote:
Wed Dec 07, 2022 3:28 am
Another thing is that your flash simply may not be compatible with the mode you selected (although from the datasheet, it should support DIO...) Could you try to select any of the other flash SPI modes? (for instance, QIO)
Do you know a list of compatible flash?

Julien1138
Posts: 12
Joined: Mon Dec 05, 2022 4:38 pm

Re: ESP32-S3 with large FLASH resets before second-stage bootloader

Postby Julien1138 » Thu Dec 08, 2022 12:47 pm

Hello !

I'm using ESP32-S3R8V.
Datasheet says:
ESP32-S3 Series Comparison.jpg
ESP32-S3 Series Comparison.jpg (141.57 KiB) Viewed 5708 times
It says that internal PSRAM is on octal SPI.
Does it mean that I HAVE TO use an octal SPI link for my external flash also ?

Who is online

Users browsing this forum: No registered users and 42 guests