ESP32 WROOM-32 and JTAG timeout

I have a custom board with an ESP32 WROOM-32U. When I attempt to upload software via JTAG (J-Link), I get a timeout.

I already checked on the following:

  • ESP32 has a stable power supply
  • JTAG pinning is correct
  • J-Link upload works on other ESP32 boards without a problem
  • Adapter speed changes (e.g. 500kHz) have no effect

Here is the timeout error I get:

Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
debug_level: 1
adapter speed: 10000 kHz
esp32 interrupt mask on
Warn : Failed to open device: LIBUSB_ERROR_NOT_SUPPORTED.
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway…
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway…
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
*** [upload] Error 253

Here is the schematic:

The adapter only ever sees a HIGH output on the data line.

Have you tried dialing that down a bit? See ESP32 + J-link debugger does not start - #12 by Yourigh

I forgot to mention: I already tried lower speeds (e.g. 5000kHz)

And even lower ones? Like 1000kHz or 500?

just tried with 500, same error.

Does it matter which board I select in platformio.ini?
Does a blank ESP32 even has a bootloader on board so I can flash software?

Yes it has that in its mask ROM. Can you try the UART bootloader? USB-UART adapter to TXD0, RXD0, reset once while GPIO0 is low to enter it (Home · espressif/esptool Wiki · GitHub)

unfortnuately this is not possible anymore. As you can see from my schematic all pins are pretty much occupied. Also the physical board would need a lot of rework to do that. Only option is JTAG.

Have you checked EN and GPIO00? Are they both pulled high? What’s the matter with the crossed out pull-up resistor of GPIO00?

Which pins on the JTAG header are connected (except TDI, TCK, TMS and TDO)? And have you made sure the JTAG connector is not wired in a mirrored layout?

Are you sure the 100Ω resistors and ESD protection on the JTAG wires are no problem? Are they needed?

EN is pulled high as you can see in schematic. GPIO0 is pulled high by default internally during boot.

I checked if JTAG is wired correctly (I even re-wired it manually to J-Link with jumper cables and a breakout board). Here is the full pin-map:


EDIT: Naming is a little bit confusing. It’s actually SWD pinning and connector, I have an adapter for j-link.

100Ohm and TVS diodes may not be necessary, but it does not hurt. I checked on another ESP32 dev board if adding the 100Ohm causes any problem and it does not.

In the meantime I did the following I skipped my boards PSU and powered the ESP from an external 3.3V but it did not change anything.

Is the default bootloader able to receive uploads via JTAG?

Difficult to say what’s wrong. When I’ve used JTAG with the ESP32, I’ve never connected RESET (EN). It’s not needed. So you could try without it.

Bootloader is not relevant if you use JTAG. It’s at a lower level.

If JTAG is not connected, does the ESP32 boot at all? Do you get output on GPIO01 / TXD0?

What does the oscilloscope show on TDO when you try to upload the firmware?

I don’t have an oscilloscope at the moment but I will try next week as i anyways need to order one. Any way to check if ESP32 is on with a multimeter?
I also tried disconnecting EN but it did not work.
Today I will try VisualGDB to check if it is software/GDB related.
Is my schematic correct, or is there anything i am missing?

I now measured with an oscilloscope. GPIO15 (TDO) is always high. In fact, ESP32 seems to be stuck in reset as all strapping pins are always in their default state. Any ideas?

You seem to have a hardware issue with your board:

  • Check all pins of the ESP32 module with the oscilloscope and make sure they have the expected voltage and don’t show any spikes or noise
  • Disconnect as much as you can from the ESP32
  • Recheck the schematic to make sure no pins have been mixed up
  • Remove the ESP32 module and test it separately to make sure it hasn’t been destroyed
  • I checked all pins, they look fine besides the freezing strapping pins. No noise or spikes.
  • I only powered the ESP32 portion of my board with external 3.3V.
  • I checked the scheamtic and footprints several times already. I haven’t found anything so far. In fact, I soldered some wires on a blank WROOM-32u module to “rebuild” parts of my board on a breadboard - it works…
  • Removing the ESP32 module would be really the last step, as I need to desolder it and there are several parts around it so it will not be easy and I want to avoid to damage the board.

For some reason, I suspect the enable/function on the ESP. It looks like it’s stuck in hardware reset.

Good news :smiley:
It works now! I don’t know why but after one week of trial and error it works now…
I had to flash it first over serial and since then it works… This is very strange.

EDIT: As you can see in the schematic I forgot to put a decoupling capacitor between ESP 3.3V and GND pins. Although my power supply was stable, this missing capacitor caused the issue that ESP was constantly resetting. So if anyone has a similar issue: Put a decoupling cap close to the ESP32!