PacktPublishing / Internet-of-Things-with-ESP32

Developing IoT Projects with ESP32, published by Packt
MIT License
182 stars 50 forks source link

esp32cam - fails to work #2

Open bkircher67 opened 2 years ago

bkircher67 commented 2 years ago

Hello,

despite going through the chapter in the book several times, finally using the downloaded project "camera_example" from chapter 04, my ESP32-CAM fails to work: the code execution already starts with these messages

␛[0;32mI (450) sccb: pin_sda 26 pin_scl 27
␛[0m
␛[0;31mE (460) i2c: i2c_param_config(647): i2c clock choice is invalid, please check flag and frequency␛[0m
␛[0;32mI (470) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 ␛[0m
␛[0;31mE (1510) i2c: i2c_set_pin(828): scl and sda gpio numbers are the same␛[0m
␛[0;31mE (2510) i2c: i2c_set_pin(828): scl and sda gpio numbers are the same␛[0m
....
␛[0;31mE (128510) i2c: i2c_set_pin(828): scl and sda gpio numbers are the same␛[0m
␛[0;31mE (129510) i2c: i2c_set_pin(828): scl and sda gpio numbers are the same␛[0m
␛[0;31mE (129520) camera: Detected camera not supported.␛[0m
␛[0;31mE (129520) camera: Camera probe failed with error 0x20004␛[0m
err: ERROR

But the camera is labeled as "TY-OV2640-V2.0" (I tried another OV2640 labeled with HDF3M-811XR, and some other cameras like OV7670, all with the same result)

Any Idea? or are there fundamental differences between these boards?

KR Bernd

rajat-packt commented 2 years ago

Hey @bkircher67, thanks for bringing this to our attention. We are trying to reach out the Tech Reviewer of the book to get your query answered, we will update the readme section with the same once we receive a reply. Cheers!

ozanoner commented 2 years ago

Hi @bkircher67 , sorry for the late reply, I was on leave. Have you tried powering your ESP32-cam with an external power source?

Screenshot from 2022-04-27 08-29-32

You can also see the discussion here: https://github.com/espressif/esp32-camera/issues/102

Please let me know if this solves the problem.

Ozan

bkircher67 commented 2 years ago

Hello Ozan, even after providing the external 5V I still do get the same errors. I have also checked the errors again: maybe the i2c problem starts already a bit earlier with that message:

␛[0;31mE (460) i2c: i2c_param_config(647): i2c clock choice is invalid, please check flag and frequency␛[0m

The explanation for this issue says:

A new member was recently added to i2c_config_t: https://github.com/espressif/esp-idf/bl ... /i2c.h#L66 You can initialise to 0 for default behaviour (or, even better, initialise the entire struct; any new additions like this will then typically do the backwards-compatible default thing if zeroed).

But how can I access that i2c_config_t which is not provided in main.c (also not in camera_config_t)?

BTW I'm using platformIo Core 5.2.5, Home 3.4.1 and Espressif 32 3.5.0.

Next step will be the update to Espressif 4.1.0 which was shown to me today.

Bernd

ozanoner commented 2 years ago

Hi Bernd, If you're using the example as it is (cloned the whole repository and no modification in the libraries), the i2c clock shouldn't be any problem since the camera driver sets it explicitly. See this: https://github.com/PacktPublishing/Internet-of-Things-with-ESP32/blob/0eb0763b52ecf56ba3a3b1ab62fd4e41b7462018/common/esp32-camera/driver/sccb.c#L50 The examples are also developed in Espressif 32 3.5. You can specify it in platformio.ini as: platform = espressif32 @ ^3.5