Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OV5640输出500w像素高质量图片出现cam_hal: NO-EOI问题分析求助 #717

Open
3 tasks done
xieyanname opened this issue Jan 21, 2025 · 6 comments
Open
3 tasks done

Comments

@xieyanname
Copy link

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate.
  • Provided a clear description of your suggestion.
  • Included any relevant context or examples.

Issue or Suggestion Description

W (2442) cam_hal: NO-EOI
W (3338) cam_hal: NO-EOI
W (4233) cam_hal: NO-EOI
W (5129) cam_hal: NO-EOI
W (5728) cam_hal: Failed to get the frame on time!

我需要OV5640摄像头输出一张500w像素的高质量JPG图片,设置的图片大小FRAMESIZE_QSXGA(2560x1920),xclk为6MHz情况下,我调整图片质量参数为3时,可以正常输出约600~800kb之间的图片,但调整图片质量参数为2时,有时可以输出图像,有时就会出现cam_hal: NO-EOI问题。
输出最大图片大小:
Image
查看代码发现是在cam_hal.c文件的camera_fb_t *cam_take(TickType_t timeout)函数,分析后发现是由于找不到0xD9FF,也就是找不到帧尾标识导致错误,怀疑是图片质量参数为2情况下,输出图片大小超过申请PSRAM空间导致的,修改代码后申请空间达到4000000Byte仍无法解决问题,难道图片大小已经超过4m了?
ESP32-IDF版本:v5.0.7
esp32-camera组件版本:espressif__esp32-camera-v2.0.15
使用摄像头:OV5640
参数配置:

.pin_pwdn = CAM_PIN_PWDN,
.pin_reset = CAM_PIN_RESET,
.pin_xclk = CAM_PIN_XCLK,
.pin_sccb_sda = CAM_PIN_SIOD,
.pin_sccb_scl = CAM_PIN_SIOC,
.pin_d7 = CAM_PIN_D7,
.pin_d6 = CAM_PIN_D6,
.pin_d5 = CAM_PIN_D5,
.pin_d4 = CAM_PIN_D4,
.pin_d3 = CAM_PIN_D3,
.pin_d2 = CAM_PIN_D2,
.pin_d1 = CAM_PIN_D1,
.pin_d0 = CAM_PIN_D0,
.pin_vsync = CAM_PIN_VSYNC,
.pin_href = CAM_PIN_HREF,
.pin_pclk = CAM_PIN_PCLK,
.xclk_freq_hz = 6000000,
.ledc_timer = LEDC_TIMER_0,
.ledc_channel = LEDC_CHANNEL_0,
.pixel_format = PIXFORMAT_JPEG, //YUV422,GRAYSCALE,RGB565,JPEG
.frame_size = FRAMESIZE_QSXGA, //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 = 2, //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,

@xieyanname
Copy link
Author

在调高图片质量情况下,不仅出现了cam_hal: NO-EOI,还出现了cam_hal: NO-SOI,查看了一下图片大小,发现和成功输出图片大小都是在700~1000kb之间浮动,推测该问题原因或许是#381中(https://github.com/WangYuxin-esp)提到的data[0]~data[7] 之间的数据由于并非差分信号,也会产生干扰。

@WangYuxin-esp
Copy link
Contributor

使用过高的图像质量,需要更严格的 PCB 走线,更短的 FPC 软排线。
出现 NO-SOI、NO-EOI 是说没有收到 JPEG 的 start、end 数据,可能是 JPEG buffer 大小不够导致的。你可以尝试使用 idf.py menuconfig 命令,通过这个选项https://github.com/espressif/esp32-camera/blob/master/Kconfig#L201,增大默认的 JPEG frame buffer size.

@xieyanname
Copy link
Author

使用过高的图像质量,需要更严格的 PCB 走线,更短的 FPC 软排线。 出现 NO-SOI、NO-EOI 是说没有收到 JPEG 的 start、end 数据,可能是 JPEG buffer 大小不够导致的。你可以尝试使用 idf.py menuconfig 命令,通过这个选项https://github.com/espressif/esp32-camera/blob/master/Kconfig#L201,增大默认的 JPEG frame buffer size.

感谢回答,我已经申请了4000000 Byte空间在PSRAM,感觉不像是空间不足导致的,而且我发现在正常拍摄情况下,降低环境亮度(指白天调的好好的,晚上就失败了)也会出现NO-EOI,用手机闪光灯补个光又拍摄成功了:joy:

@xieyanname
Copy link
Author

附上图片

Image

@WangYuxin-esp
Copy link
Contributor

可以先降低分辨率,试试暗光条件下是否正常。

@xieyanname
Copy link
Author

可以先降低分辨率,试试暗光条件下是否正常。

根据您的建议,我在暗光条件下做了测试:

  1. 在图片质量2情况下,将分辨率由QSXGA(2560x1920)降低为QHD(2560x1440),成功拍摄出411189、451504、417581等字节的图像(并非每次拍摄均成功)
  2. 在QSXGA分辨率情况下,将图片质量由2降低为3,成功拍摄出739972、786188、761473字节等的图像(每次拍摄均成功)

我想知道是什么原因导致出现以上现象?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants