Code Monkey home page Code Monkey logo

Comments (15)

Mnark avatar Mnark commented on September 28, 2024 1

Here is my understanding of what should happen...
(Original post edited as it was plain wrong!)

This becomes a lot clearer when you don't look at the existing code....

The OV2640 module has a PWDN and a RESET pin.

The AI Thinker ESP32-CAM board has PWDN connected to pin 32, the RESET pin is NOT connected.

So we have only so worry about the PWDN pin...

The OV2640 gets its power via the PWDN pin, so if it goes off (LOW), then the camera is off, losing all its configuration. (It is possible to toggle very quickly off and then on again without the camera noticing... but why you would want to do this is beyond me).

IMPORTANT Configure a pull-up resistor on pin 32 so it stays HIGH unless you specifically pull it LOW in your code.

from esp32-camera.

Mnark avatar Mnark commented on September 28, 2024

I'm having similar issues, but this from the wiki clarifies a little.

What pin number are you defining as the reset pin?

...
2. The ESP32 GPIO32 pin controls the camera power. When the camera is working, please lower the GPIO32.

3. Since IO0 is connected to the camera XCLK, please leave IO0 floating when using it, please do not connect high and low level.
...

from esp32-camera.

heinerlohmann avatar heinerlohmann commented on September 28, 2024

Sadly I don't speak (or read) Chinese.
With .pin_reset set to -1 and .pin_pwdn set to 32 everything is working fine so far.

from esp32-camera.

Mnark avatar Mnark commented on September 28, 2024

Google translate :)

That's what I have too. (-1 disables the use of the pin).

Mine was working until I started adding code, so I'm pretty sure the problems are in the code.

I am NOT using hardware i2c.

from esp32-camera.

heinerlohmann avatar heinerlohmann commented on September 28, 2024

You're right, although I don't tend to trust automatic translation in technical matters.
So far I have no problems with taking pictures, saving them to SD or sending them as http.
Sometimes on boot the SCCB fails, but it succeeds on second try, so I have not looked further into the issue yet.

from esp32-camera.

me-no-dev avatar me-no-dev commented on September 28, 2024

I've been reading about this but have not been able to reproduce it till recently. I got a hols of one board that has almost all pins mapped exactly as Wrover-Kit with the exception of power. The other issue with this is that 0x3C is actually the valid address for OV3660, so we can not treat it as error.
Overall the best action is to setup the pins properly for the given board. Maybe some sort of note needs to be left... or maybe I could just error out if 0x3C is found but SCCB fails... not sure what is the best approach to notify the user for this issue.

from esp32-camera.

heinerlohmann avatar heinerlohmann commented on September 28, 2024

Yes it's a bit tricky, but some kind of note would be nice to save other people some time, since the workaround is pretty easy, once you know what's up. Thank you for looking into it. :)

from esp32-camera.

me-no-dev avatar me-no-dev commented on September 28, 2024

can you point me to that information in the datasheet? I'm not sure I understand what you mean by pin32. Which IO on the camera is this connected to?

from esp32-camera.

heinerlohmann avatar heinerlohmann commented on September 28, 2024

Thanks for your contribution to the topic, Mnark!

I know this is off topic but there is something else about the esp32-cam board I had to figure out the hard way. Apparently gpio 16 is somehow internally connected. (I am new to the whole topic of microcontrollers, but I guess it has to do with the SDRAM and core selection or something like that) So if you set it to input only, e.g. to connect a PIR, it messes with your tasks and causes crashes. So there are not a lot of pins one could use for getting an input. I turned to pin 12, which would be used by the sd-card, but since one has to use the sd-card in single line mode anyway to use the flash on pin4, pin 12 should become available.

from esp32-camera.

Mnark avatar Mnark commented on September 28, 2024

It does appear to be connected internally, its labelled U2RXD on the datasheet, so would imply its some sort of external interrupt.

This isn't my field of expertise, but I notice that the sensor module can be left running while the ESP is in sleep mode (this functionality doesn't exist in this library), I suspect this pin should be used to wake up the ESP from deep sleep.

(Probably what you are trying to do with a PIR... I'm intending using an RF motion detector for this task, but haven't got to it yet)

from esp32-camera.

Mnark avatar Mnark commented on September 28, 2024

@me-no-dev The mystery of the 0x03c is at the top of the code (sccb.c), it is the default value returned when SCCB fails... it should be 0x00.

static uint8_t ESP_SLAVE_ADDR = 0x3c;

from esp32-camera.

bartlomiejcieszkowski avatar bartlomiejcieszkowski commented on September 28, 2024

Stumbled on this error also, with the I2C hardware mode the passed slave_addr was not used,
so for the w/a where there was SCCB_Write(0x30, (...)) it wrote to the ESP_SLAVE_ADDR

Uploaded pull request for this issue: #106

from esp32-camera.

xenpac avatar xenpac commented on September 28, 2024

I am suggesting this alternate code for SCCB_Probe function: (to remove this 0x3C issue)
tested.

uint8_t SCCB_Probe()
{
uint8_t slave_addr = 0;

#ifdef CONFIG_SCCB_HARDWARE_I2C
while(slave_addr < 0x7f)
{
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, ( slave_addr << 1 ) | WRITE_BIT, ACK_CHECK_EN);
i2c_master_stop(cmd);
esp_err_t ret = i2c_master_cmd_begin(SCCB_I2C_PORT, cmd, 1000 / portTICK_RATE_MS);
i2c_cmd_link_delete(cmd);
if( ret == ESP_OK)
{
return slave_addr; // got response = valid slv_addr
}
slave_addr++;
}
#else
for (uint8_t i = 0; i < 0x7F; i++)
{
if (twi_writeTo(i, &slave_addr, 1, true) == 0)
{
break;
}

    if (i!=0x7E)
    {
        vTaskDelay(10 / portTICK_PERIOD_MS); // Necessary for OV7725 camera (not for OV2640).
    }
}

#endif
if (slave_addr==0x7F) slave_addr=0; // indicate not found
return slave_addr;
}

from esp32-camera.

xenpac avatar xenpac commented on September 28, 2024

sorry formating got garbeled....

from esp32-camera.

github-actions avatar github-actions commented on September 28, 2024

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

from esp32-camera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.