现在我要实现一个功能:
1. esp-camera默认配置为
低分辨率的RGB565格式,然后将采集到的摄像头数据
显示在屏幕上
2. 按下按键,摄像头配置为
最大分辨率的JPEG格式,然后将采集到的图片
保存在TF卡中
问题:
当重新配置摄像头时,发生panic错误
报错信息:
Code:
Select all
E (3464) gdma: gdma_disconnect(278): no peripheral is connected to the channelI (3465) s3 ll_cam: DMA Channel=1I (3465) cam_hal: cam init okI (3469) sccb: pin_sda 4 pin_scl 5I (3473) sccb: sccb_i2c_port=1I (3488) camera: Detected camera at address=0x30I (3491) camera: Detected OV2640 cameraI (3491) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2I (3567) cam_hal: buffer_size: 384000, half_buffer_size: 1024, node_buffer_size: 1024, node_cnt: 375, total_cnt: 375I (3568) cam_hal: Alloca
ting 384016 Byte frame buffer in PSRAMI (3574) cam_hal: Frame[0]: Offset: 16, Addr: 0x3D807400I (3581) cam_hal: cam config okI (3584) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 12I (3668) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8W (3669) cam_hal: NO-SOIW (3777) cam_hal: NO-SOIW (3802) cam_hal: NO-SOIW (3827) cam_hal: NO-SOIW (3852) cam_hal: NO-SOIW (3877) cam_hal: NO-SOIW (3902) cam_hal: NO-SOIW (3927) cam_hal: NO-SOIW (3952) cam_hal: NO-SOIW (3977) cam_hal: NO-SOIW (4002) cam_hal: NO-SOIW (4027) cam_hal: NO-SOIW (4052) cam_hal: NO-SOIW (4077) cam_hal: NO-SOIW (4102) cam_hal: NO-SOIW (4127) cam_hal: NO-SOIW (4152) cam_hal: NO-SOIW (4177) cam_hal: NO-SOIW (4202) cam_hal: NO-SOIW (4227) cam_hal: NO-SOIW (4252) cam_hal: NO-SOIW (4277) cam_hal: NO-SOIW (4302) cam_hal: NO-SOIW (4327) cam_hal: NO-SOIW (4352) cam_hal: NO-SOIW (4376) cam_hal: NO-SOIW (4401) cam_hal: NO-SOIW (4426) cam_hal: NO-SOIW (4451) cam_hal: NO-SOI***ERROR*** A stack overflow in task cam_task has been detected.Backtrace:0x40375c56:0x3fce91e00x40382089:0x3fce9200 0x4038501e:0x3fce9220 0x40383d9b:0x3fce92a0 0x40382144:0x3fce92c0 0x4038213a:0x00000000 |<-CORRUPTED0x40375c56: panic_abort at /home/don/esp/esp-idf/components/esp_system/panic.c:4020x40382089: esp_system_abort at /home/don/esp/esp-idf/components/esp_system/esp_system.c:1210x4038501e: vApplicationStackOverflowHook at /home/don/esp/esp-idf/components/freertos/port/xtensa/port.c:3940x40383d9b: vTaskSwitchContext at /home/don/esp/esp-idf/components/freertos/tasks.c:35540x40382144: _frxt_dispatch at /home/don/esp/esp-idf/components/freertos/port/xtensa/portasm.S:4360x4038213a: _frxt_int_exit at /home/don/esp/esp-idf/components/freertos/port/xtensa/portasm.S:231
出错代码:
Code:
Select all
// 按下按键,唤醒用于保存图像的task if (xQueueReceive(queue_i, &key, 0)) { camera_fb_t *jpg_fb = NULL; xSemaphoreTake(fbmutex, portMAX_DELAY); esp_camera_deinit(); camera_init(PIXFORMAT_JPEG, FRAMESIZE_UXGA, 1); jpg_fb = esp_camera_fb_get(); // TODO: save_image(jpg_fb); esp_camera_fb_return(jpg_fb); esp_camera_deinit(); camera_init(PIXFORMAT_RGB565, FRAMESIZE_QVGA, 2); xSemaphoreGive(fbmutex); }
测试设备信息:
- idf v4.4
- OV2640
- esp-camera v2.0.8
是否是因为esp-camera目前不支持 重新在配置?