- ESP-ROM:esp32s3-20210327
- Build:Mar 27 2021
- rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
- SPIWP:0xee
- mode:DIO, clock div:1
- load:0x3fce3808,len:0x44c
- load:0x403c9700,len:0xbe4
- load:0x403cc700,len:0x2a38
- entry 0x403c98d4
- [ 115][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
- [ 129][D][esp32-s3-minimal-ov5640-test.ino:18] printDebugMemoryInfo(): Total heap: 388856
- [ 129][D][esp32-s3-minimal-ov5640-test.ino:19] printDebugMemoryInfo(): Free heap: 363272
- [ 134][D][esp32-s3-minimal-ov5640-test.ino:20] printDebugMemoryInfo(): Total PSRAM: 8386295
- [ 142][D][esp32-s3-minimal-ov5640-test.ino:21] printDebugMemoryInfo(): Free PSRAM: 8386295
- [ 1057][I][camera_functions.ino:84] camera_capture(): [camera_functions.ino] Picture taken! Its size was: 1452 bytes
- FFD8FFE000104A46494600010101000000000000FFDB0043000C08090B09080 ... 00A2800A2800A2800A2800A2800A2800A2800A2800A2800A2800A2800A2800A2803FFFD9
When setting the resolution to HQVGA (240x176) we get the following output:
When setting the resolution to FRAMESIZE_QSXGA 2560x1920 we get "camera capture failed error", despite PSRAM being enabled and abundant.
Here is the arduino config:
Here is the arduino code:
main file
- #include "esp_camera.h"
- void setup()
- {
- Serial.begin(115200);
- printDebugMemoryInfo();
- camera_init();
- }
- void loop()
- {
- camera_capture();
- delay(5000);
- }
- void printDebugMemoryInfo()
- {
- log_d("Total heap: %d", ESP.getHeapSize());
- log_d("Free heap: %d", ESP.getFreeHeap());
- log_d("Total PSRAM: %d", ESP.getPsramSize());
- log_d("Free PSRAM: %d", ESP.getFreePsram());
- }
- #include "esp_camera.h"
- #define CAM_MODULE_NAME "Arducam OV5640D"
- #define CAM_PIN_PWDN -1
- #define CAM_PIN_RESET -1
- #define CAM_PIN_VSYNC 12
- #define CAM_PIN_HREF 11
- #define CAM_PIN_PCLK 10
- #define CAM_PIN_XCLK 9
- #define XCLK_FREQ_HZ 20000000
- #define CAM_PIN_SIOD 13 //sda
- #define CAM_PIN_SIOC 8 //scl
- #define CAM_PIN_D0 4
- #define CAM_PIN_D1 5
- #define CAM_PIN_D2 6
- #define CAM_PIN_D3 7
- #define CAM_PIN_D4 15
- #define CAM_PIN_D5 16
- #define CAM_PIN_D6 17
- #define CAM_PIN_D7 18
- static const char* TAG = "camera_functions.ino";
- static camera_config_t camera_config = {
- .pin_pwdn = CAM_PIN_PWDN,
- .pin_reset = CAM_PIN_RESET,
- .pin_xclk = CAM_PIN_XCLK,
- .pin_sscb_sda = CAM_PIN_SIOD,
- .pin_sscb_scl = CAM_PIN_SIOC,
- .pin_d7 = CAM_PIN_D7,
- .pin_d6 = CAM_PIN_D6,
- .pin_d5 = CAM_PIN_D5,
- .pin_d4 = CAM_PIN_D4,
- .pin_d3 = CAM_PIN_D3,
- .pin_d2 = CAM_PIN_D2,
- .pin_d1 = CAM_PIN_D1,
- .pin_d0 = CAM_PIN_D0,
- .pin_vsync = CAM_PIN_VSYNC,
- .pin_href = CAM_PIN_HREF,
- .pin_pclk = CAM_PIN_PCLK,
- .xclk_freq_hz = XCLK_FREQ_HZ,
- .ledc_timer = LEDC_TIMER_0,
- .ledc_channel = LEDC_CHANNEL_0,
- .pixel_format = PIXFORMAT_JPEG,
- .frame_size = FRAMESIZE_HQVGA, //240x176
- .jpeg_quality = 12,
- .fb_count = 1,
- .grab_mode = CAMERA_GRAB_LATEST//CAMERA_GRAB_WHEN_EMPTY
- };
- esp_err_t camera_init(){
- //power up the camera if PWDN pin is defined
- if(CAM_PIN_PWDN != -1){
- pinMode(CAM_PIN_PWDN, OUTPUT);
- digitalWrite(CAM_PIN_PWDN, LOW);
- }
- //initialize the camera
- esp_err_t err = esp_camera_init(&camera_config);
- if (err != ESP_OK) {
- ESP_LOGE(TAG, "Camera Init Failed");
- return err;
- }
- return ESP_OK;
- }
- esp_err_t camera_capture(){
- //acquire a frame
- camera_fb_t * fb = esp_camera_fb_get();
- if (!fb) {
- ESP_LOGE(TAG, "Camera Capture Failed");
- return ESP_FAIL;
- }
- ESP_LOGI(TAG, "Picture taken! Its size was: %zu bytes", fb->len);
- for (int i=0; i<fb->len; i++) {
- if (fb->buf[i] < 16) {
- Serial.print('0');
- }
- Serial.print(fb->buf[i], HEX);
- }
- Serial.println();
- //return the frame buffer back to the driver for reuse
- esp_camera_fb_return(fb);
- return ESP_OK;
- }