Page 1 of 1

ESP32-CAM only saves in FRAMESIZE_CIF

Posted: Mon Aug 24, 2020 10:59 pm
by andreaconsole
Hi everyone, first post here.
It's my first experience with ESP32-CAM and I started from some sample code found online. In particular, I use this snippet to configure the camera:

Code: Select all

// camera config
  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;

  // init with high specs to pre-allocate larger buffers
  if(psramFound()){
    config.frame_size = FRAMESIZE_SVGA;
    config.jpeg_quality = 10;  //0-63 lower number means higher quality
    config.fb_count = 2;
  } else {
    config.frame_size = FRAMESIZE_CIF;
    config.jpeg_quality = 12;  //0-63 lower number means higher quality
    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);
    delay(1000);
    ESP.restart();
  }
Unfortunately, I'm only getting FRAMESIZE_CIF pictures.
I'm using an ESP32-CAM module by DIY STORE. On the back, it says "ESP32-S". Is it a problem with the code or a limit of the dev board?
Thank you.

Re: ESP32-CAM only saves in FRAMESIZE_CIF

Posted: Fri Sep 04, 2020 2:04 pm
by alanesq
It could be your esp32 camera module doesn't have a psram chip installed in which case the line "if(psramFound()){.." would set it back down to CIF.