Unable to serial flash ESP32 using an arduino uno

Yash28
Posts: 4
Joined: Tue Dec 19, 2023 9:29 pm

Unable to serial flash ESP32 using an arduino uno

Postby Yash28 » Fri May 24, 2024 8:31 am

I am trying to flash my ESP32-WROOM-32 Devkit with an Arduino UNO to learn about serial flashing because I want to know the ways I can use a WROOM module without the devkit in the future.

I have attached the schematic I am using.

When the ESP32 is connected to the arduino in this way, it isn't able to flash. I am using ESPIDF plugin on VSCode to program it and it works fine if I flash it directly through USB.

Here's the error I get:

Code: Select all

[b]A fatal error occurred: Failed to connect to ESP32: No serial data received.

For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html

FAILED: CMakeFiles/flash D:/Projects/Coding/freeRTOS_Experiment/build/CMakeFiles/flash 

cmd.exe /C "cd /D C:\Users\Yash\esp\esp-idf\components\esptool_py && C:\Users\Yash\.espressif\tools\cmake\3.24.0\bin\cmake.exe -D IDF_PATH=C:/Users/Yash/esp/esp-idf -D SERIAL_TOOL=C:/Users/Yash/.espressif/python_env/idf5.1_py3.11_env/Scripts/python.exe;;C:/Users/Yash/esp/esp-idf/components/esptool_py/esptool/esptool.py;--chip;esp32 -D SERIAL_TOOL_ARGS=--before=default_reset;--after=hard_reset;write_flash;@flash_args -D WORKING_DIRECTORY=D:/Projects/Coding/freeRTOS_Experiment/build -P C:/Users/Yash/esp/esp-idf/components/esptool_py/run_serial_tool.cmake"

ninja: build stopped: subcommand failed.[/b]
The way I do it is by pressing the boot button right after I give the flash command on the computer. Then I press the Enable button quickly.
It gives me this much info immediately, which I am assuming means that both tx and rx pins are working properly (Both tx and rx LEDs blink during this short duration):

Code: Select all

esptool.py v4.7.0
Serial port COM5
Connecting..........
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: fc:b4:67:4e:3c:58
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
But after this it just throws the error that I mentioned above.
Here's what I have done so far on my end:

1. Tried reversing tx and rx connection as if this was a USB-TTL adapter, but that doesn't even start the flashing process.
2. Opened the Arduino IDE and turned on the serial monitor. Surprisingly, the previous program that is already on the ESP32 starts running when I press the En button, and transmits whatever ESP_LOG statements it has to the Arduino IDE serial monitor (Baud rate 115200).
3. Used ESP-IDF terminal inside VSCODE to write this command: "idf.py flash --baud 9600 -p COM5" (The port is correct, I checked). But changing the baud rate has no effect, and the error is still the same.
4. Tried using 5V on both boards to see if brownout detector was causing the issue. It isn't. The entire (previous) program is able to execute in arduino IDE without restarting at any point.
5. Connected the GPIO0 pin to ground directly (same thing as pressing the BOOT button I think) just in case the button was faulty.

I am at my wits' end. Please help.
Attachments
null.png
null.png (201.3 KiB) Viewed 1499 times

Yash28
Posts: 4
Joined: Tue Dec 19, 2023 9:29 pm

Re: Unable to serial flash ESP32 using an arduino uno

Postby Yash28 » Sat May 25, 2024 3:47 am

I managed to fix it by changing both the monitor and flash baud rate to 115200.

Added these two lines in the settings.json file in VSCode:
"idf.monitorBaudRate": "115200",
"idf.flashBaudRate": "115200"

Who is online

Users browsing this forum: no_esperience, noweare and 44 guests