PlatformIO Community

Catching boot mode on ESP32

So I have my unit tests working on the ESP32 using Unity. Great!

On my current dev board, I have to catch the boot mode on every upload. So, when I do a Upload normally, I get to this part in the output:

Serial port /dev/cu.usbserial-0001
Connecting..................

and I have to be releasing the boot mode button on the dev kit to get my upload to go through, or else I get this error:

A fatal error occurred: Failed to connect to ESP32: Wrong boot mode detected (0x13)! The chip needs to be in download mode.

The problem with running tests from the UI, even in Verbose Test, is that the Connecting... part of the output doesn’t get printed. We just get:

Processing test_device_data_lib in esp_devkit environment
-------------------------------------------------------------------------------------------------------------------------------------------
Building & Uploading...

And it’s hard to know when it might be trying to upload.

The workaround for now is to run from the commandline with super-verbose.

pio test -e esp_devkit -vvv

Which will show when the connecting action happens.

This kind of sucks as a workflow. Also, if you ever clean the vvv mode is so verbose the terminal output is the bottleneck and you’re stuck with a very slow build.

Does any have suggestions on improving this workflow to make running tests easier? I would really like to just be able to hit the test button from the Platformio plugin in VS Code.

Well that seems weird, a ESP32 dev kit is supposed to have a auto-reset circuit (2 transistors between DTR/RTS and EN/GPIO0) so that the entire reset-into-bootloader and thus flashing procedure is 100% hands off and automatable. If that’s not happening someone messed up the hardware design of your dev kit very badly.

See ESP32 devkit schematics in regards to Q1 and Q2.

It could be split into Building & Uploading, yeah. You can file an issue at Issues · platformio/platformio-core · GitHub to get that logged and discussed.