Verify esp-prog

I’m having esp-prog issues.

In an effort to determine what the issues are can I verify that FTDI, OpenOCD and GDB are properly installed/functioning?

Any suggestions?

Is it the issue you described in Debugging Issues, included Platfomrio.ini, Debug Console output, Verbose log?

I still don’t have esp-prog working.

It is related but I’ve come to a point where I’ve researched so much and came to dead ends that I thought I would try to verify if ftdi, openocd and gdb are correct. Thinking something might turn up.

Bottom line is I’m out of options and am grabbing at straws.

I’m starting to realize the amount of effort I’m putting into this might not be worth the reward.

Well as the first sanity check you should make sure OpenOCD can connect via the ESP-PROG’s JTAG connection to the ESP32.

Open a terminal (Windows + R → cmd.exe or whatever terminal app you like) and execute

C:\Users\%USERNAME%\.platformio\packages\tool-openocd-esp32\bin\openocd.exe -s "C:\Users\%USERNAME%\.platformio\packages\tool-openocd-esp32\share\openocd\scripts" -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp-wroom-32.cfg

what does it say?

(the %USERNAME% is intentional and should not be removed.)

This is the output that I have from running the suggested openocd command.

Once the error starts scrolling, to the terminal, the only way to stop is to unplug esp-prog usb.

As of right now I’m confident that the winring and dev mgr setup are correct.

Any suggestions/ideas?

======================================================================

---- Test OPEN OCD ----

Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 5000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 5000 kHz
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: Debug controller 0 was reset (pwrstat=0xFC, after clear 0xFC).
Info : esp32: Core 0 was reset (pwrstat=0xFC, after clear 0xFC).
Info : esp32: Debug controller 1 was reset (pwrstat=0xFE, after clear 0xFE).
Info : esp32: Core 1 was reset (pwrstat=0xFE, after clear 0xFE).
Error: cpu0: esp32_fetch_all_regs (line 273): DSR (FFFFFFFC) indicates target still busy!
Error: cpu0: esp32_fetch_all_regs (line 273): DSR (FFFFFFFC) indicates DIR instruction generated an overrun!
Error: cpu0: esp32_fetch_all_regs (line 303): DSR (FFFFFFFC) indicates target still busy!
Error: cpu0: esp32_fetch_all_regs (line 303): DSR (FFFFFFFC) indicates DIR instruction generated an overrun!
Error: cpu1: esp32_fetch_all_regs (line 273): DSR (FFFFFFFE) indicates target still busy!
Error: cpu1: esp32_fetch_all_regs (line 273): DSR (FFFFFFFE) indicates DIR instruction generated an exception!
Error: cpu1: esp32_fetch_all_regs (line 273): DSR (FFFFFFFE) indicates DIR instruction generated an overrun!
Error: cpu1: esp32_fetch_all_regs (line 303): DSR (FFFFFFFE) indicates target still busy!
Error: cpu1: esp32_fetch_all_regs (line 303): DSR (FFFFFFFE) indicates DIR instruction generated an exception!
Error: cpu1: esp32_fetch_all_regs (line 303): DSR (FFFFFFFE) indicates DIR instruction generated an overrun!
Error: Exception reading pc!

Warn : Received debug request on stalled active core 0.
Info : Target halted. PRO_CPU: PC=0xFFFFFFFC (active) APP_CPU: PC=0x00000000
Error: cpu0: xtensa_write_memory (line 807): DSR (FFFFFFFC) indicates target still busy!
Error: cpu0: xtensa_write_memory (line 807): DSR (FFFFFFFC) indicates DIR instruction generated an overrun!
Warn : esp32: Failed writing 4 bytes at address 0x3ff5f064, data - a1, 3a, d8, 50, 18, 7f, a3, 00
Error: Failed to write ESP32_TIMG0WDT_PROTECT (-4)!
Error: Failed to read break instruction!
Error: cpu0: esp32_write_dirty_registers (line 428): DSR (FFFFFFFC) indicates target still busy!
Error: cpu0: esp32_write_dirty_registers (line 428): DSR (FFFFFFFC) indicates DIR instruction generated an overrun!
Error: cpu1: esp32_write_dirty_registers (line 428): DSR (FFFFFFFE) indicates target still busy!
Error: cpu1: esp32_write_dirty_registers (line 428): DSR (FFFFFFFE) indicates DIR instruction generated an exception!
Error: cpu1: esp32_write_dirty_registers (line 428): DSR (FFFFFFFE) indicates DIR instruction generated an overrun!
Error: cpu0: xtensa_resume_active_cpu (line 632): DSR (FFFFFFFC) indicates target still busy!
Error: cpu0: xtensa_resume_active_cpu (line 632): DSR (FFFFFFFC) indicates DIR instruction generated an overrun!
Error: cpu1: xtensa_resume_active_cpu (line 632): DSR (FFFFFFFE) indicates target still busy!
Error: cpu1: xtensa_resume_active_cpu (line 632): DSR (FFFFFFFE) indicates DIR instruction generated an exception!
Error: cpu1: xtensa_resume_active_cpu (line 632): DSR (FFFFFFFE) indicates DIR instruction generated an overrun!
Error: cpu0: esp32_fetch_all_regs (line 273): DSR (FFFFFFFC) indicates target still busy!
Error: cpu0: esp32_fetch_all_regs (line 273): DSR (FFFFFFFC) indicates DIR instruction generated an overrun!
Error: cpu0: esp32_fetch_all_regs (line 303): DSR (FFFFFFFC) indicates target still busy!
Error: cpu0: esp32_fetch_all_regs (line 303): DSR (FFFFFFFC) indicates DIR instruction generated an overrun!
Error: cpu0: esp32_write_dirty_registers (line 428): DSR (FFFFFFFC) indicates target still busy!
Error: cpu0: esp32_write_dirty_registers (line 428): DSR (FFFFFFFC) indicates DIR instruction generated an overrun!
Error: cpu0: esp32_fetch_all_regs (line 273): DSR (FFFFFFFC) indicates target still busy!
Error: cpu0: esp32_fetch_all_regs (line 273): DSR (FFFFFFFC) indicates DIR instruction generated an overrun!
Error: cpu0: esp32_fetch_all_regs (line 303): DSR (FFFFFFFC) indicates target still busy!
Error: cpu0: esp32_fetch_all_regs (line 303): DSR (FFFFFFFC) indicates DIR instruction generated an overrun!
Error: cpu0: esp32_write_dirty_registers (line 428): DSR (FFFFFFFC) indicates target still busy!
Error: cpu0: esp32_write_dirty_registers (line 428): DSR (FFFFFFFC) indicates DIR instruction generated an overrun!
Error: cpu1: esp32_write_dirty_registers (line 428): DSR (FFFFFFFE) indicates target still busy!
Error: cpu1: esp32_write_dirty_registers (line 428): DSR (FFFFFFFE) indicates DIR instruction generated an exception!

a

  • Do you have anything connected to the ESP32?
  • How is the ESP32 powered? Have you tried shorter USB cables or a different USB port?
  • did you connect any wire to the RST / EN line of the ESP32?

I’ve not yet seen the failure mode where it initially detects the chip and then fails further down the line.

Very interesting. The usual error message is that DSR is all 0xFF (like here), but there seems to be some variation on your output.

This may indicate noise on the wires, or a GND connection issue. Have you replaced the wires between the debugger and the target board already?

There literally only two other google results for DSR (FFFFFFFC).

All my connections are bare-bones…only connections to esp-prog, 5 total wires (4signal, 1 grd). Wire lengths ~6in.

I have tried 2 diff shorter cables and diff ports with the same resluts.

No wires connected to RST/EN.

I have not replaced the wires between debugger and target but I have done continuity test at least 2 times.

What you say is interesting…I’ve been thinking that this may be a defective board but before I jump on that wagon I’d like to have some solid proof.

1 Like

I don’t have any further ideas if you double checked the wiring. Issues · espressif/openocd-esp32 · GitHub would be the next line of support. Or, cross-check it by trying it on a new board.

Since the time of your last post I’ve ordered a new esp-prog, ESP-32 and USB cables of short length. As of today I received all the new hardware and assembled.

I went through the process of start debug and it failed.

I then went back and ran the openocd command that you suggested. See results below.
From what I read if I get the “JTAG tap” then open ocd has started properly.
Once I get that message the terminal doesn’t allow me to do anything else.
I have to “Kill terminal” to get back to a terminal input cursor .

I’m still trying to verify that openocd is functioning properly.
I’m thinking about exploring Jim-Tcl…what do you think?
Am I going in the right direction?
Any suggestions?


Microsoft Windows [Version 10.0.19043.1466]
(c) Microsoft Corporation. All rights reserved.

C:\Users\jake\Documents\PlatformIO\Projects\TestFiles\Test_blink>test_openocd.bat
---- Test OPEN OCD ----
Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 5000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 5000 kHz
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 : Listening on port 3333 for gdb connections

This is correct. If you just open an OpenOCD server with the original command shown above, it is supposed to establish a connection and hold it (and not drop out). If it does that it’s good.

Does debugging work in VSCode now?

After verifying that openocd is correct debugging doesn’t work.

I’ve included the output from my completely redone setup.

Any ideas?


undefinedWarning! Ignore unknown configuration option lbuild_type in section [env:esp32dev]
Reading symbols from c:\Users\jake\Documents\PlatformIO\Projects\TestFiles\Test_blink.pio\build\esp32dev\firmware.elf…
done.
PlatformIO Unified Debugger → Redirecting...
PlatformIO: debug_tool = esp-prog
PlatformIO: Initializing remote target…
Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 5000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 5000 kHz
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 : Detected debug stubs @ 3ffc0c54 on core0 of target ‘esp32’
Info : accepting ‘gdb’ connection from pipe
Error: No symbols for FreeRTOS
Info : Target halted. PRO_CPU: PC=0x400E8212 (active) APP_CPU: PC=0x400E8212
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x400E8212
Info : Flash mapping 0: 0x10020 → 0x3f400020, 44 KB
Info : Flash mapping 1: 0x20018 → 0x400d0018, 97 KB
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x400E8212
Info : Auto-detected flash size 4096 KB
Info : Using flash size 4096 KB
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x400E8212
Info : Flash mapping 0: 0x10020 → 0x3f400020, 44 KB
Info : Flash mapping 1: 0x20018 → 0x400d0018, 97 KB
Info : Using flash size 100 KB
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x400E8212
Info : Flash mapping 0: 0x10020 → 0x3f400020, 44 KB
Info : Flash mapping 1: 0x20018 → 0x400d0018, 97 KB
Info : Using flash size 48 KB
0x400e8212 in String::setLen (this=0x0, len=) at C:\Users\jake.platformio\packages\framework-arduinoespressif32\cores\esp32/WString.h:277
277 inline void setLen(int len) { if (isSSO()) sso.len = len; else ptr.len = len; }
Loading section .dram0.data, size 0x2544 lma 0x3ffbdb60
Loading section .iram0.vectors, size 0x400 lma 0x40080000
Loading section .iram0.text, size 0xd93c lma 0x40080400
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: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1010). Workaround: increase “set remotetimeout” in GDB
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
Info : esp32: Core 0 was reset (pwrstat=0x1F, after clear 0x0F).
Info : esp32: Debug controller 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 1 was reset (pwrstat=0x5F, after clear 0x0F).
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1004). Workaround: increase “set remotetimeout” in GDB
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x40000400
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: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1016). Workaround: increase “set remotetimeout” in GDB
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
Info : esp32: Core 0 was reset (pwrstat=0x1F, after clear 0x0F).
Info : esp32: Debug controller 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 1 was reset (pwrstat=0x5F, after clear 0x0F).
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1011). Workaround: increase “set remotetimeout” in GDB
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x40000400
Loading section .flash.rodata, size 0xb14c lma 0x3f400020
Loading section .flash.text, size 0x18489 lma 0x400d0018
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x40000400
Error: timed out while waiting for target halted / 4 - 2
Info : Target halted. PRO_CPU: PC=0x40091218 (active) APP_CPU: PC=0x40000400
Error: xtensa_wait_algorithm: not halted 0, pc 0x40091218, ps 0x60025
Error: Failed to wait algorithm (-302)!
Error: Algorithm run failed (-302)!
Error: Failed to run flasher stub (-302)!
Error: error writing to flash at address 0x400d0000 at offset 0x00000018
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: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1345). Workaround: increase “set remotetimeout” in GDB
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
Info : esp32: Core 0 was reset (pwrstat=0x1F, after clear 0x0F).
Info : esp32: Debug controller 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 1 was reset (pwrstat=0x5F, after clear 0x0F).
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1017). Workaround: increase “set remotetimeout” in GDB
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
.pioinit:12: Error in sourced command file:
Error finishing flash operation
.pioinit:12: Error in sourced command file:
Error finishing flash operation

This is very unusual. Have you tried different USB ports and USB cables for powering the target board? Can you provide a picture of your setup?

Keep in mind all the HW is new…I replace my previous arrangement.

The usb for the esp-prog ~3ft, for the esp-32 ~5ft.

If the pic is not adequate I can send another.

Does it work better if you plug the cables for JTAG directly into the microcontroller instead of going into the breadboard? Capacitance and inductance can be quite significant.

When you say: “Does it work better if you plug the cables for JTAG directly into the microcontroller instead of going into the breadboard?”

Do you mean a cable that goes from the esp-prog 10-pin connector that has TD0,TD1,etc. directly to the ESP-32? If that’s the case I would have to come up with some configuration to terminate the cable properly on the ESP side. Right now ESP is on breadboard with not socket. I think that’s what you’re implying.

It seems like the ftdi + openocd are operating correctly.

I would like to verify that the connection from openocd to gdb is functioning properly.

Is there anyway to verify this?

No openocd is what throws you the error messages there, GDB just gives OpenOCD the elf file and says, flash it.

I mean to lift the ESP32 board out the breadboard so that you can do a point-to-point connection from the ESP-PROG’s header directly to the pins of the ESP32 dev board.

I resolved the issue.

FIX: do a “pio update”

See post:

The above post led me to the following post which mentioned “pio update”.

Also…thanks for your help.