From 7a0259d8784cc9d0cbe253dfc1abcd16ce04f3bd Mon Sep 17 00:00:00 2001 From: Rene Date: Mon, 18 Dec 2023 23:49:50 +0100 Subject: [PATCH 1/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 353358f..d41238f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Simple [RTSP](https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol), [HTTP JPEG Streamer](https://en.wikipedia.org/wiki/Motion_JPEG) and image server with configuration through the web interface. > [!IMPORTANT] -> New branch available! Here [branch: feature/seeed_xiao_esp32s3](https://github.com/rzeldent/esp32cam-rtsp/tree/feature/seeed_xiao_esp32s3) +> New branch available! Here [branch: feature/seeed_xiao_esp32s3](https://github.com/rzeldent/esp32cam-rtsp/tree/develop) > This branch supports all the current devices and the Seeed Studio Xiao esp32s3! > Please use this and let me know if this works for you! From 5e4fee3624b5528554a47ff36024371851a5cda0 Mon Sep 17 00:00:00 2001 From: Rene Date: Mon, 18 Dec 2023 23:50:10 +0100 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d41238f..b33f817 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Simple [RTSP](https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol), [HTTP JPEG Streamer](https://en.wikipedia.org/wiki/Motion_JPEG) and image server with configuration through the web interface. > [!IMPORTANT] -> New branch available! Here [branch: feature/seeed_xiao_esp32s3](https://github.com/rzeldent/esp32cam-rtsp/tree/develop) +> New branch available! Here [branch: develop](https://github.com/rzeldent/esp32cam-rtsp/tree/develop) > This branch supports all the current devices and the Seeed Studio Xiao esp32s3! > Please use this and let me know if this works for you! From a760fdae38c54e0b822f02f91df1f83312812baa Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Thu, 15 Feb 2024 21:22:22 +0100 Subject: [PATCH 3/3] Added sccb_i2c_port Retry 3 times camera init --- boards/esp32cam_ai_thinker.json | 3 ++- .../esp32cam_espressif_esp32s2_cam_board.json | 8 ++++--- ...esp32cam_espressif_esp32s2_cam_header.json | 8 ++++--- .../esp32cam_espressif_esp32s3_cam_lcd.json | 3 ++- boards/esp32cam_espressif_esp32s3_eye.json | 3 ++- boards/esp32cam_espressif_esp_eye.json | 3 ++- boards/esp32cam_freenove_wrover_kit.json | 3 ++- boards/esp32cam_m5stack_camera.json | 1 + boards/esp32cam_m5stack_camera_psram.json | 1 + boards/esp32cam_m5stack_esp32cam.json | 1 + boards/esp32cam_m5stack_unitcam.json | 3 ++- boards/esp32cam_m5stack_unitcams3.json | 1 + boards/esp32cam_m5stack_wide.json | 3 ++- boards/esp32cam_seeed_xiao_esp32s3_sense.json | 1 + boards/esp32cam_ttgo_t_camera.json | 1 + boards/esp32cam_ttgo_t_journal.json | 3 ++- platformio.ini | 2 +- src/main.cpp | 23 ++++++++++++------- 18 files changed, 48 insertions(+), 23 deletions(-) diff --git a/boards/esp32cam_ai_thinker.json b/boards/esp32cam_ai_thinker.json index 7db7f1d..5c5fa8c 100644 --- a/boards/esp32cam_ai_thinker.json +++ b/boards/esp32cam_ai_thinker.json @@ -31,7 +31,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", diff --git a/boards/esp32cam_espressif_esp32s2_cam_board.json b/boards/esp32cam_espressif_esp32s2_cam_board.json index 725fa48..4fb920f 100644 --- a/boards/esp32cam_espressif_esp32s2_cam_board.json +++ b/boards/esp32cam_espressif_esp32s2_cam_board.json @@ -1,6 +1,6 @@ { "build": { - "arduino":{ + "arduino": { "ldscript": "esp32s2_out.ld" }, "core": "esp32", @@ -31,7 +31,9 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" ], + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" + ], "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", @@ -58,4 +60,4 @@ }, "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-esp-lyrap-cam-v1.1.html", "vendor": "Espressif" -} +} \ No newline at end of file diff --git a/boards/esp32cam_espressif_esp32s2_cam_header.json b/boards/esp32cam_espressif_esp32s2_cam_header.json index 347264f..212d0a9 100644 --- a/boards/esp32cam_espressif_esp32s2_cam_header.json +++ b/boards/esp32cam_espressif_esp32s2_cam_header.json @@ -1,6 +1,6 @@ { "build": { - "arduino":{ + "arduino": { "ldscript": "esp32s2_out.ld" }, "core": "esp32", @@ -31,7 +31,9 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" ], + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" + ], "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", @@ -58,4 +60,4 @@ }, "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-esp-lyrap-cam-v1.1.html", "vendor": "Espressif" -} +} \ No newline at end of file diff --git a/boards/esp32cam_espressif_esp32s3_cam_lcd.json b/boards/esp32cam_espressif_esp32s3_cam_lcd.json index a847749..6bd0a0a 100644 --- a/boards/esp32cam_espressif_esp32s3_cam_lcd.json +++ b/boards/esp32cam_espressif_esp32s3_cam_lcd.json @@ -33,7 +33,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "80000000L", diff --git a/boards/esp32cam_espressif_esp32s3_eye.json b/boards/esp32cam_espressif_esp32s3_eye.json index b67514d..b4040ad 100644 --- a/boards/esp32cam_espressif_esp32s3_eye.json +++ b/boards/esp32cam_espressif_esp32s3_eye.json @@ -33,7 +33,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "80000000L", diff --git a/boards/esp32cam_espressif_esp_eye.json b/boards/esp32cam_espressif_esp_eye.json index c22f0e1..d1f47c9 100644 --- a/boards/esp32cam_espressif_esp_eye.json +++ b/boards/esp32cam_espressif_esp_eye.json @@ -31,7 +31,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=1'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", diff --git a/boards/esp32cam_freenove_wrover_kit.json b/boards/esp32cam_freenove_wrover_kit.json index 14099ff..fef815e 100644 --- a/boards/esp32cam_freenove_wrover_kit.json +++ b/boards/esp32cam_freenove_wrover_kit.json @@ -31,7 +31,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", diff --git a/boards/esp32cam_m5stack_camera.json b/boards/esp32cam_m5stack_camera.json index cc62530..082afe3 100644 --- a/boards/esp32cam_m5stack_camera.json +++ b/boards/esp32cam_m5stack_camera.json @@ -28,6 +28,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=1'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" "'-D GROVE_SDA=13'", "'-D GROVE_SCL=4'" ], diff --git a/boards/esp32cam_m5stack_camera_psram.json b/boards/esp32cam_m5stack_camera_psram.json index 00f47de..132af6c 100644 --- a/boards/esp32cam_m5stack_camera_psram.json +++ b/boards/esp32cam_m5stack_camera_psram.json @@ -30,6 +30,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" "'-D GROVE_SDA=13'", "'-D GROVE_SCL=4'" ], diff --git a/boards/esp32cam_m5stack_esp32cam.json b/boards/esp32cam_m5stack_esp32cam.json index 8d726dc..2e0336f 100644 --- a/boards/esp32cam_m5stack_esp32cam.json +++ b/boards/esp32cam_m5stack_esp32cam.json @@ -32,6 +32,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" "'-D MICROPHONE_GPIO=32'", "'-D GROVE_SDA=13'", "'-D GROVE_SCL=4'" diff --git a/boards/esp32cam_m5stack_unitcam.json b/boards/esp32cam_m5stack_unitcam.json index b11599e..f241f7a 100644 --- a/boards/esp32cam_m5stack_unitcam.json +++ b/boards/esp32cam_m5stack_unitcam.json @@ -29,7 +29,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=1'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", diff --git a/boards/esp32cam_m5stack_unitcams3.json b/boards/esp32cam_m5stack_unitcams3.json index 7926893..acb750c 100644 --- a/boards/esp32cam_m5stack_unitcams3.json +++ b/boards/esp32cam_m5stack_unitcams3.json @@ -36,6 +36,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'", "'-D I2C_MEMS_SDA=48'", "'-D I2C_MEMS_SCL=47'", "'-D TF_CS=9'", diff --git a/boards/esp32cam_m5stack_wide.json b/boards/esp32cam_m5stack_wide.json index df425dd..2b5de3a 100644 --- a/boards/esp32cam_m5stack_wide.json +++ b/boards/esp32cam_m5stack_wide.json @@ -29,7 +29,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", diff --git a/boards/esp32cam_seeed_xiao_esp32s3_sense.json b/boards/esp32cam_seeed_xiao_esp32s3_sense.json index fa36d88..fee7b5c 100644 --- a/boards/esp32cam_seeed_xiao_esp32s3_sense.json +++ b/boards/esp32cam_seeed_xiao_esp32s3_sense.json @@ -36,6 +36,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" "'-D I2C_MEMS_SDA=41'", "'-D I2C_MEMS_SCL=42'", "'-D TF_CS=21'", diff --git a/boards/esp32cam_ttgo_t_camera.json b/boards/esp32cam_ttgo_t_camera.json index 1f693f3..255d569 100644 --- a/boards/esp32cam_ttgo_t_camera.json +++ b/boards/esp32cam_ttgo_t_camera.json @@ -28,6 +28,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=1'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" "'-D LCD_SSD1306_PIN_SDA=21'", "'-D LCD_SSD1306_PIN_SCL=22'", "'-D BUTTON_RIGHT_PIN=34'", diff --git a/boards/esp32cam_ttgo_t_journal.json b/boards/esp32cam_ttgo_t_journal.json index 885d5c0..928ae27 100644 --- a/boards/esp32cam_ttgo_t_journal.json +++ b/boards/esp32cam_ttgo_t_journal.json @@ -27,7 +27,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=1'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", diff --git a/platformio.ini b/platformio.ini index 3f722ef..8d604e2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,7 +10,7 @@ ############################################################################### [platformio] -#default_envs = esp32cam_ai_thinker +default_envs = esp32cam_ai_thinker #default_envs = esp32cam_espressif_esp_eye #default_envs = esp32cam_espressif_esp32s2_cam_board #default_envs = esp32cam_espressif_esp32s2_cam_header diff --git a/src/main.cpp b/src/main.cpp index 9b95f41..0906dc5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -219,8 +219,7 @@ esp_err_t initialize_camera() log_i("JPEG quality: %d", param_jpg_quality.value()); auto jpeg_quality = param_jpg_quality.value(); log_i("Frame duration: %d ms", param_frame_duration.value()); - constexpr auto i2c_port = I2C_NUM_0; - + camera_config_t camera_config = { .pin_pwdn = CAMERA_CONFIG_PIN_PWDN, // GPIO pin for camera power down line .pin_reset = CAMERA_CONFIG_PIN_RESET, // GPIO pin for camera reset line @@ -250,7 +249,7 @@ esp_err_t initialize_camera() #if CONFIG_CAMERA_CONVERTER_ENABLED conv_mode = CONV_DISABLE, // RGB<->YUV Conversion mode #endif - .sccb_i2c_port = i2c_port // If pin_sccb_sda is -1, use the already configured I2C bus by number + .sccb_i2c_port = SCCB_I2C_PORT // If pin_sccb_sda is -1, use the already configured I2C bus by number }; return cam.init(camera_config); @@ -380,11 +379,19 @@ void setup() #endif iotWebConf.init(); - camera_init_result = initialize_camera(); - if (camera_init_result == ESP_OK) - update_camera_settings(); - else - log_e("Failed to initialize camera: 0x%0x. Frame size: %s, frame rate: %d ms, jpeg quality: %d", camera_init_result, param_frame_size.value(), param_frame_duration.value(), param_jpg_quality.value()); + // Try to initialize 3 times + for (auto i = 0; i < 3; i++) + { + camera_init_result = initialize_camera(); + if (camera_init_result == ESP_OK) + { + update_camera_settings(); + break; + } + + log_e("Failed to initialize camera. Error: 0x%0x. Frame size: %s, frame rate: %d ms, jpeg quality: %d", camera_init_result, param_frame_size.value(), param_frame_duration.value(), param_jpg_quality.value()); + delay(500); + } // Set up required URL handlers on the web server web_server.on("/", HTTP_GET, handle_root);