ESP32S3R8+OV2640 出错

15002426658
Posts: 10
Joined: Tue Sep 27, 2022 6:50 am

ESP32S3R8+OV2640 出错

Postby 15002426658 » Tue Oct 25, 2022 3:46 am

ESP32S3R8+4Mflash+OV2640 在摄像头初始化完成后就经常会报错。请问是什么原因?另外视频可以看到,但是读照片为什么报错?

1 在初始化完成后会一直报这个错误 cam_hal: EV-VSYNC-OVF。有时候会一直打印这个错误。
I (5951) s3 ll_cam: DMA Channel=4
I (5951) cam_hal: cam init ok
I (5961) sccb: pin_sda 4 pin_scl 5
I (5981) camera: Detected camera at address=0x30
I (5981) camera: Detected OV2640 camera
I (5981) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
I (6051) s3 ll_cam: node_size: 3840, nodes_per_line: 1, lines_per_node: 6
I (6051) s3 ll_cam: dma_half_buffer_min: 3840, dma_half_buffer: 15360, lines_per_half_buffer: 24, dma_buffer_size: 30720
I (6061) cam_hal: buffer_size: 30720, half_buffer_size: 15360, node_buffer_size: 3840, node_cnt: 8, total_cnt: 10
I (6071) cam_hal: Allocating 153600 Byte frame buffer in OnBoard RAM
I (6081) cam_hal: cam config ok
I (6081) ov2640: Set PLL: clk_2x: 1, clk_div: 3, pclk_auto: 1, pclk_div: 8
I (6161) gpio: Camera Init OK.
cam_hal: EV-VSYNC-OVF

2 在进行读取视频的时候也会出现这个错误。
I (35491) gpio: MJPG: 5KB 172ms (5.8fps)
I (35591) gpio: MJPG: 5KB 101ms (9.9fps)
I (35791) gpio: MJPG: 5KB 204ms (4.9fps)
I (35911) gpio: MJPG: 5KB 113ms (8.8fps)
I (36091) gpio: MJPG: 5KB 187ms (5.3fps)
cam_hal: EV-VSYNC-OVF
I (36301) gpio: MJPG: 5KB 207ms (4.8fps)
I (36451) gpio: MJPG: 5KB 148ms (6.8fps)
I (36631) gpio: MJPG: 5KB 183ms (5.5fps)
I (36831) gpio: MJPG: 5KB 194ms (5.2fps)
I (36931) gpio: MJPG: 5KB 99ms (10.1fps)
I (37131) gpio: MJPG: 5KB 203ms (4.9fps)
I (37271) gpio: MJPG: 5KB 136ms (7.4fps)
I (37411) gpio: MJPG: 5KB 142ms (7.0fps)

3 读取JPG格式从来也没成功,报错。

I (47441) gpio: JPG: 0B 0ms

读取照片相关代码如下:

void http_server_init(void)
{
httpd_handle_t server;

httpd_uri_t jpeg_stream_uri = {
.uri = "/",
.method = HTTP_GET,
.handler = jpg_stream_httpd_handler,
.user_ctx = NULL
};

httpd_uri_t jpeg_uri = {
.uri = "/jpg",
.method = HTTP_GET,
.handler = http_send_jpg_handler,
.user_ctx = NULL
};

httpd_config_t http_options = HTTPD_DEFAULT_CONFIG();

ESP_ERROR_CHECK(httpd_start(&server, &http_options));
ESP_ERROR_CHECK(httpd_register_uri_handler(server, &jpeg_stream_uri));
ESP_ERROR_CHECK(httpd_register_uri_handler(server, &jpeg_uri));

// printf("http ok!\n");

}
static esp_err_t http_send_jpg_handler(httpd_req_t *req)
{
camera_fb_t *fb = NULL;
esp_err_t res = ESP_OK;
int64_t fr_start = esp_timer_get_time();
char ts[32];

fb = esp_camera_fb_get();
if(!fb){
ESP_LOGE(TAG, "Camera capture failed");
httpd_resp_send_500(req);
return ESP_FAIL;
}

httpd_resp_set_type(req, "image/jpeg");
httpd_resp_set_hdr(req, "Content-Disposition", "inline; filename=capture.jpg");
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");

snprintf(ts, 32, "%ld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec);
httpd_resp_set_hdr(req, "X-Timestamp", (const char *)ts);

size_t fb_len = 0;
if(fb->format == PIXFORMAT_JPEG){
fb_len = fb->len;
res = httpd_resp_send(req, (const char *)fb->buf, fb->len);
}
esp_camera_fb_return(fb);

int64_t fr_end = esp_timer_get_time();
ESP_LOGI(TAG, "JPG: %uB %ums", (uint32_t)(fb_len), (uint32_t)((fr_end - fr_start) / 1000));

return res;
}

ESP_WangYX
Posts: 97
Joined: Mon Jun 28, 2021 12:48 pm

Re: ESP32S3R8+OV2640 出错

Postby ESP_WangYX » Fri Oct 28, 2022 3:00 am

你可以尝试使用的示例查看图片https://github.com/espressif/esp-iot-solution/tree/master/examples/camera/pic_server

Who is online

Users browsing this forum: No registered users and 39 guests