Exit status 2, no serial data received. My first topic

I've been trying to use the webcameraserver example from arduino. When I uploaded it the first couple of times it almost worked, it uploaded, and when I checked the serial monitor and clicked on the reset button I haven't been receiving an address to view the stream on. When I tried to upload it again later I have been getting this same error over and over again. I followed this tutorial that worked on my classmates laptop sometimes (she uses windows 11): https://www.youtube.com/watch?v=q-KIpFIbRMk&ab_channel=TechStudyCell

error: 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

to give more context, this is my current setup:
I have an arduino uno, an esp32 (AI thinker), and an esp8266 connected together in this structure
arduino to esp32:

  • Tx to UnR
  • Rx to UoT
  • 5V to 5V
  • GND to GND

ESP32 to itself:

  • 100 to GND

arduino to esp8266:

  • 3.3v to vcc
  • digital pin 7 to GPIO 3 (pin on top of vcc)
  • digital pin 6 to GPIO 1
  • GND to GND

I use the standard blue USB cable that comes with the arduino box kit to connect it to my computer.

Here are the things I have done so far:

  • after uploading I remove the 100 to GND pins on the esp32 (at the start when it was almost working)
  • used a different esp32
  • changed all the wiring to new wires
  • press the reset button while connecting
  • tried to install the ch340 driver, but when click manually search on my windows to browse through this folder to install the driver it tells me that the best driver is already installed
  • tried to upload on 2 different computers
  • switched the comm ports on both, for some reason it is always known as COM4. When I check the port on device manager, it correctly states that it is an arduino uno, so it is being recognized.
  • I reverted back to the legacy IDE
  • Re-installed IDE
  • Restarted my computer
  • tried to upload any other sketch (alone at once), the same error happens
  • I made sure to enter the SSID and Password correctly on the webcamera server code, and selected the appropriate model

I don't know how I can make my windows 10 receive serial data from the esp32, I have the most recent version of IDE downloaded and updated my windows 10 to the latest (up to date). Is there something I'm missing. please help me I'm starting to feel hopeless.

Hi @lamar2427. I see something amiss between these two pieces of information:

This error indicates that you have an ESP32 board selected from the Tools > Board menu in Arduino IDE.

This statement indicates that you have the port of the Arduino UNO board selected from the Tools > Port menu in Arduino IDE.

Which board are you intending to upload the sketch to?

hello and thank you for the reply,

I am intending to upload the sketch to the esp32. I have this currently selected from the board manager menu: esp32 wrover module. I have also tried selecting the esp32 AI thinker module and have gotten the same error as output.

Do you have the ESP32 board connected to your computer with a USB cable? If not, you need to do that.

Do you see a port for the ESP32 board in Arduino IDE's Tools > Port menu?

Unlike the UNO board, the port of the ESP32 board won't be labeled in the menu (this is because the ESP32 board uses a general purpose USB to serial bridge chip instead of a custom programmed USB chip like the UNO). You can identify the port of the ESP32 board by performing this procedure:

  1. Disconnect the USB cable of the ESP32 board from your computer.
  2. Select Tools > Port from the Arduino IDE menus.
  3. Take note of the ports, if any, listed in the menu.
  4. Close the Tools menu.
    :exclamation: The ports list is only updated when the Tools menu is re-opened, so this step is essential.
  5. Connect the ESP32 board to your computer with a USB cable.
  6. Select Tools > Port from the Arduino IDE menus. - If a new port is listed in the menu, that is the port of your Arduino board.

Select that port from the menu and try uploading again.

If the upload still fails, or if no new port appeared after you plugged the Arduino board into your computer, add a reply here to let us know and we'll investigate the problem further.

the esp32 is connected to the arduino, the arduino is connected to the computer through the usb cable. Do I need to directly connect the esp32 through an FDTI connector?

Ah, I see now. I should have looked at the YouTube video. Your ESP32-CAM board doesn't have a USB to serial bridge so you are using the UNO board as one.

The first thing I should warn you about is that the ESP32 uses 3.3 V logic levels, while the UNO uses 5 V. This means that the circuit shown in the YouTube video is exposing the ESP32 to 5 V, which is outside its maximum rating. As evidenced by the video, it will probably work anyway without causing the ESP32 to go up in smoke immediately, but it is not really a good idea to exceed the ratings on electronics. So this is definitely an "at your own risk" sort of thing.

There is also an error in your circuit:

Counterintuitively, you must make the connections between the UNO and ESP32 like this:

UNO ESP32
RX RX
TX TX

If you look closely at the YouTube video, you will see this is what they have done.

The reason is that the purpose of this circuit is to connect the ATmega16U2 USB to serial bridge chip on the UNO to the ESP32. The labels on the pins on the UNO are in relation to the pins on its primary ATmega328P microcontroller chip, not the ATmega16U2. The ATmega16U2 has an RX-TX, TX-RX connection to the ATmega328P, so the pin labeled "RX" on the UNO is actually connected to the TX pin on the ATmega16U2, and the pin labeled "TX" on the UNO is connected to the RX pin on the ATmega16U2. So the connections I describe above is actually an RX-TX, TX-RX connection between the ATmega16U2 and the ESP32.

I would also recommend you to connect the RESET pin on the UNO to the GND pin. The reason is that if the sketch that happens to be running on the UNO's ATmega328P does any serial communication then that can interfere with the communication between the ATmega16U2 and the ESP32. Holding the ATmega328P in reset prevents its program from running and thus any chance of interference.

You need to take precautions when you connect a 5V device (Uno) to a 3.3V device (ESP32/ESP8266); 5V signals like Uno Tx it can be very unhealthy for the 3.3V device.

It sounds like you're trying to use the Uno as a serial-to-usb converter. If that is correct, the 328P on the Uno need to be kept in reset and Tx of the Uno should go to Tx of the ESP32 and Rx of the Uno should go to Rx of the ESP32.

hello again,

I followed your instructions .Thankfully the code was able to upload as expected, after the upload I unplugged the 100 to gnd pins on the esp32, so I can press the reset button to find the address to the camera server on serial monitor (the same as the video). Instead of receiving the address I was met with the same output I received at the start when it almost worked.
This is what I received: entry 0x400805f0
E (546) esp_core_dump_flash: �� core dump partition found!
E (546) esp_core_dump_flash: No core dump partition found!

.............................................................................ets Jul 29 2019 12:21:46

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1344
load:0x40078000,len:13936
load:0x40080400,len:3600
entry 0x400805f0
E (680) esp_core_dump_flash: �� core dump partition found!
E (680) esp_core_dump_flash: No core dump partition found!

Great news!

Even though these messages seem alarming, I think they are actually nothing to worry about. Maybe there is a mistake in the partition configuration used by the ESP32-CAM board definition, but it seems that this won't be a problem unless you needed to use an optional advanced debugging feature:

https://docs.espressif.com/projects/arduino-esp32/en/latest/tutorials/partition_table.html?highlight=partion%20table#partition-table:~:text=amounts%20of%20data.-,coredump,-The%20coredump%20partition

There is some discussion here, which seems to indicate that the ESP32 platform developers consider it a non-issue:

I also see this "esp_core_dump_flash: No core dump partition found!" message in the boot output from my ESP32-CAM, but my ESP32-CAM still works fine.

Unintuitively, this is actually the part of the output that indicates a problem. I suspect its origin is this code in the File > Examples > ESP32 > Camera > CameraWebServer example:

So the ... indicates that the ESP32-CAM board is not connecting to your Wi-Fi router. Check to make sure you have configured the correct SSID and password for your router in the sketch code. In the "CameraWebServer" example, they are configured by these lines:

(as shown at this point in the video)

If you find a problem with your Wi-Fi credentials, correct them and then upload the sketch to the ESP32-CAM again. Hopefully this time you will see something like this in Serial Monitor:

........
WiFi connected
Camera Ready! Use 'http://192.168.254.129' to connect

Hello,

I am currently using ethernet that is connected to PC on the same router settings I entered into the code. I realized this could be an issue, so I connected it to my mobile hotspot instead. I am still not receiving an IP address

after trying it on my laptop connected to the router wirelessly it actually worked, thank you very much !

You are welcome. I'm glad it is working now. Thanks for taking the time to post an update!

The ESP32-CAM can only be used with 2.4 GHz access points, so a possible explanation for the failure to connect to the other SSIDs (including your mobile hotspot) you were trying to use were on the 5 GHz band instead of 2.4 GHz.

Regards,
Per

1 Like

I am met with this error once again, I used a different webcamserver code without the extra fluff as I only need the stream. I made sure that this code works before adding the certificate. I tried to incorporate the use of sslclientesp32.h to create an ssl connection using the self signed certificate I made to use on localhost. The code had no compilation errors, but it gave me this error again.

the error:
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 uploading: uploading error: exit status 2

this is my code:

/*********
  Rui Santos
  Complete project details at https://RandomNerdTutorials.com/esp32-cam-video-streaming-web-server-camera-home-assistant/
  
  IMPORTANT!!! 
   - Select Board "AI Thinker ESP32-CAM"
   - GPIO 0 must be connected to GND to upload a sketch
   - After connecting GPIO 0 to GND, press the ESP32-CAM on-board RESET button to put your board in flashing mode
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files.

  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.
*********/

#include "esp_camera.h"
#include <WiFi.h>
#include "esp_timer.h"
#include "img_converters.h"
#include "Arduino.h"
#include "fb_gfx.h"
#include "soc/soc.h" //disable brownout problems
#include "soc/rtc_cntl_reg.h"  //disable brownout problems
#include "esp_http_server.h"
#include "SSLClientESP32.h"
#include <WiFiClientSecure.h>

//Replace with your network credentials
const char* ssid = "esp";
const char* password ="esp@12345";

WiFiClient base_client;
SSLClientESP32 ssl_client(&base_client);

// SSL certificate 
const char* isrg_root_ca =  
"-----BEGIN CERTIFICATE-----\n" \
"(certificate without private key)\n" \
"-----END CERTIFICATE-----\n";


#define PART_BOUNDARY "123456789000000000000987654321"

// This project was tested with the AI Thinker Model, M5STACK PSRAM Model and M5STACK WITHOUT PSRAM
#define CAMERA_MODEL_AI_THINKER
//#define CAMERA_MODEL_M5STACK_PSRAM
//#define CAMERA_MODEL_M5STACK_WITHOUT_PSRAM

// Not tested with this model
//#define CAMERA_MODEL_WROVER_KIT

#if defined(CAMERA_MODEL_AI_THINKER)
  #define PWDN_GPIO_NUM     32
  #define RESET_GPIO_NUM    -1
  #define XCLK_GPIO_NUM      0
  #define SIOD_GPIO_NUM     26
  #define SIOC_GPIO_NUM     27
  
  #define Y9_GPIO_NUM       35
  #define Y8_GPIO_NUM       34
  #define Y7_GPIO_NUM       39
  #define Y6_GPIO_NUM       36
  #define Y5_GPIO_NUM       21
  #define Y4_GPIO_NUM       19
  #define Y3_GPIO_NUM       18
  #define Y2_GPIO_NUM        5
  #define VSYNC_GPIO_NUM    25
  #define HREF_GPIO_NUM     23
  #define PCLK_GPIO_NUM     22
#else
  #error "Camera model not selected"
#endif

static const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;
static const char* _STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
static const char* _STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\n\r\n";

httpd_handle_t stream_httpd = NULL;

static esp_err_t stream_handler(httpd_req_t *req){
  camera_fb_t * fb = NULL;
  esp_err_t res = ESP_OK;
  size_t _jpg_buf_len = 0;
  uint8_t * _jpg_buf = NULL;
  char * part_buf[64];

  res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);
  if(res != ESP_OK){
    return res;
  }

  while(true){
    fb = esp_camera_fb_get();
    if (!fb) {
      Serial.println("Camera capture failed");
      res = ESP_FAIL;
    } else {
      if(fb->width > 400){
        if(fb->format != PIXFORMAT_JPEG){
          bool jpeg_converted = frame2jpg(fb, 80, &_jpg_buf, &_jpg_buf_len);
          esp_camera_fb_return(fb);
          fb = NULL;
          if(!jpeg_converted){
            Serial.println("JPEG compression failed");
            res = ESP_FAIL;
          }
        } else {
          _jpg_buf_len = fb->len;
          _jpg_buf = fb->buf;
        }
      }
    }
    if(res == ESP_OK){
      size_t hlen = snprintf((char *)part_buf, 64, _STREAM_PART, _jpg_buf_len);
      res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);
    }
    if(res == ESP_OK){
      res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);
    }
    if(res == ESP_OK){
      res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));
    }
    if(fb){
      esp_camera_fb_return(fb);
      fb = NULL;
      _jpg_buf = NULL;
    } else if(_jpg_buf){
      free(_jpg_buf);
      _jpg_buf = NULL;
    }
    if(res != ESP_OK){
      break;
    }
    //Serial.printf("MJPG: %uB\n",(uint32_t)(_jpg_buf_len));
  }
  return res;
}


void startCameraServer(){
  httpd_config_t config = HTTPD_DEFAULT_CONFIG();
  config.server_port = 443;

  httpd_uri_t index_uri = {
    .uri       = "/",
    .method    = HTTP_GET,
    .handler   = stream_handler,
    .user_ctx  = NULL
  };
  
  //Serial.printf("Starting web server on port: '%d'\n", config.server_port);
  if (httpd_start(&stream_httpd, &config) == ESP_OK) {
    httpd_register_uri_handler(stream_httpd, &index_uri);
  }
}

void secureclient() {
  if (!ssl_client.connect(WiFi.localIP(), 443)) {
    // Connection failed
  } else {
    // Connection successful
  }
}

void setup() {
  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector
 
  Serial.begin(115200);
  Serial.setDebugOutput(false);

  //attach certificate
  ssl_client.setCACert(isrg_root_ca);

  //camera configuration with pins
  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_sscb_sda = SIOD_GPIO_NUM;
  config.pin_sscb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 20000000;
  config.pixel_format = PIXFORMAT_JPEG; 
  
  if(psramFound()){
    config.frame_size = FRAMESIZE_UXGA;
    config.jpeg_quality = 10;
    config.fb_count = 2;
  } else {
    config.frame_size = FRAMESIZE_SVGA;
    config.jpeg_quality = 12;
    config.fb_count = 1;
  }
  
  // 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;
  }
  // Wi-Fi connection
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  secureclient();
  Serial.println("");
  Serial.println("WiFi connected");
  
  Serial.print("Camera Stream Ready! Go to: http://");
  Serial.print(WiFi.localIP());
  
  // Start streaming web server
  startCameraServer();
  
}

void loop() {
  delay(1);
}

Is there a logical error im not keeping in mind?

This code is a combination of these codes:

/*********
  Rui Santos
  Complete project details at https://RandomNerdTutorials.com/esp32-cam-video-streaming-web-server-camera-home-assistant/
  
  IMPORTANT!!! 
   - Select Board "AI Thinker ESP32-CAM"
   - GPIO 0 must be connected to GND to upload a sketch
   - After connecting GPIO 0 to GND, press the ESP32-CAM on-board RESET button to put your board in flashing mode
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files.

  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.
*********/

#include "esp_camera.h"
#include <WiFi.h>
#include "esp_timer.h"
#include "img_converters.h"
#include "Arduino.h"
#include "fb_gfx.h"
#include "soc/soc.h" //disable brownout problems
#include "soc/rtc_cntl_reg.h"  //disable brownout problems
#include "esp_http_server.h"

//Replace with your network credentials
const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD";

#define PART_BOUNDARY "123456789000000000000987654321"

// This project was tested with the AI Thinker Model, M5STACK PSRAM Model and M5STACK WITHOUT PSRAM
#define CAMERA_MODEL_AI_THINKER
//#define CAMERA_MODEL_M5STACK_PSRAM
//#define CAMERA_MODEL_M5STACK_WITHOUT_PSRAM

// Not tested with this model
//#define CAMERA_MODEL_WROVER_KIT

#if defined(CAMERA_MODEL_WROVER_KIT)
  #define PWDN_GPIO_NUM    -1
  #define RESET_GPIO_NUM   -1
  #define XCLK_GPIO_NUM    21
  #define SIOD_GPIO_NUM    26
  #define SIOC_GPIO_NUM    27
  
  #define Y9_GPIO_NUM      35
  #define Y8_GPIO_NUM      34
  #define Y7_GPIO_NUM      39
  #define Y6_GPIO_NUM      36
  #define Y5_GPIO_NUM      19
  #define Y4_GPIO_NUM      18
  #define Y3_GPIO_NUM       5
  #define Y2_GPIO_NUM       4
  #define VSYNC_GPIO_NUM   25
  #define HREF_GPIO_NUM    23
  #define PCLK_GPIO_NUM    22

#elif defined(CAMERA_MODEL_M5STACK_PSRAM)
  #define PWDN_GPIO_NUM     -1
  #define RESET_GPIO_NUM    15
  #define XCLK_GPIO_NUM     27
  #define SIOD_GPIO_NUM     25
  #define SIOC_GPIO_NUM     23
  
  #define Y9_GPIO_NUM       19
  #define Y8_GPIO_NUM       36
  #define Y7_GPIO_NUM       18
  #define Y6_GPIO_NUM       39
  #define Y5_GPIO_NUM        5
  #define Y4_GPIO_NUM       34
  #define Y3_GPIO_NUM       35
  #define Y2_GPIO_NUM       32
  #define VSYNC_GPIO_NUM    22
  #define HREF_GPIO_NUM     26
  #define PCLK_GPIO_NUM     21

#elif defined(CAMERA_MODEL_M5STACK_WITHOUT_PSRAM)
  #define PWDN_GPIO_NUM     -1
  #define RESET_GPIO_NUM    15
  #define XCLK_GPIO_NUM     27
  #define SIOD_GPIO_NUM     25
  #define SIOC_GPIO_NUM     23
  
  #define Y9_GPIO_NUM       19
  #define Y8_GPIO_NUM       36
  #define Y7_GPIO_NUM       18
  #define Y6_GPIO_NUM       39
  #define Y5_GPIO_NUM        5
  #define Y4_GPIO_NUM       34
  #define Y3_GPIO_NUM       35
  #define Y2_GPIO_NUM       17
  #define VSYNC_GPIO_NUM    22
  #define HREF_GPIO_NUM     26
  #define PCLK_GPIO_NUM     21

#elif defined(CAMERA_MODEL_AI_THINKER)
  #define PWDN_GPIO_NUM     32
  #define RESET_GPIO_NUM    -1
  #define XCLK_GPIO_NUM      0
  #define SIOD_GPIO_NUM     26
  #define SIOC_GPIO_NUM     27
  
  #define Y9_GPIO_NUM       35
  #define Y8_GPIO_NUM       34
  #define Y7_GPIO_NUM       39
  #define Y6_GPIO_NUM       36
  #define Y5_GPIO_NUM       21
  #define Y4_GPIO_NUM       19
  #define Y3_GPIO_NUM       18
  #define Y2_GPIO_NUM        5
  #define VSYNC_GPIO_NUM    25
  #define HREF_GPIO_NUM     23
  #define PCLK_GPIO_NUM     22
#else
  #error "Camera model not selected"
#endif

static const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;
static const char* _STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
static const char* _STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\n\r\n";

httpd_handle_t stream_httpd = NULL;

static esp_err_t stream_handler(httpd_req_t *req){
  camera_fb_t * fb = NULL;
  esp_err_t res = ESP_OK;
  size_t _jpg_buf_len = 0;
  uint8_t * _jpg_buf = NULL;
  char * part_buf[64];

  res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);
  if(res != ESP_OK){
    return res;
  }

  while(true){
    fb = esp_camera_fb_get();
    if (!fb) {
      Serial.println("Camera capture failed");
      res = ESP_FAIL;
    } else {
      if(fb->width > 400){
        if(fb->format != PIXFORMAT_JPEG){
          bool jpeg_converted = frame2jpg(fb, 80, &_jpg_buf, &_jpg_buf_len);
          esp_camera_fb_return(fb);
          fb = NULL;
          if(!jpeg_converted){
            Serial.println("JPEG compression failed");
            res = ESP_FAIL;
          }
        } else {
          _jpg_buf_len = fb->len;
          _jpg_buf = fb->buf;
        }
      }
    }
    if(res == ESP_OK){
      size_t hlen = snprintf((char *)part_buf, 64, _STREAM_PART, _jpg_buf_len);
      res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);
    }
    if(res == ESP_OK){
      res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);
    }
    if(res == ESP_OK){
      res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));
    }
    if(fb){
      esp_camera_fb_return(fb);
      fb = NULL;
      _jpg_buf = NULL;
    } else if(_jpg_buf){
      free(_jpg_buf);
      _jpg_buf = NULL;
    }
    if(res != ESP_OK){
      break;
    }
    //Serial.printf("MJPG: %uB\n",(uint32_t)(_jpg_buf_len));
  }
  return res;
}

void startCameraServer(){
  httpd_config_t config = HTTPD_DEFAULT_CONFIG();
  config.server_port = 80;

  httpd_uri_t index_uri = {
    .uri       = "/",
    .method    = HTTP_GET,
    .handler   = stream_handler,
    .user_ctx  = NULL
  };
  
  //Serial.printf("Starting web server on port: '%d'\n", config.server_port);
  if (httpd_start(&stream_httpd, &config) == ESP_OK) {
    httpd_register_uri_handler(stream_httpd, &index_uri);
  }
}

void setup() {
  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector
 
  Serial.begin(115200);
  Serial.setDebugOutput(false);
  
  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_sscb_sda = SIOD_GPIO_NUM;
  config.pin_sscb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 20000000;
  config.pixel_format = PIXFORMAT_JPEG; 
  
  if(psramFound()){
    config.frame_size = FRAMESIZE_UXGA;
    config.jpeg_quality = 10;
    config.fb_count = 2;
  } else {
    config.frame_size = FRAMESIZE_SVGA;
    config.jpeg_quality = 12;
    config.fb_count = 1;
  }
  
  // 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;
  }
  // Wi-Fi connection
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  
  Serial.print("Camera Stream Ready! Go to: http://");
  Serial.print(WiFi.localIP());
  
  // Start streaming web server
  startCameraServer();
}

void loop() {
  delay(1);
}

and

#include <WiFi.h>
#include "SSLClientESP32.h"

// Create clients
WiFiClient base_client;
SSLClientESP32 ssl_client(&base_client);

// Root Certificate ISRG Root X1
const char* isrg_root_ca = "-----BEGIN CERTIFICATE-----\n"
                           "...\n"
                           "-----END CERTIFICATE-----\n";

void setup() {
  // Attach certificate
  ssl_client.setCACert(isrg_root_ca);

  // Enable WiFi
  WiFi.begin(WIFI_SSID, WIFI_PASS);
}

void foo() {
  if (!ssl_client.connect(SERVER, 443)) {
    // Connection failed
  } else {
    // Connection successful
  }
}

I have merged your cross-posts @lamar2427.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

The logical error is in thinking about your code in response to an upload error. The upload failure is a problem in the communication between the computer and the ESP32 microcontroller while transferring binary data. The sketch code is not directly relevant to this type of problem. Most likely, you would find that the same upload failure will occur no matter what sketch you attempt to upload (though in the case where some communication between the computer and the microcontroller is happening, but unreliably, uploading a more simple sketch might succeed while a complex one fails purely because there is less chance for an intermittent communication error to occur during a quick upload of a small binary).

Did you change anything in your circuit between the UNO and the ESP32-CAM in the time between your successful upload and when the upload started failing again?

Did you put the ESP32-CAM into boot mode before trying the upload by connecting the GPIO0 and GND pins?

1 Like

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