espressif / esp32-camera

Apache License 2.0
1.92k stars 641 forks source link

cam_hal: Failed to get the frame on time! and multiple cam_hal: EV-VSYNC-OVF #488

Closed MattiaDallaCosta closed 1 year ago

MattiaDallaCosta commented 1 year ago

board: esp32-cam (a clone of the ai thinker one)

define CAM_PIN_PWDN 32

define CAM_PIN_RESET -1

define CAM_PIN_XCLK 0

define CAM_PIN_SIOD 26

define CAM_PIN_SIOC 27

define CAM_PIN_D7 35

define CAM_PIN_D6 34

define CAM_PIN_D5 39

define CAM_PIN_D4 36

define CAM_PIN_D3 21

define CAM_PIN_D2 19

define CAM_PIN_D1 18

define CAM_PIN_D0 5

define CAM_PIN_VSYNC 25

define CAM_PIN_HREF 23

define CAM_PIN_PCLK 22

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 = 2000000, ledc_timer = LEDC_TIMER_0, ledc_channel = LEDC_CHANNEL_0, pixel_format = PIXFORMAT_JPEG, frame_size = FRAMESIZE_96X96,
jpeg_quality = 12, fb_count = 1,
grab_mode = CAMERA_GRAB_LATEST, fb_location = CAMERA_FB_IN_PSRAM

camera: ov2640

log: I (30) boot: ESP-IDF v5.1-dev-2066-g7869f4e151 2nd stage bootloader I (30) boot: compile time Dec 12 2022 16:17:45 I (32) boot: chip revision: v1.0 I (36) boot.esp32: SPI Speed : 80MHz I (41) boot.esp32: SPI Mode : DIO I (45) boot.esp32: SPI Flash Size : 4MB I (50) boot: Enabling RNG early entropy source... I (55) boot: Partition Table: I (59) boot: ## Label Usage Type ST Offset Length I (66) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (73) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (81) boot: 2 factory factory app 00 00 00010000 00100000 I (88) boot: End of partition table I (92) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=08178h ( 33144) map I (106) esp_image: segment 1: paddr=000181a0 vaddr=3ffb0000 size=020a4h ( 8356) load I (111) esp_image: segment 2: paddr=0001a24c vaddr=40080000 size=05dcch ( 24012) load I (123) esp_image: segment 3: paddr=00020020 vaddr=400d0020 size=1e740h (124736) map I (145) esp_image: segment 4: paddr=0003e768 vaddr=40085dcc size=09908h ( 39176) load I (160) boot: Loaded app from partition at offset 0x10000 I (160) boot: Disabling RNG early entropy source... I (172) quad_psram: This chip is ESP32-D0WD I (172) esp_psram: Found 8MB PSRAM device I (172) esp_psram: Speed: 80MHz I (174) esp_psram: PSRAM initialized, cache is in low/high (2-core) mode. W (181) esp_psram: Virtual address not enough for PSRAM, map as much as we can. 4MB is mapped I (191) cpu_start: Pro cpu up. I (194) cpu_start: Starting app cpu, entry point is 0x40080e98 0x40080e98: call_start_cpu1 at /home/mattia/esp/esp-idf/components/esp_system/port/cpu_start.c:145

I (0) cpu_start: App cpu up. I (665) esp_psram: SPI SRAM memory test OK I (673) cpu_start: Pro cpu start user code I (673) cpu_start: cpu freq: 160000000 Hz I (673) cpu_start: Application information: I (676) cpu_start: Project name: thesis-project I (682) cpu_start: App version: v5.1-dev-2066-g7869f4e151 I (688) cpu_start: Compile time: Dec 13 2022 17:51:49 I (694) cpu_start: ELF file SHA256: 42754dc4ca6b034a... I (700) cpu_start: ESP-IDF: v5.1-dev-2066-g7869f4e151 I (707) cpu_start: Min chip rev: v0.0 I (711) cpu_start: Max chip rev: v3.99 I (716) cpu_start: Chip rev: v1.0 I (721) heap_init: Initializing. RAM available for dynamic allocation: I (728) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM I (734) heap_init: At 3FFB2B90 len 0002D470 (181 KiB): DRAM I (741) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM I (747) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM I (753) heap_init: At 4008F6D4 len 0001092C (66 KiB): IRAM I (760) esp_psram: Adding pool of 4096K of PSRAM memory to heap allocator I (768) spi_flash: detected chip: generic I (772) spi_flash: flash io: dio I (787) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. I (788) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations I (798) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 I (798) cam_hal: cam init ok I (808) sccb: pin_sda 26 pin_scl 27 I (808) sccb: sccb_i2c_port=0

I (818) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 I (848) camera: Detected camera at address=0x30 I (848) camera: Detected OV2640 camera I (848) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2 I (938) cam_hal: buffer_size: 32768, half_buffer_size: 4096, node_buffer_size: 2048, node_cnt: 16, total_cnt: 0 I (938) cam_hal: Allocating 1843 Byte frame buffer in PSRAM I (938) cam_hal: cam config ok I (938) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8 I (1028) example:take_picture: Taking picture... 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 cam_hal: EV-VSYNC-OVF cam_hal: EV-VSYNC-OVF W (5028) cam_hal: Failed to get the frame on time! Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

And then it restarts. I don't have the slightest queue of what EV-VSYNC-OVF the only thing I understood reading the source is that is outputted when the system isn't able to retrieve the frame buffer from the cam queue inside the ll_cam_send_event() function but I don't know what is the cause of this behaviour. I have also tried different clock speeds (now is at 2MHz) different pixel formats and different frame sizes and also tried to use multiple fbs (as suggested by MaxSvjatoha in a previous closed issue) but nothing worked Thanks in advance

PS: I am working on this for my thesis project and I would need the rgb888/raw information of the image and since I need to get an image every ~10 seconds the problems of overuse of the dma circuitery aren't an actual concern and would make a lot of sense for me to to use the jpg image since part of my project is a jpeg conversion from rgb. I have seen that the code implements only grayscale yuv jpg and rgb565 (which isn't enough); what would i need to do in order to implement the rgb888 part

HomeACcessoryKid commented 1 year ago

For what it is worth, I had the EV-VSYNC-OVF errors as well, and no idea where to look. Turned out that re-seating the connector solved the issue! I hope you are equally lucky.

josemiguelmo2 commented 1 year ago

reduce xclk_freq_hz = 2000000 to 1000000

DJG193 commented 1 year ago

将xclk_freq_hz = 2000000 减少到 1000000

is useful ! 谢谢

nikolausspence commented 1 year ago

see pull requests: https://github.com/espressif/esp-who/pull/250 https://github.com/espressif/esp32-camera/pull/523

Both together solve the problem. Setting the XCLK_FREQ_HZ is helpful but does not solve overbearing issues.

12Mhz with x2 multiplier is better than 10Mhz and the examples contain a hard coding of 15Mhz. This setting should be based on the sensor used.

github-actions[bot] commented 1 year ago

This issue appears to be stale. Please close it if its no longer valid.

Meowchine1 commented 5 months ago

Formatting sd card and this video help me: https://www.youtube.com/watch?v=6KKHgyapl-c

RN0H commented 4 months ago

reduce xclk_freq_hz = 2000000 to 1000000 Works! Thanks!