ESP32 and Arduino

Hii! I am trying to do a serial connection between my esp32 and Arduino. However I keep running into this error right here on the ESP32 side
"Sketch uses 279513 bytes (21%) of program storage space. Maximum is 1310720 bytes.
Global variables use 20192 bytes (6%) of dynamic memory, leaving 307488 bytes for local variables. Maximum is 327680 bytes.
"C:\Users\keeer\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\4.6/esptool.exe" --chip esp32 --port "COM8" --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode keep --flash_freq keep --flash_size keep 0x1000 "C:\Users\keeer\AppData\Local\Temp\arduino\sketches\0B74496D15A79224774F47E756362692/sketch_jul15b.ino.bootloader.bin" 0x8000 "C:\Users\keeer\AppData\Local\Temp\arduino\sketches\0B74496D15A79224774F47E756362692/sketch_jul15b.ino.partitions.bin" 0xe000 "C:\Users\keeer\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2/tools/partitions/boot_app0.bin" 0x10000 "C:\Users\keeer\AppData\Local\Temp\arduino\sketches\0B74496D15A79224774F47E756362692/sketch_jul15b.ino.bin"
esptool.py v4.6
Serial port COM8
Connecting......................................

A fatal error occurred: Failed to connect to ESP32: No serial data received.
For troubleshooting steps visit: Troubleshooting - ESP32 - — esptool.py latest documentation
Failed uploading: uploading error: exit status 2"

I checked, my computer does recognize the device so I know that's not the issue. I did run it once and I didn't get an error then. I ran it again and then the error showed back up.

I am using a "HiLetgo ESP-WROOM-32D" board, and I am not sure which board to select in the board selector. (I don't know if this is a factor)

Thank You!

Please post the picture of your ESP32 and Arduino to know if you are using 30-pin/38-pin ESP32 and Arduino UNO/NANO/MEGA/DUE.

You do know that you can't have anything connected to the serial port while loading code?


this is the image of my circuit. I'm pretty sure its not set up right..

Hi @eskerworld. Did you connect a USB cable between the ESP32 board and your computer before you attempted uploading? Or are you hoping to do the upload to the ESP32 board through the UNO R3?

It should not be. You can just select "ESP32 Dev Module" from the board selector and that one will work fine with this board.

1. Disconnect all connections from ESP32 and UNO.
2. Now, carry out the following steps to connect ESP32 and UNO as per Fig-1. Note that you need to use level shifter as ESP32 is a 3.3V logic Device and UNO is a 5V logic Deivice; otherwise, one or both boards might get damaged.


Figure-1:

(1) Place level shfter on breadboard.
(2) Take four jumpers and check their continuities using DVM in tone mode.
(3) Connect ESP32 side with level shifter.
(4) Take four jumpers and check their continuities using DVM in tone mode.
(5) Connect UNO side with level shifter.
(6) Connect ESP32 with PC using USB Port. Please, do not use Battery at this time.

(7) Open IDE from Start Icon of Windows Tool Bar. Check that the PC has assigned a COM Port for the ESP32.

(8) Connect UNO with PC using a second USB Port.
(9) Open a second IDE from Start Icon of Windows Tool Bar. Check that the PC has assigned a COM Port for the UNO which is different from that of ESP32.

(10) Upload the following sketch into ESP32 (untested).

void setup()
{
    Serial.begin(9600);
    Serial1.begin(9600);
}

void loop()
{
     Serial1.println('A')
     delay(1000);
}

(11) Upload the following sketch into UNO (untested):

#include<SoftwareSerial.h>
SoftwareSerial SUART (4, 5);

void setup()
{
    Serial.begin(9600);
    SUART.begin(9600);
}

void loop()
{
     byte n = SUART.available();
     if(n != 0)
     {
         char ch = SUART.read();
         Serial.println(ch);
     }
}

(12) Press and Hold Reset Buttons of both ESP32 and UNO.
(13) Release Reset Buttonof UNO.
(14) Release Reset Button of ESP32.
(15) OPen Serial Monitor (SM) of UNO at Bd = 9600.
(16) Check that SM of UNO is showing charcater A (coming from ESP32) at 1-sec interval.

(17) Add codes with the above shetches to send character 'B from UNO to ESP32 and SM od ESP32 will show B at 1-sec interval.