esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

Got invalid frame from camera! #4049

Open andreclemente opened 1 year ago

andreclemente commented 1 year ago

The problem

I'm trying to use a ESP32-CAM with the cameras DCX-OV2 640-V2 and OV2640. None of them work, I keep getting "Got invalid frame from camera!"

Which version of ESPHome has the issue?

2022.12.3

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.1.5

What platform are you using?

ESP32

Board

ESP-32S + ESP32-CAM-MB

Component causing the issue

No response

Example YAML snippet

substitutions:
  esphome_name: espcam
  camera_name: espcam camera

esphome:
  name: "${esphome_name}"
  platform: ESP32
  board: node32s

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

api:
  reboot_timeout: 60min
  encryption:
    key: "key"

ota:

time:
  - platform: homeassistant

logger:

sensor:
  # General
  - platform: uptime
    name: "${esphome_name} - Uptime Sensor"
  - platform: wifi_signal
    name: "${esphome_name} - WiFi Signal"
    update_interval: 60s

esp32_camera:
  name: "${camera_name}"
  external_clock:
    pin: GPIO0
    frequency: 10MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32
  # Image settings
  max_framerate: 5 fps    # default: 10 fps, max 60
  idle_framerate: 0.2 fps # default: 0.1 fps - framerate for 'picture' in HA dashboard
  resolution: 800x600     # default: 640x480 (VGA) - higher res requires more memory
  jpeg_quality: 63        # 10 (best) to 63 (worst)

switch:
  - platform: gpio
    name: "${camera_name} flash"
    pin: 4
    #inverted: True
  - platform: restart
    name: "${esphome_name} - Restart"
    id: restart_switch

Anything in the logs that might be useful for us?

[22:01:45][C][esp32_camera:048]: ESP32 Camera:
[22:01:45][C][esp32_camera:049]:   Name: espcam camera
[22:01:45][C][esp32_camera:050]:   Internal: NO
[22:01:45][C][esp32_camera:052]:   Data Pins: D0:5 D1:18 D2:19 D3:21 D4:36 D5:39 D6:34 D7:35
[22:01:45][C][esp32_camera:053]:   VSYNC Pin: 25
[22:01:45][C][esp32_camera:054]:   HREF Pin: 23
[22:01:45][C][esp32_camera:055]:   Pixel Clock Pin: 22
[22:01:45][C][esp32_camera:056]:   External Clock: Pin:0 Frequency:10000000
[22:01:45][C][esp32_camera:060]:   I2C Pins: SDA:26 SCL:27
[22:01:45][C][esp32_camera:062]:   Reset Pin: -1
[22:01:45][C][esp32_camera:083]:   Resolution: 800x600 (SVGA)
[22:01:45][C][esp32_camera:105]:   JPEG Quality: 63
[22:01:45][C][esp32_camera:107]:   Contrast: 0
[22:01:45][C][esp32_camera:108]:   Brightness: 0
[22:01:45][C][esp32_camera:109]:   Saturation: 0
[22:01:45][C][esp32_camera:110]:   Vertical Flip: ON
[22:01:45][C][esp32_camera:111]:   Horizontal Mirror: ON
[22:01:45][C][esp32_camera:112]:   Special Effect: 0
[22:01:45][C][esp32_camera:113]:   White Balance Mode: 0
[22:01:45][C][esp32_camera:116]:   Auto Exposure Control: 1
[22:01:45][C][esp32_camera:117]:   Auto Exposure Control 2: 0
[22:01:45][C][esp32_camera:118]:   Auto Exposure Level: 0
[22:01:45][C][esp32_camera:119]:   Auto Exposure Value: 300
[22:01:45][C][esp32_camera:120]:   AGC: 1
[22:01:45][C][esp32_camera:121]:   AGC Gain: 0
[22:01:45][C][esp32_camera:122]:   Gain Ceiling: 0
[22:01:45][C][esp32_camera:128]:   Test Pattern: NO
[22:01:45][C][restart:076]: Restart Switch 'espcam - Restart'
[22:01:45][C][restart:078]:   Icon: 'mdi:restart'
[22:01:45][C][restart:099]:   Restore Mode: restore defaults to OFF
[22:01:45][C][psram:020]: PSRAM:
[22:01:45][C][psram:021]:   Available: YES
[22:01:45][C][psram:024]:   Size: 1 MB
[22:01:45][C][mdns:103]: mDNS:
[22:01:45][C][mdns:104]:   Hostname: espcam
[22:01:45][C][ota:093]: Over-The-Air Updates:
[22:01:45][C][ota:094]:   Address: espcam.local:3232
[22:01:45][C][api:138]: API Server:
[22:01:45][C][api:139]:   Address: espcam.local:6053
[22:01:45][C][api:141]:   Using noise encryption: YES
[22:01:45][C][wifi_signal.sensor:009]: WiFi Signal 'espcam - WiFi Signal'
[22:01:45][C][wifi_signal.sensor:009]:   Device Class: 'signal_strength'
[22:01:45][C][wifi_signal.sensor:009]:   State Class: 'measurement'
[22:01:45][C][wifi_signal.sensor:009]:   Unit of Measurement: 'dBm'
[22:01:45][C][wifi_signal.sensor:009]:   Accuracy Decimals: 0
[22:01:47][W][esp32_camera:166]: Got invalid frame from camera!
[22:01:51][W][esp32_camera:166]: Got invalid frame from camera!
[22:01:55][W][esp32_camera:166]: Got invalid frame from camera!
[22:01:59][W][esp32_camera:166]: Got invalid frame from camera!
[22:02:03][W][esp32_camera:166]: Got invalid frame from camera!
[22:02:07][W][esp32_camera:166]: Got invalid frame from camera!
[22:02:11][W][esp32_camera:166]: Got invalid frame from camera!
[22:02:19][W][esp32_camera:166]: Got invalid frame from camera!
[22:02:23][D][sensor:127]: 'espcam - WiFi Signal': Sending state -68.00000 dBm with 0 decimals of accuracy
[22:02:23][W][esp32_camera:166]: Got invalid frame from camera!

Additional information

No response

terveer commented 1 year ago

Please check that your data pins are in correct order - like:

define Y9_GPIO_NUM 35

define Y8_GPIO_NUM 34

define Y7_GPIO_NUM 39

define Y6_GPIO_NUM 36

define Y5_GPIO_NUM 21

define Y4_GPIO_NUM 19

define Y3_GPIO_NUM 18

define Y2_GPIO_NUM 5

Alan-K2 commented 1 year ago

I had the same issue. For me the solution was to remove the ref to the power down pin GPIO32 from the YAML.

andreclemente commented 1 year ago

Tried both and it didn't work. Still have the same "[W][esp32_camera:190]: Got invalid frame from camera!"

yeyeto2788 commented 5 months ago

Did you guys managed to make it work? My board has a 8225N V2.0 171026 camera and I get the same error.

Trying to remove the power actually made it worse as the camera never initialized.