Closed B0RJA closed 5 years ago
Seems the soft I2C is not happy. I have hit a similar issue with the soft I2C here on another device. I will push an update, so if you can please give it a shot when I do (will do some more testing and post here).
I looked around for schematic of that board... not found :) Can you please try changing the following lines https://github.com/espressif/esp32-camera/blob/master/driver/twi.c#L257-L258
to
pinMode(twi_sda, OPEN_DRAIN | PULLUP | INPUT | OUTPUT);
pinMode(twi_scl, OPEN_DRAIN | PULLUP | INPUT | OUTPUT);
I also need to adjust timing, though that should not be an issue. I think that AI-Thinker forgot to add pull-ups to the camera i2c
Thank you for your quick response.
I will test the changes this afternoon and report the result.
The board schematic can be found on the following link: https://github.com/SeeedDocument/forum_doc/raw/master/reg/ESP32_CAM_V1.6.pdf and more details on the product page: https://www.seeedstudio.com/esp32-cam-p-3153.html
The board is available in Aliexpress: https://es.aliexpress.com/w/wholesale-esp32-cam.html?SortType=total_tranpro_desc&g=y&SearchText=esp32+cam
thanks for schematic :) what I see is that there are pull-ups on the I2C lines. But I also see that cam power is defined to pin 32. Can you add code to make sure that io32 is output and HIGH before you attempt to start the cam?
to be frank, I have tested the code in this repo with a few different camera boards without a single fail. I do not have this AI-Thinker though... I hope that it's this power thing
the problem was solved setting CAM_PIN_RESET to 32. Thank you!
@Borja, I am having a similar issue (although I got the reset pin correctly) Did you do anything else to get it to work?
@aguaviva Try this demo. Clone the esp-who repo recursively and you will get the camera driver and other required components. In the first make of the demo just configure the esp32-cam board.
@B0RJA you made my day, it works like a charm!!!
Not sure if I should open a new issue on this or just comment here... for now here will suffice.
I'm have a similar issue, but different error messages - my setup is the same as the parents, I've corrected the reset pin, but I still get an error message (noted below, slightly different from others)
I (359) AuntyCam: Booting...
D (369) camera: Enabling XCLK output
D (369) ledc: LEDC_PWM CHANNEL 0|GPIO 00|Duty 0002|Time 0
D (379) camera: Initializing SSCB
D (379) camera: Resetting camera
I (379) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
D (409) camera: Searching for camera address
E (419) camera: Camera probe failed with error 0x20001
E (419) AuntyCam: Camera Init Failed
I tried the methods suggested in this thread in varying combinations, to no avail.
I've also attempted cloning the esp-who demo as suggested by @B0RJA but it also fails.
The only thing that does seem to work, is the following repository: https://github.com/donny681/ESP32_CAMERA_QR which will detect and run the camera on this board without (much) issue.
I've noticed there seem to be at least two different variants of the AI-Thinker ESP32-CAM board, one with a reset switch on the back, and one without - for what it's worth mine has the reset switch on the back.
If anyone has any ideas or suggestions, I'd be really keen to hear them - right now I'm at a total loss and quite confused!
@lvturner Can you post the pinout of your board, or the page where you bought it, to check if is the same as mine?
@B0RJA Lightning fast with your response! Here's an update:
I've just modified camera.c
line 870 to remove the else statement found there to force a reset on the camera, I now get the following in the logs
I (145) camera: Resetting OV2640
SCCB_Write [ff]=01 failed
SCCB_Write [12]=80 failed
E (165) camera: Camera probe failed with error 0x20001
E (165) AuntyCam: Camera Init Failed
Which is at least consistent with your original error!
Purchased from here: https://item.taobao.com/item.htm?spm=a1z09.2.0.0.fc652e8dP485Zp&id=577628508892&_u=43nqq4so7e01
I've also attached a couple of photos of the exact board I have, in case it helps any
Editing to avoid spamming this thread with loads of replies...
Getting closer
From line 858, I changed it to the following (the gpio_set_level lines were originally the inverse of this) - I also ensure that the reset code is called by removing the else statement found on line 870
if(config->pin_reset >= 0) {
ESP_LOGD(TAG, "Resetting camera");
gpio_config_t conf = { 0 };
conf.pin_bit_mask = 1LL << config->pin_reset;
conf.mode = GPIO_MODE_OUTPUT;
gpio_config(&conf);
gpio_set_level(config->pin_reset, 1);
vTaskDelay(10 / portTICK_PERIOD_MS);
gpio_set_level(config->pin_reset, 0);
vTaskDelay(10 / portTICK_PERIOD_MS);
#if CONFIG_OV2640_SUPPORT
} else {
//reset OV2640
ESP_LOGI(TAG, "Resetting OV2640");
SCCB_Write(0x30, 0xFF, 0x01);//bank sensor
SCCB_Write(0x30, 0x12, 0x80);//reset
vTaskDelay(10 / portTICK_PERIOD_MS);
#endif
}
I now get the following output on the console, which looks far more promising
I (110) AuntyCam: Booting...
I (120) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (130) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (200) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (200) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (210) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (220) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (230) gpio: GPIO[21]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (240) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (250) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (260) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (270) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (270) gpio: GPIO[23]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (280) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (290) camera: Allocating 1 frame buffers (234 KB total)
I (330) camera: Allocating 234 KB frame buffer in OnBoard RAM
E (550) sccb: SCCB_Read [c3] failed rc=3
Unfortunately, not quite far enough to obtain an image yet ;)
Further update - increasing the vTaskDelay call in the reset routines from 10 to 100 has gotten rid of the SCCB_Read/Write warnings, however, I'm still not able to produce a valid JPG from the camera
Replaced the camera on the board with another, working properly now - suspect the original camera is just very temperamental :|
Is it possible to switch of the FLASH LED ?
In my board (Ai-Thinker CAM) the flash led is connected to GPIO 4 with is also serves as Data 1 to the microSD card. If you do not use the microSD, it is possible to configure the pin as output with the gpio_set_direction and to low level with the gpio_set_level function. This turns off the light but unfortunately the pin is configured during boot as input and the light is visible for a moment after power on. I ended up removing physically the led from the board.
Is it possible to switch of the FLASH LED ?
Yes, just set it to LOW.
int lampledPin = 4;
setup()
pinMode(lampledPin, OUTPUT);
loop()
digitalWrite(lampledPin, LOW);
Hi @B0RJA. What I must do when I see this error? https://pastebin.com/nyJXVChg
how to take photo using esp32 cam and send it to server when interrupt is called, without storing photo in sd card
@chandana9123 My friend fallwo this url https://www.instagram.com/arduinonet/ there is a sample and show case will be in 4 days.
@chandana9123 My friend fallwo this url https://www.instagram.com/arduinonet/ there is a sample and show case will be in 4 days.
Got any public repo code for that demo? thanks
@KeenStratium You can check this tutorial. https://rahmitugrulaltin.blogspot.com/2020/04/esp32-camera-taking-picture-and-send-to.html
@KeenStratium You can check this tutorial. https://rahmitugrulaltin.blogspot.com/2020/04/esp32-camera-taking-picture-and-send-to.html
Thanks got it working! I've been struggling to have both WiFi and BLE enabled while sending a photo to a web server, this code helped.
This repo is not working with OV2640 at all.
But I can confirm the repo mentioned by @lvturner is working well: https://github.com/donny681/ESP32_CAMERA_QR.
I am testing the code with the Ai-Thinker CAM board using an OV2640 sensor.
The initial camera probe fails with 0x20001 error (ESP_ERR_CAMERA_NOT_DETECTED).
I have used the same hardware and PIN configuration with the @igrr example with no problems.
Have you tested the code using the OV2640 sensor?
This is the PIN config:
And the error: