# Failed to connect to ESP32: No serial data received

**URL:** <https://forum.arduino.cc/t/failed-to-connect-to-esp32-no-serial-data-received/1338282>\
**Category:** Uploading\
**Created:** [January 2, 2025, 5:29pm UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp32-no-serial-data-received/1338282 "2025-01-02T17:29:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![veszter](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@veszter](https://forum.arduino.cc/u/veszter)\
**Post date:** [January 2, 2025, 5:29pm UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp32-no-serial-data-received/1338282/1 "2025-01-02T17:29:51Z")

</div>

A fatal error occurred: Failed to connect to ESP32: No serial data received.  
For troubleshooting steps visit: [Troubleshooting - ESP32 - — esptool.py latest documentation](https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html)  
Failed uploading: uploading error: exit status 2

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/2/a/5/2a5ade8cd8a4da13546aa97327bae2b03679844f.png)

I have tried to upload a code from Arduino Ide 2.3.4 to ESP32-CAM through Arduino Uno R4 WIFI, but at every time I get this error. I am using this setup:

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/c/4/8/c4855e2274cc65851278c7fbe18853d2d27b5265.png)

but I've already tried with AI Thinker ESP32-CAM, I just want firstly to upload some dummy examples.

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [January 2, 2025, 6:17pm UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp32-no-serial-data-received/1338282/2 "2025-01-02T18:17:22Z")

</div>

Read the pinned post on how to get the most from this forum.

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [January 3, 2025, 12:00am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp32-no-serial-data-received/1338282/3 "2025-01-03T00:00:21Z")

</div>

Hi @veszter.

> [@veszter](#):
>
> I have tried to upload a code from Arduino Ide 2.3.4 to ESP32-CAM through Arduino Uno R4 WIFI

Please provide a detailed description of how you are doing this. We need:

- A detailed description of the connections between the two boards
- Whether you have uploaded any special sketch to the UNO R4 WiFi board for this purpose, and if so, the full code of that sketch.

---

<div class="post-metadata">

**Author:** ![veszter](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@veszter](https://forum.arduino.cc/u/veszter)\
**Post date:** [January 3, 2025, 8:44am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp32-no-serial-data-received/1338282/4 "2025-01-03T08:44:06Z")

</div>

Hi @ptillisch.

The connection between arduino uno r4 and esp32 - cam:  
Arduino - ESP32  
TX-1 - UOR (But I've tried with UOT too)  
RX-0 - UOt (But I've tried with UOR too)

ESP32  
IO0 - GND (I've tried with the other GND too)

And the code for it:  
#include "esp\_camera.h"  
#include \<WiFi.h\>

//  
// WARNING!!! PSRAM IC required for UXGA resolution and high JPEG quality  
// Ensure ESP32 Wrover Module or other board with PSRAM is selected  
// Partial images will be transmitted if image exceeds buffer size  
//  
// You must select partition scheme from the board menu that has at least 3MB APP space.  
// Face Recognition is DISABLED for ESP32 and ESP32-S2, because it takes up from 15  
// seconds to process single frame. Face Detection is ENABLED if PSRAM is enabled as well

// ===================  
// Select camera model  
// ===================  
//#define CAMERA\_MODEL\_WROVER\_KIT // Has PSRAM  
//#define CAMERA\_MODEL\_ESP\_EYE // Has PSRAM  
//#define CAMERA\_MODEL\_ESP32S3\_EYE // Has PSRAM  
//#define CAMERA\_MODEL\_M5STACK\_PSRAM // Has PSRAM  
//#define CAMERA\_MODEL\_M5STACK\_V2\_PSRAM // M5Camera version B Has PSRAM  
//#define CAMERA\_MODEL\_M5STACK\_WIDE // Has PSRAM  
//#define CAMERA\_MODEL\_M5STACK\_ESP32CAM // No PSRAM  
//#define CAMERA\_MODEL\_M5STACK\_UNITCAM // No PSRAM  
//#define CAMERA\_MODEL\_M5STACK\_CAMS3\_UNIT // Has PSRAM  
#define CAMERA\_MODEL\_AI\_THINKER // Has PSRAM  
//#define CAMERA\_MODEL\_TTGO\_T\_JOURNAL // No PSRAM  
//#define CAMERA\_MODEL\_XIAO\_ESP32S3 // Has PSRAM  
// \*\* Espressif Internal Boards \*\*  
//#define CAMERA\_MODEL\_ESP32\_CAM\_BOARD  
//#define CAMERA\_MODEL\_ESP32S2\_CAM\_BOARD  
//#define CAMERA\_MODEL\_ESP32S3\_CAM\_LCD  
//#define CAMERA\_MODEL\_DFRobot\_FireBeetle2\_ESP32S3 // Has PSRAM  
//#define CAMERA\_MODEL\_DFRobot\_Romeo\_ESP32S3 // Has PSRAM  
#include "camera\_pins.h"

// ===========================  
// Enter your WiFi credentials  
// ===========================  
const char _ssid = "__**";  
const char password = "**_";

void startCameraServer();  
void setupLedFlash(int pin);

void setup() {  
Serial.begin(115200);  
Serial.setDebugOutput(true);  
Serial.println();

camera\_config\_t config;  
config.ledc\_channel = LEDC\_CHANNEL\_0;  
config.ledc\_timer = LEDC\_TIMER\_0;  
config.pin\_d0 = Y2\_GPIO\_NUM;  
config.pin\_d1 = Y3\_GPIO\_NUM;  
config.pin\_d2 = Y4\_GPIO\_NUM;  
config.pin\_d3 = Y5\_GPIO\_NUM;  
config.pin\_d4 = Y6\_GPIO\_NUM;  
config.pin\_d5 = Y7\_GPIO\_NUM;  
config.pin\_d6 = Y8\_GPIO\_NUM;  
config.pin\_d7 = Y9\_GPIO\_NUM;  
config.pin\_xclk = XCLK\_GPIO\_NUM;  
config.pin\_pclk = PCLK\_GPIO\_NUM;  
config.pin\_vsync = VSYNC\_GPIO\_NUM;  
config.pin\_href = HREF\_GPIO\_NUM;  
config.pin\_sccb\_sda = SIOD\_GPIO\_NUM;  
config.pin\_sccb\_scl = SIOC\_GPIO\_NUM;  
config.pin\_pwdn = PWDN\_GPIO\_NUM;  
config.pin\_reset = RESET\_GPIO\_NUM;  
config.xclk\_freq\_hz = 20000000;  
config.frame\_size = FRAMESIZE\_UXGA;  
config.pixel\_format = PIXFORMAT\_JPEG; // for streaming  
//config.pixel\_format = PIXFORMAT\_RGB565; // for face detection/recognition  
config.grab\_mode = CAMERA\_GRAB\_WHEN\_EMPTY;  
config.fb\_location = CAMERA\_FB\_IN\_PSRAM;  
config.jpeg\_quality = 12;  
config.fb\_count = 1;

// if PSRAM IC present, init with UXGA resolution and higher JPEG quality  
// for larger pre-allocated frame buffer.  
if (config.pixel\_format == PIXFORMAT\_JPEG) {  
if (psramFound()) {  
config.jpeg\_quality = 10;  
config.fb\_count = 2;  
config.grab\_mode = CAMERA\_GRAB\_LATEST;  
} else {  
// Limit the frame size when PSRAM is not available  
config.frame\_size = FRAMESIZE\_SVGA;  
config.fb\_location = CAMERA\_FB\_IN\_DRAM;  
}  
} else {  
// Best option for face detection/recognition  
config.frame\_size = FRAMESIZE\_240X240;  
#if CONFIG\_IDF\_TARGET\_ESP32S3  
config.fb\_count = 2;  
#endif  
}

#if defined(CAMERA\_MODEL\_ESP\_EYE)  
pinMode(13, INPUT\_PULLUP);  
pinMode(14, INPUT\_PULLUP);  
#endif

// camera init  
esp\_err\_t err = esp\_camera\_init(&config);  
if (err != ESP\_OK) {  
Serial.printf("Camera init failed with error 0x%x", err);  
return;  
}

sensor\_t \*s = esp\_camera\_sensor\_get();  
// initial sensors are flipped vertically and colors are a bit saturated  
if (s-\>id.PID == OV3660\_PID) {  
s-\>set\_vflip(s, 1); // flip it back  
s-\>set\_brightness(s, 1); // up the brightness just a bit  
s-\>set\_saturation(s, -2); // lower the saturation  
}  
// drop down frame size for higher initial frame rate  
if (config.pixel\_format == PIXFORMAT\_JPEG) {  
s-\>set\_framesize(s, FRAMESIZE\_QVGA);  
}

#if defined(CAMERA\_MODEL\_M5STACK\_WIDE) || defined(CAMERA\_MODEL\_M5STACK\_ESP32CAM)  
s-\>set\_vflip(s, 1);  
s-\>set\_hmirror(s, 1);  
#endif

#if defined(CAMERA\_MODEL\_ESP32S3\_EYE)  
s-\>set\_vflip(s, 1);  
#endif

// Setup LED FLash if LED pin is defined in camera\_pins.h  
#if defined(LED\_GPIO\_NUM)  
setupLedFlash(LED\_GPIO\_NUM);  
#endif

WiFi.begin(ssid, password);  
WiFi.setSleep(false);

while (WiFi.status() != WL\_CONNECTED) {  
delay(500);  
Serial.print(".");  
}  
Serial.println("");  
Serial.println("WiFi connected");

startCameraServer();

Serial.print("Camera Ready! Use 'http://");  
Serial.print(WiFi.localIP());  
Serial.println("' to connect");  
}

void loop() {  
// Do nothing. Everything is done in another task by the web server  
delay(10000);  
}

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 2, 2025, 8:44am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp32-no-serial-data-received/1338282/5 "2025-07-02T08:44:22Z")

</div>

Closed on July 2, 2025, 8:44am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
