Debugging esp32-s3-devkitc-1

I’m trying to use the embedded debugger for a (generic) esp32-s3-devkitc1-n16r8 board. Having read through a lot of the forum comments, I’ve tested the baseline Arduino blink example (platform-espressif32/examples/arduino-blink at develop · platformio/platform-espressif32 · GitHub) with a breakpoint in the IDE and it works flawlessly. For my code, I’ve replicated the platformio.ini file to match, but the code is different. In my case, I don’t seem to be able to break properly whether using the IDE launch or CLI. My configuration looks like this at the moment:

[platformio]
  default_envs = esp32-s3-devkitc1-n16r8

; =================================================
; Non-debug uploads
; =================================================
[env:esp32-s3-devkitc1-n16r8]
  framework = arduino
  platform = espressif32
  board = esp32-s3-devkitc-1

  lib_deps =
    adafruit/Adafruit BusIO
    adafruit/Adafruit GFX Library
    marcmerlin/FastLED NeoMatrix @ ^1.2                             ; https://github.com/marcmerlin/FastLED_NeoMatrix
    moononournation/GFX Library for Arduino@^1.3.1                  ; https://github.com/moononournation/Arduino_GFX

  monitor_speed = 115200

  custom_component_remove = espressif/esp_hosted
                            espressif/esp_wifi_remote
                            espressif/esp-dsp
                            espressif/esp32-camera
                            espressif/libsodium
                            espressif/esp-modbus
                            espressif/qrcode
                            espressif/esp_insights
                            espressif/esp_diag_data_store
                            espressif/esp_diagnostics
                            espressif/esp_rainmaker
                            espressif/rmaker_common

I’ve tried launching from the IDE with no luck. Based on Debugging with PlatformIO: Part 3. PlatformIO Unified Debugger in CLI mode | PlatformIO Labs , I tried the CLI and I see similar behavior where it appears to hit the initial breakpoint and then keep on going. Can anyone suggest what I should be looking at that might fix this?

Thanks,
Craig

╰─➤  pio debug --interface=gdb -x .pioinit
Reading symbols from /home/setera/source/personal/arduino-misc/esp32-s3-devkitc-1/.pio/build/esp32-s3-devkitc1-n16r8/firmware.elf...
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = esp-builtin
PlatformIO: Initializing remote target...
Warning: 'flushregs', an alias for the command 'maintenance flush register-cache', is deprecated.
Use 'maintenance flush register-cache'.

Open On-Chip Debugger  v0.11.0-esp32-20220706 (2022-07-06-15:48)
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
adapter speed: 40000 kHz

Warn : Transport "jtag" was already selected
adapter speed: 5000 kHz

Info : tcl server disabled
Info : telnet server disabled
Info : esp_usb_jtag: serial (98:A3:16:E3:4A:00)
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 5000 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 pipe
Info : accepting 'gdb' connection from pipe
Info : [esp32s3.cpu0] Target halted, PC=0x40041A76, debug_reason=00000000
Info : Set GDB target to 'esp32s3.cpu0'
Info : [esp32s3.cpu1] Target halted, PC=0x40043A40, debug_reason=00000000
Warn : No symbols for FreeRTOS!
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3c040020, 133 KB
Info : Flash mapping 1: 0x40020 -> 0x42000020, 203 KB
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Auto-detected flash bank 'esp32s3.cpu0.flash' size 16384 KB
Info : Using flash bank 'esp32s3.cpu0.flash' size 16384 KB
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3c040020, 133 KB
Info : Flash mapping 1: 0x40020 -> 0x42000020, 203 KB
Info : Using flash bank 'esp32s3.cpu0.irom' size 204 KB
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3c040020, 133 KB
Info : Flash mapping 1: 0x40020 -> 0x42000020, 203 KB
Info : Using flash bank 'esp32s3.cpu0.drom' size 136 KB
Info : New GDB Connection: 1, Target esp32s3.cpu0, state: halted
0x40041a76 in ?? ()
Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around!
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)
JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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
[esp32s3.cpu0] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Debug controller was reset.
[esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
[esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu1] requesting target halt and executing a soft reset
[esp32s3.cpu1] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
[esp32s3.cpu1] Debug controller was reset.
[esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3c040020, 133 KB
Info : Flash mapping 1: 0x40020 -> 0x42000020, 203 KB
Flash mapping 0: 0x10020 -> 0x3c040020, 133 KB
Flash mapping 1: 0x40020 -> 0x42000020, 203 KB
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Auto-detected flash bank 'esp32s3.cpu1.flash' size 16384 KB
Info : Using flash bank 'esp32s3.cpu1.flash' size 16384 KB
Auto-detected flash bank 'esp32s3.cpu1.flash' size 16384 KB
Using flash bank 'esp32s3.cpu1.flash' size 16384 KB
** Programming Started **
** Programming Started **
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Erased 20480 bytes in 411.751 ms
PROF: Erased 20480 bytes in 411.751 ms
Info : PROF: Data transferred in 213.379 ms @ 93.7299 KB/s
PROF: Data transferred in 213.379 ms @ 93.7299 KB/s
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Wrote 20480 bytes in 555.721 ms (data transfer time included)
PROF: Wrote 20480 bytes in 555.721 ms (data transfer time included)
** Programming Finished in 2619 ms **
** Programming Finished in 2619 ms **
** Verify Started **
** Verify Started **
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Flash verified in 209.691 ms 
PROF: Flash verified in 209.691 ms 
** Verify OK **
** Verify OK **
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)
JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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
[esp32s3.cpu0] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Debug controller was reset.
[esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
[esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu1] requesting target halt and executing a soft reset
[esp32s3.cpu1] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
[esp32s3.cpu1] Debug controller was reset.
[esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
** Programming Started **
** Programming Started **
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Erased 4096 bytes in 244.047 ms
PROF: Erased 4096 bytes in 244.047 ms
Info : PROF: Data transferred in 43.801 ms @ 91.3221 KB/s
PROF: Data transferred in 43.801 ms @ 91.3221 KB/s
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Wrote 4096 bytes in 350.451 ms (data transfer time included)
PROF: Wrote 4096 bytes in 350.451 ms (data transfer time included)
** Programming Finished in 1299 ms **
** Programming Finished in 1299 ms **
** Verify Started **
** Verify Started **
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Flash verified in 197.148 ms 
PROF: Flash verified in 197.148 ms 
** Verify OK **
** Verify OK **
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)
JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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
[esp32s3.cpu0] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Debug controller was reset.
[esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
[esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu1] requesting target halt and executing a soft reset
[esp32s3.cpu1] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
[esp32s3.cpu1] Debug controller was reset.
[esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
** Programming Started **
** Programming Started **
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Erased 8192 bytes in 273.897 ms
PROF: Erased 8192 bytes in 273.897 ms
Info : PROF: Data transferred in 73.836 ms @ 108.348 KB/s
PROF: Data transferred in 73.836 ms @ 108.348 KB/s
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Wrote 8192 bytes in 393.883 ms (data transfer time included)
PROF: Wrote 8192 bytes in 393.883 ms (data transfer time included)
** Programming Finished in 1376 ms **
** Programming Finished in 1376 ms **
** Verify Started **
** Verify Started **
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Flash verified in 200.675 ms 
PROF: Flash verified in 200.675 ms 
** Verify OK **
** Verify OK **
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)
JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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
[esp32s3.cpu0] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Debug controller was reset.
[esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
[esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu1] requesting target halt and executing a soft reset
[esp32s3.cpu1] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
[esp32s3.cpu1] Debug controller was reset.
[esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
** Programming Started **
** Programming Started **
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Erased 430080 bytes in 1778.21 ms
PROF: Erased 430080 bytes in 1778.21 ms
Info : PROF: Data transferred in 4001.57 ms @ 104.959 KB/s
PROF: Data transferred in 4001.57 ms @ 104.959 KB/s
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Wrote 430080 bytes in 4366.28 ms (data transfer time included)
PROF: Wrote 430080 bytes in 4366.28 ms (data transfer time included)
** Programming Finished in 6860 ms **
** Programming Finished in 6860 ms **
** Verify Started **
** Verify Started **
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
[esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Flash verified in 438.214 ms 
PROF: Flash verified in 438.214 ms 
** Verify OK **
** Verify OK **
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)
JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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
[esp32s3.cpu0] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Debug controller was reset.
[esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
[esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu1] requesting target halt and executing a soft reset
[esp32s3.cpu1] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
[esp32s3.cpu1] Debug controller was reset.
[esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Hardware assisted breakpoint 1 at 0x4200c987: file /home/setera/.platformio/packages/framework-arduinoespressif32-src-6738aaddd9fb901216d5f60e093380b6/cores/esp32/main.cpp, line 89.
PlatformIO: Initialization completed
(gdb) PlatformIO: Resume the execution to `debug_init_break = thb app_main`
PlatformIO: More configuration options -> https://bit.ly/pio-debug
Continuing.

Hello!
I am facing same issue here. Let me know if you get solution.

Could you specify “embedded debugger”? The ESP32-S3-DevKitC1 comes with two USB micro/C ports: one of them is connected to the USB-UART bridge, the other one directly to the MCU for either USB-stack compatibility or debugging. Do you mean the latter? If so, try it with this configuration:

[env:esp32-s3-devkitc-1-debug]
platform = espressif32
framework = arduino
board = esp32-s3-devkitc-1
upload_speed = 921600
upload_protocol = esp-builtin
monitor_speed = 115200
build_type = debug
debug_speed = 40000
debug_init_break = tbreak setup
debug_tool = esp-builtin
debug_build_flags = -O0 -g -ggdb

I will give this a try, although I find it strange that the same config file and the same connection would give me different results. I originally had some of these settings in my config and removed them to match up to the blink example.

Unfortunately, this gives me exactly the same behavior. If it matters at all, this is the dev board I’m using: Amazon.com It seems to be a pretty accurate knock off of the espressif dev board.

Given that the blink application does break for debug properly, I’m a bit confused about what might be going on. Is there a chance that something with the libraries I’m using may be putting the JTAG pins into a different mode that causes issues in some way?

Ok, got mine working!!! I’m running on a Mac, but Windows should be very similar. Read the whole comment, especially what I wrote at the end.

Here is a working platformio.ini:

; PlatformIO Project Configuration File

[env:esp32-s3-devkitc-1-debug]

platform = espressif32
framework = arduino
board = esp32-s3-devkitc-1
upload_speed = 921600
upload_protocol = esp-builtin
monitor_speed = 115200
build_type = debug
debug_speed = 40000
; debug_init_break = tbreak setup
debug_tool = esp-builtin
debug_build_flags = -O0 -g -ggdb
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
; -DARDUINO_USB_MODE=1. this may be required for your board

Please note that the debug_init_break = tbreak setup line is commented out. Apparently, there’s an issue with the debugger doing the “normal” stop in setup. When you comment this out, the program will first stop in what looks like the FreeRTOS startup (no problem), just set your breakpoints in your code and just press continue. You can keep the breakpoints set, it’ll just always break first in the RTOS code.

Here’s a quick test program:

#include <Arduino.h>

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  Serial.println("Hello, World!");
  delay(1000);
}

If you want the serial IO to work, go to the bottom of the VSCode window, choose the right plug icon, and specify that the serial output is via the JTAG, there’s a drop down that pops up when you click on the serial source icon.

Now the big thing…

The ESP32‑S3’s native USB port must be in boot loader (JTAG) mode. To do this:

  1. Disconnect the USB cable.
  2. Hold the BOOT button.
  3. Plug in the USB cable.
  4. Tap the RESET/EN button.
  5. Release the BOOT button.
    Now upload or debug your program. You’ll notice that the three color RGB LED stops cycling and you have a stable debugging environment!!!

I hope this helps. Good luck to all!

One more thing, if your running on a Mac you need the libusb suite installed through brew of similar system. I have no idea on Windows…

I will give this a try. I still find it strange that it “just works” without all of this for the blink sketch, but not my test application. Out of interest, you mention the USB unplug/replug steps. Do you have two USB connections or just one?

I use just one, and the JTAG and Serial functionality work perfectly.

My device has two USB connections, a USB (with JTAG, etc) and a UART which looks more like previous generations. In my case, I’m connecting to the USB connection. I’m not sure if that makes any difference.

Interestingly, I was able to get debugging to work with a little manual intervention. While I can try setting an initial breakpoint, it does not seem to fire. However, if I issue an “interrupt” command in the debug console then things seem to resolve and future breakpoints will work properly. That is kind of a pain, but I can probably work around it. It will make early startup debugging more difficult, but I think if I put a long “delay” in place in the setup code, I should be able to interrupt and then go from there. In the end, this seems like maybe some kind of race condition.

If anyone has any other suggestions, I’d love to hear them. However, this at least gives me something to work with.

You definitely need to use the USB connection not the COM port for JTAG interfacing.

I understand the weirdness that you’re describing I too am starting to experience strange inconsistent behavior. Until now I was ready to throw my previous design away in favor of a more stable embedded JTAG interface rather than the very flaky external esp-prog interface.

I’m kind of at a loss right now, since I really do think the ESP32s are amazing in their functionality, but without a good consistent debugging interface they’re kind of a waste of time for writing anything more complex than a blink program and certainly using FreeRTOS. Does anyone have a suggestion of a professional development environment that can be relied upon without needing extra “magic” to get things done? I know the good folks are VSCode and PlatformIO have done a remarkable job, but something isn’t right. I’ve reinstalled VSCode and PIO many times and I can’t get a consistent result from the debugging interface specifically. Switching to the embedded JTAG was my last resort and it’s failing…

FWIW… the interrupt trick seemed to work…but then didn’t work next time I tried. Inconsistent to be sure.

Exactly, that’s the problem! When it works, it works well, but you never know… I’m guessing that there’s a timing issue somewhere but have no way of knowing.