1
\$\begingroup\$

I recently bought an ESP-prog module, and use it to debug/program esp32 chips, using vscode and platformio. I am connecting the JTAG cable and the program cable. Debugging works well, and programming works too.

EDIT : Here is my platformio.ini file :

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino

upload_protocol = esp-prog
upload_port = COM5
debug_tool = esp-prog
debug_init_break = tbreak setup

But there is something that surprises me and which would be quite a problem for me in the longer run. I see that when I disconnect (all or part of) the JTAG cable (for example MTMS) and attempt to program, the debug log shows the following:

Open On-Chip Debugger  v0.11.0-esp32-20220411 (2022-04-11-08:48)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

adapter speed: 20000 kHz

WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
DEPRECATED! use 'adapter speed' not 'adapter_khz'
adapter speed: 5000 kHz

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
Warn : target esp32.cpu0 examination failed
Warn : target esp32.cpu1 examination failed
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: Couldn't halt target before SoC reset
embedded:startup.tcl:1162: Error: ** Unable to reset target **
in procedure 'program_esp'
in procedure 'program_error' called at file "C:/Users/nico/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 93
at file "embedded:startup.tcl", line 1162
*** [upload] Error 1

I am quite surprised as I thought the program cable alone was enough to program a chip:

  • EN+IO0 to reset and set boot mode
  • TX/RD to communicate
  • Vcc and GND to power

I think that would be enough, especially as pressing the RST (en) button on the ESP-prog board correctly reset the target chip (ESP32 devkit doit v1 with 30 pins) through the program cables. So I do not understand why ESP-prog tries to use JTAG to reset the target MCU.

By the way, I know that the specific devkit I am using currently as a target, has on-board USB-to-TTL chip. But I wanted to verify that the ESP-prog will actually be able to program the onboard ESP32 of the future custom boards directly (only using program pins)

So if JTAG is actually required to program with ESP-prog, that is unfortunate, because I have bunch of board we designed which have the program pins available, but not the JTAG pins. So if JTAG is required for ESP-prog to program the MCU, then I will not be able to program the target boards, and ... that is bad.

Maybe it is a simple PIO/platform/board/OpenOCD configuration setting, I do not know.

I'll take any advice on this subject.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ JTAG is not needed to program. The log you posted appears to be from a JTAG debugger (not esptool) and of course that won't work without JTAG, but you can still program the flash over USB using esptool (which uses the boot ROM downloader of the ESP32). \$\endgroup\$
    – TypeIA
    May 17, 2022 at 6:43
  • 2
    \$\begingroup\$ Check your configuration in platformio.ini I dare say the programmer option is set to jtag \$\endgroup\$
    – Kartman
    May 17, 2022 at 7:56
  • \$\begingroup\$ @TypeIA so if i understand what you are saying, as the ESP-prog board is considered a JTAG debugger, its specific upload protocol is using all its available functionalities (including JTAG) even for the "simpler" programming function ? \$\endgroup\$
    – nipil
    May 18, 2022 at 21:04
  • \$\begingroup\$ @Kartman thanks for the hint, i edited my question and added the content of my platformio.ini file. Upload protocol is set to esp-prog, but i do not know what/where i can analyse the default/defined behaviour of this specific uploader \$\endgroup\$
    – nipil
    May 18, 2022 at 21:05
  • \$\begingroup\$ @nipil I'm not familiar with the ESP-prog board, but a quick glance here does seem like it's JTAG-only. But I can confirm that it is possible to program an ESP32 flash from UART (RX/TX pins) using the downloader in ROM. For this you need the esptool Python kit and a USB-to-serial setup (dev boards have builtin USB UARTs but FTDI cables or any other external USB UART can also work). Sorry I can't offer more on the ESP-prog... good luck! \$\endgroup\$
    – TypeIA
    May 19, 2022 at 7:40

1 Answer 1

1
\$\begingroup\$

You told platformio to use the jtag-programmer by using

upload_protocol = esp-prog

in the platformio.ini file, if you change that to:

upload_protocol = esptool

it'll work without ESP-PROG.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.