Hi all, I recently bought a ELEGOO Conqueror Robot Tank kit that came with a ESP32-S3 camera module, and I am having a lot of problems trying to reflash the stock code back onto it after I tried editing it as per the pdf instructions (the instructions in the code are contrary to what the code itself says, there are two different codes for the camera in one downloaded folder but the large zip file with all the code just has one, etc). In my attempts to reflash the chip, I've installed the EspRFTestTool and the Flash Download Tool as well as ESP-IDF to figure out what is going on.
Trying to upload any Arduino sketch:
Sketch uses 2100651 bytes (66%) of program storage space. Maximum is 3145728 bytes.
Global variables use 53544 bytes (16%) of dynamic memory, leaving 274136 bytes for local variables. Maximum is 327680 bytes.
"C:\Users\Bailey\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\2.6.1/esptool.exe" --chip esp32 --port "COM7" --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 "C:\Users\Bailey\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/partitions/boot_app0.bin" 0x1000 "C:\Users\Bailey\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/bin/bootloader_dio_80m.bin" 0x10000 "C:\Users\Bailey\AppData\Local\Temp\arduino\sketches\CABD2B2B281F341DDB7226E8BE3C8CC9/CameraWebServer.ino.bin" 0x8000 "C:\Users\Bailey\AppData\Local\Temp\arduino\sketches\CABD2B2B281F341DDB7226E8BE3C8CC9/CameraWebServer.ino.partitions.bin"
esptool.py v2.6
Serial port COM7
Connecting....
Traceback (most recent call last):
File "esptool.py", line 2959, in <module>
File "esptool.py", line 2952, in _main
File "esptool.py", line 2653, in main
File "esptool.py", line 460, in connect
File "esptool.py", line 440, in _connect_attempt
File "esptool.py", line 379, in sync
File "esptool.py", line 322, in command
File "esptool.py", line 285, in write
File "site-packages\serial\serialwin32.py", line 323, in write
serial.serialutil.SerialTimeoutException: Write timeout
Failed to execute script esptool
Failed uploading: uploading error: exit status 0xffffffff
After flashing with Flash Download Tool:
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40043ac8
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3810,len:0x178c
load:0x20c0ff27,len:0x2208a800
Invalid image block, can't boot.
ets_main.c 329
(disconnects and loops this block)
After opening up the ESP-IDF cmd shortcut and navigating to a esp-idf project (in this case a sample "hello world" c program provided by ESP-IDF):
C:\Users\Bailey\Downloads\tank-codes\get-started\hello_world>idf.py flash monitor
Executing action: flash
Serial port COM7
Connecting...
Detecting chip type... ESP32-S3
Running ninja in directory C:\Users\Bailey\Downloads\tank-codes\get-started\hello_world\build
Executing "ninja flash"...
[1/5] cmd.exe /C "cd /D C:\Users\Bailey\Downloads\tank-cod.../tank-codes/get-started/hello_world/build/hello_world.bin"
hello_world.bin binary size 0x35ab0 bytes. Smallest app partition is 0x100000 bytes. 0xca550 bytes (79%) free.
[1/1] cmd.exe /C "cd /D C:\Users\Bailey\Downloads\tank-cod...s/get-started/hello_world/build/bootloader/bootloader.bin"
Bootloader binary size 0x5250 bytes. 0x2db0 bytes (36%) free.
[2/3] cmd.exe /C "cd /D C:\Espressif\frameworks\esp-idf-v5...hello_world.bin 0x8000 partition_table/partition-table.bin
esptool.py v4.7.0
Serial port COM7
Connecting...
Chip is ESP32-S3 (QFN56) (revision v0.2)
Features: WiFi, BLE, Embedded PSRAM 8MB (AP_3v3)
Crystal is 40MHz
MAC: 30:30:f9:55:84:0c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00010000 to 0x00045fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Compressed 21072 bytes to 13074...
Writing at 0x00000000... (100 %)
Wrote 21072 bytes (13074 compressed) at 0x00000000 in 0.3 seconds (effective 495.2 kbit/s)...
Hash of data verified.
Compressed 219824 bytes to 111320...
Writing at 0x00010000... (14 %)
Writing at 0x0001e632... (28 %)
Writing at 0x000251e4... (42 %)
Writing at 0x0002b47a... (57 %)
Writing at 0x00032f40... (71 %)
Writing at 0x0003a2dc... (85 %)
Writing at 0x00040515... (100 %)
Wrote 219824 bytes (111320 compressed) at 0x00010000 in 1.6 seconds (effective 1114.6 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 528.6 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
D WORKING_DIRECTORY=C:/Users/Bailey/Downloads/tank-codes/get-started/hello_world/build -P C:/Espressif/frameworks/esp-idf-v5.2.1/components/esptool_py/run_serial_tool.cmake"
Executing action: monitor
Running idf_monitor in directory C:\Users\Bailey\Downloads\tank-codes\get-started\hello_world
Executing "C:\Espressif\python_env\idf5.2_py3.11_env\Scripts\python.exe C:\Espressif\frameworks\esp-idf-v5.2.1\tools/idf_monitor.py -p COM7 -b 115200 --toolchain-prefix xtensa-esp32s3-elf- --target esp32s3 --revision 0 C:\Users\Bailey\Downloads\tank-codes\get-started\hello_world\build\hello_world.elf --force-color -m 'C:\Espressif\python_env\idf5.2_py3.11_env\Scripts\python.exe' 'C:\Espressif\frameworks\esp-idf-v5.2.1\tools\idf.py'"...
--- WARNING: GDB cannot open serial ports accessed as COMx
--- Using \\.\COM7 instead...
--- esp-idf-monitor 1.4.0 on \\.\COM7 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
I (109) esp_image: segment 1: paddr=0001ce2c vaddr=3fc91eESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403782ee
0x403782ee: esp_cpu_wait_for_intr at C:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_hw_support/cpu.c:145
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3810,len:0x178c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xcbc
load:0x403cc700,len:0x2da0
entry 0x403c9914
I (26) boot: ESP-IDF v5.2.1 2nd stage bootloader
I (27) boot: compile time Apr 30 2024 14:11:23
I (27) boot: Multicore bootloader
I (30) boot: chip revision: v0.2
I (34) boot.esp32s3: Boot SPI Speed : 80MHz
I (38) boot.esp32s3: SPI Mode : DIO
I (43) boot.esp32s3: SPI Flash Size : 2MB
I (48) boot: Enabling RNG early entropy source...
I (53) boot: Partition Table:
I (57) boot: ## Label Usage Type ST Offset Length
I (64) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (71) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (79) boot: 2 factory factory app 00 00 00010000 00100000
I (86) boot: End of partition table
I (91) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=0ce04h ( 52740) map
I (109) esp_image: segment 1: paddr=0001ce2c vaddr=3fc91e00 size=028c0h ( 10432) load
I (111) esp_image: segment 2: paddr=0001f6f4 vaddr=40374000 size=00924h ( 2340) load
I (117) esp_image: segment 3: paddr=00020020 vaddr=42000020 size=18684h ( 99972) map
I (142) esp_image: segment 4: paddr=000386ac vaddr=40374924 size=0d3e0h ( 54240) load
I (160) boot: Loaded app from partition at offset 0x10000
I (161) boot: Disabling RNG early entropy source...
I (172) cpu_start: Multicore app
I (181) cpu_start: Pro cpu start user code
I (181) cpu_start: cpu freq: 160000000 Hz
I (182) cpu_start: Application information:
I (184) cpu_start: Project name: hello_world
I (190) cpu_start: App version: 1
I (194) cpu_start: Compile time: Apr 30 2024 14:11:05
I (200) cpu_start: ELF file SHA256: 039283252...
I (206) cpu_start: ESP-IDF: v5.2.1
I (211) cpu_start: Min chip rev: v0.0
I (215) cpu_start: Max chip rev: v0.99
I (220) cpu_start: Chip rev: v0.2
I (225) heap_init: Initializing. RAM available for dynamic allocation:
I (232) heap_init: At 3FC94F90 len 00054780 (337 KiB): RAM
I (238) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
I (244) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (250) heap_init: At 600FE010 len 00001FD8 (7 KiB): RTCRAM
I (258) spi_flash: detected chip: gd
I (261) spi_flash: flash io: dio
W (265) spi_flash: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (278) sleep: Configure to isolate all GPIO pins in sleep state
I (285) sleep: Enable automatic switching of GPIO sleep configuration
I (292) main_task: Started on CPU0
I (302) main_task: Calling app_main()
Hello world!
This is esp32s3 chip with 2 CPU core(s), WiFi/BLE, silicon revision v0.2, 2MB external flash
Minimum free heap size: 386880 bytes
Restarting in 10 seconds...
Restarting in 9 seconds...
Restarting in 8 seconds...
Done
So basically, esp-idf gives me working flashed code but I want to figure out why I can't upload stuff using esptool and the Arduino IDE. I've done every single troubleshooting step I can think of, I've changed cables, changed computers, disconnected the camera completely from the rest of the tank robot, pressed/held/spammed Boot and Reset buttons, tried different combinations of DIO/QIO and 40mhz and 80mhz for flashing, I'm honestly kind of stuck at this point. Is there something obvious that I'm missing? I will gladly share any additional info if needed. Thanks in advance.