Page 1 of 1

ESP32 ESP-Prog not debugging in Eclipse

Posted: Fri Aug 13, 2021 4:03 pm
by louis___
Hi all,

I'm trying to debug a project which uses an ESP32-WROOM using an ESP-Prog board. I've connected all of the JTAG, UART, EN and IO0 connections to the board and I can successfully flash a device as long as I hold IO2 low. However, I cannot seem to get debugging working.

Hardware: ESP32-WROOM, all JTAG pins are unused except for JTAG, ESP32 has been programmed to remove default AT image. Powered by 3.3V. All JTAG connections seem fine i.e. ESP-Prog TDI <-> ESP32 TDI, ESP-Prog TMS <-> ESP32 TMS etc. I'm selecting ttyUSB0 (the lower of the 2 comports from the ESP-Prog).

My environment: I'm using Eclipse which is running on a Ubuntu virtual machine. USB ports seem to work fine.

Debug configuration:
Debugger --> OpenOCD Setup
GDB port: 3333
Telnet port: 444
Tcl port: 6666
Config options: -s ${openocd_path}/share/openocd/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp-wroom-32.cfg
Debugger --> GDB Setup
Commands: set mem inaccessible-by-default off
Initialization Commands:
mon program_esp /home/rpd/esp/esp-idf-v4.2/examples/get-started/hello_world/build/hello-world.bin 0x10000 verify
mon reset halt
flushregs
set remote hardware-watchpoint-limit 2


When attempting to debug, this is the log I get:

Code: Select all

Open On-Chip Debugger  v0.10.0-esp32-20200709 (2020-07-09-08:54)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz

WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
Info : Configured 2 cores
Started by GNU MCU Eclipse
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Error: No symbols for FreeRTOS
Error: Target not examined yet
Error executing event gdb-attach on target esp32:

Error: Target not halted
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
shutdown command invoked
I've been battling this for days now and am really need some help.

Thank you in advance

Re: ESP32 ESP-Prog not debugging in Eclipse

Posted: Sat Aug 14, 2021 1:32 am
by ESP_Sprite
For what it's worth, the logs state that OpenOCD cant physically contact the ESP32. Not sure why, your description of what to do seems OK... Stupid question maybe, but do you also use a common ground for the ESP-Prog and the Wroom module? Also, the default setting is to use a clock of 10MHz... if your connections are a bit janky (DuPont wires) that may be too high; you can probably go into the configuration files and change the adapter_khz value to adjust that down, see if that works.

Re: ESP32 ESP-Prog not debugging in Eclipse

Posted: Mon Aug 16, 2021 8:35 am
by louis___
Not a stupid question at all. The grounds are the same.

On the clock frequency, I changed the from 1MHz to 100kHz and I've pretty much got the same response. See below:

Code: Select all

Open On-Chip Debugger  v0.10.0-esp32-20200709 (2020-07-09-08:54)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 100 kHz

WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
Info : Configured 2 cores
Started by GNU MCU Eclipse
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 100 kHz
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Error: No symbols for FreeRTOS
Error: Target not examined yet
Error executing event gdb-attach on target esp32:

Error: Target not halted
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
shutdown command invoked

Re: ESP32 ESP-Prog not debugging in Eclipse

Posted: Mon Aug 16, 2021 9:00 am
by ESP_Sprite
Another thought: what is running in the ESP32 now? If it's something that reconfigures the JTAG pins to be used e.g. as GPIOs, you'd also see this result.

Re: ESP32 ESP-Prog not debugging in Eclipse

Posted: Mon Aug 16, 2021 10:01 am
by louis___
I've tried debugging with both the blink and the hello_world get-started examples from ESP-IDF which (I don't think) use the JTAG pins and get the same result. (just to be clear, I can program with the ESP-Prog but not debug).

Re: ESP32 ESP-Prog not debugging in Eclipse

Posted: Tue Aug 17, 2021 1:31 am
by ESP_Sprite
Hmm, I don't know any other things except for hardware issues... do you have a logic analyzer or (preferably) scope so you can see if there's activity on the JTAG pins when you start up OpenOCD? Do you have another ESP32 devboard you can try the ESP-Prog on? Do you have another JTAG pod that you can try on your board?

Re: ESP32 ESP-Prog not debugging in Eclipse

Posted: Tue Aug 17, 2021 1:11 pm
by louis___
I connected the ESP-Prog JTAG connections (TMS, TDI, TDO, TCLK, GND and VJTAG for power) to a ESP32-WROOM dev board (USB not connected) and I got the following log output. It's not entering a debug mode correctly still and I can't step through anything.

Code: Select all

Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
invalid command name "arm"
Error: Too large number of threads 2779096485!
Error: Too large number of threads 2779096485!
===== Xtensa registers
(0) pc (/32): 0x40000400
(1) ar0 (/32): 0x00000000
(2) ar1 (/32): 0x00000000
(3) ar2 (/32): 0x00000000
(4) ar3 (/32): 0x00000000
(5) ar4 (/32): 0x00000000
(6) ar5 (/32): 0x00000000
(7) ar6 (/32): 0x00000000
(8) ar7 (/32): 0x00000000
(9) ar8 (/32): 0x00000000
(10) ar9 (/32): 0x00000000
It looks like I'm so close I can taste it and this makes me believe there's a hardware issue with my custom board. I'll look more at the custom hardware but if you have any thoughts on the dev board JTAG that would be fab.

Re: ESP32 ESP-Prog not debugging in Eclipse

Posted: Wed Aug 18, 2021 1:20 am
by ESP_Sprite
Not sure about the dev board; it could be a speed / signal integrity issue, it could be because of the program loaded in it. However, with the devboard you for sure do get a JTAG connection, so your thought that the issue is likely in your hardware sounds correct.

Re: ESP32 ESP-Prog not debugging in Eclipse

Posted: Wed Sep 01, 2021 6:36 am
by wilkxt
I have similar problem, i solved this by put pin ESP_EN (from ESP-prog ) to 3,3V in my board. It's weird but it works