news

Introducing the ESP USB Bridge

Shanghai, China
Apr 29, 2022

With the ESP USB Bridge you can convert ESP32-S2 or ESP32-S3 into a USB-to-UART/JTAG chip.

The ESP USB Bridge is an ESP-IDF project utilizing an ESP32-S2 or an ESP32-S3 to create a link between a computer (PC) and a target microcontroller (MCU). It can serve as a replacement for USB-to-UART chips, e.g. CP210x.

The concept of ESP USB Bridge is demonstrated below:

The ESP USB Bridge creates a composite USB device that can be accessed by a computer via a USB cable. Here are the main use cases:

  • Serial bridge: The developer can run esptool or connect a terminal program to the serial port provided by the USB CDC. The two-way communication between the PC and the target MCU is achieved through the ESP USB Bridge.
  • JTAG bridge: openocd-esp32 can run on the PC, which will connect to the ESP USB Bridge. The ESP32-S2 functions, again, as a bridge between the PC and the MCU, materializing the JTAG communication between the two in both directions.
  • Mass storage device: a USB Mass storage device is created and can be accessed by a file explorer in the PC. Binaries in UF2 format can be copied to this disk and ESP32-S2 will use them to flash the target MCU. Currently, the ESP USB Bridge is capable of flashing various Espressif microcontrollers.

Note that, while the above-mentioned readme files use only ESP32-S2 as an example, the ESP USB Bridge project can also be based on ESP32-S3.

How to Compile the Project

To compile the project, you need to use ESP-IDF v4.3 or a later version.

  • idf.py menuconfig can be used to change the default configuration. The project-specific settings are in the "Bridge Configuration" sub-menu.
  • idf.py build will build the project binaries.
  • idf.py -p PORT flash monitor will flash ESP32-S2 and open the terminal program for monitoring. Please note that PORT is the serial port created by a USB-to-UART chip connected to the serial interface of ESP32-S2 (not the direct USB interface provided by ESP32-S2). This serial connection has to be established only for flashing. The ESP USB Bridge can work through the USB interface afterwards.

Development Board

A simple development board connecting an ESP32-S2 to an ESP32 that serves as the target MCU is shown in the following schematics. The default configurations of the project have been tested with this particular setup.

Similar boards can be manufactured and flashed with the ESP USB Bridge. The pin numbers, vendor and product identifiers, as well as any other settings can be changed in idf.py menuconfig.

Please note that every board should have its own vendor and product identifiers. There is also a possibility to register a product identifier under the Espressif vendor identifier.

To get all the details about the ESP USB Bridge project, please visit our relevant webpage on GitHub.

Share this article
Reuse this content

Ioannis

Technical Writer and Editor

About this author ›