Debugging AI Thinker ESP32-CAM with ESP-Prog

Stephen Cow Chau
4 min readDec 23, 2022

--

2023–08–08 update:

A good reference I found online:

Background

While developing on ESP32 is challenging without debugging tools, I finally have access to a debugging tool, the ESP-Prog.

There have been some challenges for wiring the ESP-Prog with the AI thinker ESP32-CAM MCU, with helps from some great articles on the web as well as some trial and error to fill in the gaps, I have it finally connected, and so I would like to share it here.

Environment setup

I am using a Windows 10 installed PlatformIO (as Visual Studio Code extension), with project using espressif-arduino framework, but I think esp-IDF setup would just do fine.

I haven’t try debugging with Arduino IDE, but I see resources (article/video) online trying to use Arduino IDE to debug with another popular FTDI FT232 debugging tool, so I assume once the wiring is managed, it should be working.

Useful Resources

I would like to give credits to the following article that helped me through the exercise:

ESP-prog official doc page — have pin info and schematic

Hacker.io reference — the video reference referred from PlatformIO esp-prog page, need sign up

ESP32-CAM AI-Thinker Pinout Guide: GPIOs Usage Explained — the random nerd tutorial for ESP32-CAM

ESP32-CAM pin-out — in a type by type explanation

ESP-prog on ESP32 — very detail reference, but only on ESP32 dev board

ESP32-CAM-MB schematic — in Japanese, with diagram, this act as reference that what pins are used in AI thinker mother-board setup (reference for serial wiring)

The Setup

Software / Driver

Ref: https://community.platformio.org/t/esp32-pio-unified-debugger/4541/20

1. Download and install the driver for FTDI (http://www.ftdichip.com/Drivers/VCP.htm)

2. Download Zadig tool from https://zadig.akeo.ie/

3. At Zadig Tool, go Options -> List all devices, choose the interface for the USB ports

Mine is Dual RS232-HS, interface 0 => do ONLY interface 0 , see note below for reason

4. Replace the driver

This screen is from one of the reference above, not my own screen capture

IMPORTANT : after the driver replacement, corresponding USB Serial Converter and USB Serial Port (COM) would be gone in device management, and so there is no COM port for serial monitoring

So ONLY replace driver for interface 0, but NOT interface 1, each of them correspond to a COM port, COM7 in my case (the higher number one) is remain for monitoring (Serial connection), and the other (COM 6, the lower one) would be used for JTAG.

*To roll back, go to Windows device manager and upgrade driver for the USB controller (from WinUSB v6.1.7600.16385 to v10.x in my case).

Wiring

The top diagram (th AI thinker ESP32-CAM pin layout) is also a borrowed screen from one of the reference article

Note: There are 2 jumpers setting voltage out for each set of pins, my settings as follow:

  • PROG PWR SEL set to 3.3V (as the VDD is wired to ESP32-CAM 3.3V)
  • JTAG PWR SEL set to 5V (as the VDD is wired to ESP32-CAM 5V)
side note: the ESP-Prog PCB also mentioned the COM port (Program COM n+1, JTAG COM n), which align with what mentioned above
A table for reference

PlatformIO project setup

Follow: https://docs.platformio.org/en/stable/plus/debug-tools/esp-prog.html

Add debug_tool = esp-prog, and upload_protocol = esp-prog

Also at launch.json, change the “projectEnvName” and “executable” path

NOTE: the launch.json occasionally fall back to “prod” which is not target env in my case, so need to change from time to time

Example below:

Conclusion

Happy debugging!

--

--