记录一下乐鑫官方仓库ESP32-CAMERA,在使用esp32s3 wroom n16r8 CAM开发板时遇到的问题。
·
背景
硬件为ESP32-S3 WROOM N16R8 CAM开发板
摄像头为OV2640
开发使用的项目地址为https://github.com/espressif/esp32-camera
开发环境为esp-idf,Linux编译下载加vscode编辑代码
使用的例程为esp32-camera/examples/camera_example
使用的esp-idf版本为v4.4.3
问题&解决
问题1:menuconfig配置
PSRAM需要配置为下图所示
flash需要配置为16m
问题2:引脚配置问题
官方默认配置的CAM_PIN使用会出现不断重启问题,排查后可以发现是引脚配置错误,相应的log如下所示
I (757) spi_flash: detected chip: generic
I (761) spi_flash: flash io: qio
I (765) sleep: Configure to isolate all GPIO pins in sleep state
I (772) sleep: Enable automatic switching of GPIO sleep configuration
I (779) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (794) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x4200f502 PS : 0x00060830 A0 : 0x82006fc6 A1 : 0x3fcf3a40
0x4200f502: ll_cam_set_pin at /home/li/LocalWare/esp32-camera/target/esp32s3/ll_cam.c:370
A2 : 0x3fc99638 A3 : 0x3fc9551c A4 : 0x3c03a3b0 A5 : 0x3c03a408
A6 : 0x0000001f A7 : 0x00000000 A8 : 0x00000000 A9 : 0x00000000
A10 : 0x00000000 A11 : 0x00000060 A12 : 0x00000008 A13 : 0x00000060
A14 : 0x60020000 A15 : 0xb81fc000 SAR : 0x00000011 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x400570e8 LEND : 0x400570f3 LCOUNT : 0x00000000
将引脚配置更改为下列内容即可正常使用
#define CAM_PIN_PWDN -1 //power down is not used
#define CAM_PIN_RESET -1 //software reset will be performed
#define CAM_PIN_XCLK 15
#define CAM_PIN_SIOD 4
#define CAM_PIN_SIOC 5
#define CAM_PIN_D7 11
#define CAM_PIN_D6 9
#define CAM_PIN_D5 8
#define CAM_PIN_D4 10
#define CAM_PIN_D3 12
#define CAM_PIN_D2 18
#define CAM_PIN_D1 17
#define CAM_PIN_D0 16
#define CAM_PIN_VSYNC 6
#define CAM_PIN_HREF 7
#define CAM_PIN_PCLK 13
问题3:分辨率设置问题
问题现象:
E (953) cam_hal: FB-SIZE: 0 != 3840000
E (956) cam_hal: FB-SIZE: 0 != 3840000
I (1035) app_main: Taking picture...
W (1408) cam_hal: FB-OVF
I (1430) app_main: Picture taken! Its size was: 3840000 bytes
cam_hal: EV-VSYNC-OVF
cam_hal: EV-VSYNC-OVF
cam_hal: EV-VSYNC-OVF
cam_hal: EV-VSYNC-OVF
cam_hal: EV-VSYNC-OVF
cam_hal: EV-VSYNC-OVF
cam_hal: EV-VSYNC-OVF
I (6430) app_main: Taking picture...
产生原因:由于主控使用了esp32s3,摄像头使用了ov2640.原版代码主控为esp32,摄像头为ov2640.故调整了分辨率为FRAMESIZE_UXGA(1600x1200)后出现该问题。
实测使用一下配置ov2640分辨率最高支持到FRAMESIZE_SXGA(1280x1024)
//XCLK 20MHz or 10MHz for OV2640 double FPS (Experimental)
.xclk_freq_hz = 20000000,
.ledc_timer = LEDC_TIMER_0,
.ledc_channel = LEDC_CHANNEL_0,
.pixel_format = PIXFORMAT_RGB565, //YUV422,GRAYSCALE,RGB565,JPEG
.frame_size = FRAMESIZE_UXGA, //QQVGA-UXGA, For ESP32, do not use sizes above QVGA when not JPEG. The performance of the ESP32-S series has improved a lot, but JPEG mode always gives better frame rates.
.jpeg_quality = 12, //0-63, for OV series camera sensors, lower number means higher quality
.fb_count = 1, //When jpeg mode is used, if fb_count more than one, the driver will work in continuous mode.
.fb_location = CAMERA_FB_IN_PSRAM,
.grab_mode = CAMERA_GRAB_WHEN_EMPTY,
后续有遇到其他问题还会补充到这个文档中。
参考内容
问题1解决参考:https://blog.csdn.net/Ender_LJY/article/details/139236037
问题2解决参考:https://blog.csdn.net/whhskkaka/article/details/142553523
非常感谢上述文章作者所提供的帮助。
更多推荐


所有评论(0)