Help with startup of an ESP32 design

Hi

I have a small project with an ESP32. As a development platform I’ve been using Espressif DevkitC.

I started with designing small software modules and later integrated those modules into an application. Unfortunately there was not enough flash on the ESP32 module on the DevkitC board.

So, I made a board by myself containing an ESP-WROOM-32D module. I supposed to be able to use the JTAG and Serial interface on my ESP32-PROG.

Loading a small program using JTAG worked well.

Loading using Serial interface, NO

Measurements on the board shows that RX and TX signals in the Serials interface are not changing at all. Completely “dead”.

Bringing up Windows 10 device manager shows a USB device “Dual RS232-HS”. This is correct I think.

What’s not so correct is that I only have one com port ( COM5 ). Should it not be another com port belonging to the “Dual RS232-HS”. I used the com5 port to run JTAG loading.

Where did my com port go ???

Please help.

Did you load any other drivers with Zadig? If yes I’d just recommend to reboot the computer. With no driver modifications done, you should be seeing two plain COM ports.

Of course for JTAG uploading you need to reconfigure one of those interfaces to the libusb drivers using Zadig. Then it’ll be correct that you have one COM port (and one libusb device which will be used for JTAG loading). “JTAG loading” is not done over a COM device.

I recommend to first check the serial port with some simple data, i.e. upload (using JTAG) a program that print some text to the serial port (every second or so). Then try if you can see the output with a terminal program.

This is to support @maxgerhardt instructions, i.e. to sort out any driver issues.

Once it works, the next thing to investigate is the reset / boot mode on upload. Have you implemented an automatic reset logic that will put the chip into upload mode using the DTR/RTS signals? Or do you need to press a BOOT button for initiating an upload?

I have followed the instructions and reconfigured interface 0, ( COM5 ) to the libusb driver. Then I loaded a small program over JTAG. Works fine. PlatformIO uses COM5 to load the application. I can set breakpoints, start and stop execution etc.

I have rebooted the computer many times. I only see COM5.
When I try to load the same application as mention above, using serial communication ( regonfigured PlatformIO ), PlatformIO uses COM5 ( according to debug terminal ). This obvious is not working. After a while PlatformIO times out and a error message is shown.

Problem is that I am not seeing any other COM port, there is no other port to use.

This sounds like a misunderstanding: JTAG does not use a COM port. A single COM port is correct.

ESP-Prog has two logical USB interfaces:

  • Interface 0 is used for JTAG connector on the ESP-Prog. It should have the libUSB/WinUSB installed. It will not present a COM port. And PlatformIO doesn’t used a COM port to upload and debug firmware using JTAG.

  • Interface 1 is used for the serial connection on the ESP-Prog. It should have the FTDI drivers installed and will present itself as a COM port. It can be used for serial communication (using a terminal program) and – if the ESP-Prog is set into upload mode – to upload firmware.

I have FTDI drivers installed but I cant see this one,

If you check List All Devices, you should be able to see two interfaces:

Note that installed drivers on the left-hand side. The screenshots show the correct configuration.

This should result in a single COM port. From the device manager, it’s very difficult to tell which interface contributed the COM port.

I have exatly the same configuration, so lets assume it is correct.

I added a logic anylyzer to the signals in the serial interface. I’ve expected that the signals in the ESP32-PROG serial interface to move when trying to upload a application. They dont move at all.
Thats why I started to look for other sources of error.

Is there other sources for error?

Can you post two screenshots of Zadig for Interface 0 and 1 of the Dual RS232-HS interface and a screenshot of your Windows device manager with the COM ports expanded?

What’s the platformio.ini of the project?

interface 0 interface 1

[env:startup]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
;debug_tool=esp-prog
;upload_protocol=esp-prog
lib_deps =
lib_extra_dirs = ../library

This looks correct. What is the log when pressing the “Upload” button? Does it show esptool and how its uploading via COM7? Or is it picking COM3 by accident…

My latest upload and monitor

> Executing task: C:\Users\lglin\.platformio\penv\Scripts\platformio.exe run --target upload --target monitor --environment startup <

Processing startup (platform: espressif32; board: esp32dev; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (2.0.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 3.10004.201016 (1.0.4)
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - tool-mkspiffs 2.230.0 (2.30)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 26 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Retrieving maximum program size .pio\build\startup\firmware.elf
Checking size .pio\build\startup\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.7% (used 15436 bytes from 327680 bytes)
Flash: [==        ]  16.5% (used 216613 bytes from 1310720 bytes)
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: COM7
Uploading .pio\build\startup\firmware.bin
esptool.py v2.6
Serial port COM7
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
*** [upload] Error 2
====================================================================================== [FAILED] Took 27.81 seconds ======================================================================================
The terminal process "C:\Users\lglin\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload', '--target', 'monitor', '--environment', 'startup'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

FYI
My latest run was without my own design card.

I connected my logic analyzer to the serial contact on ESP32-PROG.

All signal is stable high during my “load”. Nothing moves.

The ESP32 could not be put in bootloader mode through the DTR/RTS (<=> EN / GPIO0) reboot-to-bootloader mechanism (this needs two transistors as seen in the reference schematic).

Please manually put the ESP32 into bootloader mod by

  1. Powering the board
  2. Connecting GPIO0 to GND
  3. Pulsing the EN (/RST) line to GND for a moment

Then rerun the upload. Does it upload now? (For the firmware to run, the GPIO0 - GND bridge must be removed again and the reset button must be pushed)

Thanks guys, discussion and information with you really helped.

The “error” was.
ESP32_PROG hav a picture of the serial connector and how it should be connector. I wrongly assumed that TX in the connector should be connected to RX in the module, and vice versa.
Wrong. Studying the schematics shows that they internallt on the ESP32_PROG makes this “reroute”.

Now it works as expected.

Thanks again.

1 Like