ESP USB Bridge project converts ESP32-S2 or ESP32-S3 into a USB to UART/JTAG chip

Espressif’s ESP USB Bridge is a project based on the ESP-IDF that leverages ESP32-S2 or ESP32-S3 USB interface to use the board as a USB to UART or USB to JTAG debug board.

It can serve as a substitute for USB to TTL debug boards based on CH340 or CP2104 for instance, be used with OpenOCD in JTAG bridge mode, and also flash UF2 firmware file to the target board.

ESP USB Bridge UART & JTAG
Host computer, ESP32-S2/S3 board running ESP USB Bridge firmware, and target board with USB and/or JTAG

As just mentioned, there are three main use cases:

  • Serial bridge mode with a terminal program or a firmware flashing tool like esptool. In that case, it just works like your typical USB to TTL debug board
  • JTAG bridge mode for JTAG debugging with OpenOCD, and if the target board is based on ESP32, you can use openocd-esp32 project
  • Mass storage device where the board can be accessed by a file manager on the host computer. One of the specific use cases in this mode is to copy a UF2 firmware file that can then be flashed to the target microcontroller by ESP32-S2/S3. At this time, ESP USB Bridge only supports UF2 flashing to Espressif microcontrollers.

The source code, released under an Apache 2.0 license, and instructions can be found on Github. You’ll need an ESP32-S2 or ESP32-S3 board that exposes the USB DM/DP pins as well as UART and/or JTAG interfaces. Something like Lolin S2 Mini should do the job as a USB to UART board with USB and UART available on the headers, but if you need JTAG, the ESP32-S3-USB-OTG board should be a better option. The ESP-IDF 4.3 or greater is required to build the project.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX Rockchip RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
13 Comments
oldest
newest
Unai Uribarri
2 years ago

All PIN numbers can be configured when building the firmware with menuconfig command, so Lolin S2 mini should work also for JTAG debugging. Nonetheless, it will be better to try!

Mike
Mike
2 years ago

Not all of them. The USB pins cant.

DM
DM
2 years ago

Why only the S2 or S3 models? IIUTC, OTG isn’t needed for this, so (almost) any ESP32 should work…

Rogan Dawes
Rogan Dawes
2 years ago
  DM

Only the S2 and S3 have programmable USB interfaces, otherwise it’s a bit difficult to have a USB-anything adapter.

That said, I think there is a lot of potential to implement the same features exposed via WiFi or Bluetooth. I know xobs is working on porting Black Magic Probe’s firmware to the ESP32, with the objective of doing “wireless debugging”.

Merging some of the ESPLink and BMP features could be pretty slick.

Frank Earl
Frank Earl
2 years ago

Known issues: JTAG is slow. That’s a bit of a dealbreaker there. In truth, the right FTDI chips work as a basic JTAG bridge anyhow. What we’re needing is something more along the lines of an amped up Black Magic Probe.

igrr
igrr
2 years ago

We plan to fix the JTAG speed issue! We thought it was more useful to release the project in its current state and get some feedback from the community than to wait until this issue was fixed.

(It’s still not going to be as fast as, say, FT2232H, since esp32-s2 only has a full-speed USB controller. However after some optimizations it should be comparable to esp32-c3’s built-in USB_SERIAL_JTAG which is sufficiently fast for normal run-control debugging)

David
David
2 years ago

Same/similar idea(s) but using the cheap and available Raspberry Pi Pico board instead. So far I’ve just been collecting links, but I hope to try some these out myself – eventually. Using the Pico as a Sigrok/PulseView adapter looks cool. * MicroZed Chronicles: JTAG using a Raspberry Pi Pico https://www.adiuvoengineering.com/post/microzed-chronicles-jtag-using-a-raspberry-pi-pico * Turning Raspberry Pi Pico into an SWD Debug Probe (2-Wire) with Picoprobe https://visualgdb.com/tutorials/raspberry/pico/picoprobe/ * Pico UART-USB bridge https://forums.raspberrypi.com/viewtopic.php?t=302684 * sigrok-pico – Use a raspberry pi pico (rp2040) as a logic analyzer and oscilloscope with sigrok (PulseView). This implementation uses the pico SDK CDC serial library to communicate with sigrok-cli/pulseview… Read more »

zoobab
2 years ago

There is a fork of DirtyJTAG to run on the Pico as well:

phdussud/pico-dirtyJtag (github.com)

itchy n scratchy
itchy n scratchy
2 years ago

What about the C3? That also seems to have the required functionality?!

0xjakob
0xjakob
2 years ago

C3 doesn’t have full USB-device functionality, only a fixed USB-serial device. I think that approach would be much more limited.

Theguyuk
Theguyuk
2 years ago

While I get it is a fun project, when you look at cp2102 boards etc on Aliexpress. They are so cheap!

Mike
Mike
2 years ago

The introduction of the S3 has been a game changer for us. I just wish Espressif’ would get USB Host mode examples so we can connect a keyboard to our ESP32. IMHO they need to slow down pumping out new SOC’s and put more energy into software dev.

Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...