背景
硬件为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:370A2 : 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
后续有遇到其他问题还会补充到这个文档中。
参考内容
问题1解决参考:https://blog.csdn.net/Ender_LJY/article/details/139236037
问题2解决参考:https://blog.csdn.net/whhskkaka/article/details/142553523
非常感谢上述文章作者所提供的帮助。