Can't upload code to ESP32 CAM via FTDI module

milklizard88
Posts: 3
Joined: Mon Apr 24, 2023 9:00 am

Can't upload code to ESP32 CAM via FTDI module

Postby milklizard88 » Sat Jun 17, 2023 3:41 pm

When I try to upload the CameraWebServer example to an esp32 cam via an FTDI adapter (this one https://www.amazon.co.uk/dp/B07R17BMTL? ... ct_details), it seems to not be giving me a serial connection.

I get a solid red LED on the FTDI adapter when I hook it up.

I troubleshooted this online and all the suggestions say are "check you've got the correct COM port" but it only gives me one option and the port works when I want to upload to other esp32 and arduino devices etc.

I've tried with another esp32 cam and another FTDI adapter, same issue

Here's the specific error message

"esptool.py v4.2.1

A fatal error occurred: Failed to connect to ESP32: No serial data received. the selected serial port does not exist or your board is not connected"

Connections I'm using; https://imgur.com/gallery/hFaJJzB

Settings: https://imgur.com/gallery/K3cdRbu

Code is as follows, there's actually 3 other tabs to the code which are full of random stuff, but it won't fit onto the post
  1. #include "esp_camera.h"
  2. #include <WiFi.h>
  3.  
  4. //
  5. // WARNING!!! PSRAM IC required for UXGA resolution and high JPEG quality
  6. //            Ensure ESP32 Wrover Module or other board with PSRAM is selected
  7. //            Partial images will be transmitted if image exceeds buffer size
  8. //
  9. //            You must select partition scheme from the board menu that has at least 3MB APP space.
  10. //            Face Recognition is DISABLED for ESP32 and ESP32-S2, because it takes up from 15
  11. //            seconds to process single frame. Face Detection is ENABLED if PSRAM is enabled as well
  12.  
  13. // ===================
  14. // Select camera model
  15. // ===================
  16. #define CAMERA_MODEL_WROVER_KIT // Has PSRAM
  17. //#define CAMERA_MODEL_ESP_EYE // Has PSRAM
  18. //#define CAMERA_MODEL_ESP32S3_EYE // Has PSRAM
  19. //#define CAMERA_MODEL_M5STACK_PSRAM // Has PSRAM
  20. //#define CAMERA_MODEL_M5STACK_V2_PSRAM // M5Camera version B Has PSRAM
  21. //#define CAMERA_MODEL_M5STACK_WIDE // Has PSRAM
  22. //#define CAMERA_MODEL_M5STACK_ESP32CAM // No PSRAM
  23. //#define CAMERA_MODEL_M5STACK_UNITCAM // No PSRAM
  24. //#define CAMERA_MODEL_AI_THINKER // Has PSRAM
  25. //#define CAMERA_MODEL_TTGO_T_JOURNAL // No PSRAM
  26. // ** Espressif Internal Boards **
  27. //#define CAMERA_MODEL_ESP32_CAM_BOARD
  28. //#define CAMERA_MODEL_ESP32S2_CAM_BOARD
  29. //#define CAMERA_MODEL_ESP32S3_CAM_LCD
  30.  
  31. #include "camera_pins.h"
  32.  
  33. // ===========================
  34. // Enter your WiFi credentials
  35. // ===========================
  36. const char* ssid = "ssid";
  37. const char* password = "password";
  38.  
  39. void startCameraServer();
  40. void setupLedFlash(int pin);
  41.  
  42. void setup() {
  43.   Serial.begin(115200);
  44.   Serial.setDebugOutput(true);
  45.   Serial.println();
  46.  
  47.   camera_config_t config;
  48.   config.ledc_channel = LEDC_CHANNEL_0;
  49.   config.ledc_timer = LEDC_TIMER_0;
  50.   config.pin_d0 = Y2_GPIO_NUM;
  51.   config.pin_d1 = Y3_GPIO_NUM;
  52.   config.pin_d2 = Y4_GPIO_NUM;
  53.   config.pin_d3 = Y5_GPIO_NUM;
  54.   config.pin_d4 = Y6_GPIO_NUM;
  55.   config.pin_d5 = Y7_GPIO_NUM;
  56.   config.pin_d6 = Y8_GPIO_NUM;
  57.   config.pin_d7 = Y9_GPIO_NUM;
  58.   config.pin_xclk = XCLK_GPIO_NUM;
  59.   config.pin_pclk = PCLK_GPIO_NUM;
  60.   config.pin_vsync = VSYNC_GPIO_NUM;
  61.   config.pin_href = HREF_GPIO_NUM;
  62.   config.pin_sscb_sda = SIOD_GPIO_NUM;
  63.   config.pin_sscb_scl = SIOC_GPIO_NUM;
  64.   config.pin_pwdn = PWDN_GPIO_NUM;
  65.   config.pin_reset = RESET_GPIO_NUM;
  66.   config.xclk_freq_hz = 20000000;
  67.   config.frame_size = FRAMESIZE_UXGA;
  68.   config.pixel_format = PIXFORMAT_JPEG; // for streaming
  69.   //config.pixel_format = PIXFORMAT_RGB565; // for face detection/recognition
  70.   config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
  71.   config.fb_location = CAMERA_FB_IN_PSRAM;
  72.   config.jpeg_quality = 12;
  73.   config.fb_count = 1;
  74.  
  75.   // if PSRAM IC present, init with UXGA resolution and higher JPEG quality
  76.   //                      for larger pre-allocated frame buffer.
  77.   if(config.pixel_format == PIXFORMAT_JPEG){
  78.     if(psramFound()){
  79.       config.jpeg_quality = 10;
  80.       config.fb_count = 2;
  81.       config.grab_mode = CAMERA_GRAB_LATEST;
  82.     } else {
  83.       // Limit the frame size when PSRAM is not available
  84.       config.frame_size = FRAMESIZE_SVGA;
  85.       config.fb_location = CAMERA_FB_IN_DRAM;
  86.     }
  87.   } else {
  88.     // Best option for face detection/recognition
  89.     config.frame_size = FRAMESIZE_240X240;
  90. #if CONFIG_IDF_TARGET_ESP32S3
  91.     config.fb_count = 2;
  92. #endif
  93.   }
  94.  
  95. #if defined(CAMERA_MODEL_ESP_EYE)
  96.   pinMode(13, INPUT_PULLUP);
  97.   pinMode(14, INPUT_PULLUP);
  98. #endif
  99.  
  100.   // camera init
  101.   esp_err_t err = esp_camera_init(&config);
  102.   if (err != ESP_OK) {
  103.     Serial.printf("Camera init failed with error 0x%x", err);
  104.     return;
  105.   }
  106.  
  107.   sensor_t * s = esp_camera_sensor_get();
  108.   // initial sensors are flipped vertically and colors are a bit saturated
  109.   if (s->id.PID == OV3660_PID) {
  110.     s->set_vflip(s, 1); // flip it back
  111.     s->set_brightness(s, 1); // up the brightness just a bit
  112.     s->set_saturation(s, -2); // lower the saturation
  113.   }
  114.   // drop down frame size for higher initial frame rate
  115.   if(config.pixel_format == PIXFORMAT_JPEG){
  116.     s->set_framesize(s, FRAMESIZE_QVGA);
  117.   }
  118.  
  119. #if defined(CAMERA_MODEL_M5STACK_WIDE) || defined(CAMERA_MODEL_M5STACK_ESP32CAM)
  120.   s->set_vflip(s, 1);
  121.   s->set_hmirror(s, 1);
  122. #endif
  123.  
  124. #if defined(CAMERA_MODEL_ESP32S3_EYE)
  125.   s->set_vflip(s, 1);
  126. #endif
  127.  
  128. // Setup LED FLash if LED pin is defined in camera_pins.h
  129. #if defined(LED_GPIO_NUM)
  130.   setupLedFlash(LED_GPIO_NUM);
  131. #endif
  132.  
  133.   WiFi.begin(ssid, password);
  134.   WiFi.setSleep(false);
  135.  
  136.   while (WiFi.status() != WL_CONNECTED) {
  137.     delay(500);
  138.     Serial.print(".");
  139.   }
  140.   Serial.println("");
  141.   Serial.println("WiFi connected");
  142.  
  143.   startCameraServer();
  144.  
  145.   Serial.print("Camera Ready! Use 'http://");
  146.   Serial.print(WiFi.localIP());
  147.   Serial.println("' to connect");
  148. }
  149.  
  150. void loop() {
  151.   // Do nothing. Everything is done in another task by the web server
  152.   delay(10000);
  153. }

milklizard88
Posts: 3
Joined: Mon Apr 24, 2023 9:00 am

Re: Can't upload code to ESP32 CAM via FTDI module

Postby milklizard88 » Wed Jun 21, 2023 3:48 pm

Update: I've bought a new ESP cam from a different manufacturer and I still have the same problems

I've tried uploading using the ESP32-CAM MD shield, same problem.

I tried using a second PC to do the uploading, same problem.

Tried multiple USB cables, doesn't seem to be the issue

I tried using the new arduino IDE and got a different error message but it basically says the same thing (see screenshot here https://imgur.com/gallery/g5tAOek)

I finally tried connecting it up to the 5V input, and changed the jumper on the FTDI to 5v, which was probably the stupidest thing I've ever done and ended up burning my finger on the cam (and probably destroying the board)

I'm getting a bit frustrated at this now, clearly I'm doing something fundamentally wrong as every single thing I try isn't making a difference

Please help!

Who is online

Users browsing this forum: top_secret_guy and 109 guests