Cannot find esp_camera.c

Hello,
I'm using the esp library (https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json) to test the esp cam on the FreeNove Esp32 cam board.

For that I'm using the CameraWebServer example, which fails on esp_camera_init().

To see what's wrong I want to see the source code, but I can't find esp_camera.c on my computer, which is where that function is implemented.

I tried looking in various folders like .../Documents/Arduino/libraries/ and also in C/Program Files/Arduino/... but no luck.

Can you help me locate the file?

Thanks

esp_camera_init() is in esp_camera.h

For instance
C:\Users\Bob2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.16\tools\sdk\esp32\include\esp32-camera\driver\include\esp_camera.h

If you're using the IDE, after a successful compile, you should be able to hover over the esp_camera_init, and perhaps after waiting a moment or two, you should see a tooltip describing that call. You can right-click and choose Go to Definition, which should open esp_camera.h. Then hover over the file's tab, and a tooltip should show the full file path.

Alternately, hover over the #include statement, and a tooltip should appear and show the full file path.

So this shows the location of the Board's libraries, under Arduino15 (or ~/.arduino15 on Linux and Mac); which is separate from the optional Library files, usually in your sketchbook directory (.../Documents/Arduino/libraries or ~/Arduino/libraries).

The bad news in this case is that the file is under /driver/include. In that directory, there's just esp_camera.h and sensor.h. There is no corresponding implementation, which would likely be a .cpp file, not plain .c. So the implementation is part of the binary blob that can be linked in, but there is no source to examine.

1 Like

I see, so there is no way ot debugging that code? I just have to try from the outside?
I was hoping to read the source code because the board + cam is literally new, but it doesn't work. I may have possibly set the wrong pin definitions, we will see.

There are reviews and pinouts of the board here;

https://randomnerdtutorials.com/getting-started-freenove-esp32-wrover-cam/

Would have been difficult to carry out a review if there had been a 'bug' in esp_camera.c stopping the board from working.

Please read the replies by @UKHeliBob and @kenb4 again; both indicate where the files are (or should be). You will have to dig a little.

Note that on Windows system files might be hidden; you need to configure Windows Explorer to show hidden stuff (somewhere under the options; I'm not a Windows user at the moment).

Here's the entirety of the esp-camera directory for my M5Stack board, using tree

~/.arduino15/packages/m5stack/hardware/esp32/2.1.1/tools/sdk/esp32/include/esp32-camera
ā”œā”€ā”€ conversions
│   └── include
│       ā”œā”€ā”€ esp_jpg_decode.h
│       └── img_converters.h
└── driver
    └── include
        ā”œā”€ā”€ esp_camera.h
        └── sensor.h

4 directories, 4 files

However, if you search the web for esp_camera.h, the first hit I get is the Github repo, espressif/esp32-camera -- and the implementation is there, in the driver directory. It turns out to be esp_camera.c, as you said. They apparently exclude a bunch of stuff as part of their SDK release.

Indeed that is why I'm asking here, I see the .h files and .c implementation online but not locally. With your confirmation I can close the thread.

@srnet My goal was not to find a bug in the esp code, it was simply to see what it does and where it returns the error code, to hopefully get a hint of what I'm doing wrong.

I will go back to the tutorial again and triple check the pin definitions etc.

Thank you all.

Hi @thiird. You must configure the "CameraWebServer" for your hardware.

By default the sketch is configured for use with the "ESP-Eye" hardware:

That configuration won't work with your hardware.

Change line line 17 in the sketch from this:

#define CAMERA_MODEL_ESP_EYE // Has PSRAM

to this:

//#define CAMERA_MODEL_ESP_EYE // Has PSRAM

Change line 24 in the sketch from this:

//#define CAMERA_MODEL_AI_THINKER // Has PSRAM

To this:

#define CAMERA_MODEL_AI_THINKER // Has PSRAM

After that, upload the sketch to your "Freenove ESP32 CAM" board. Hopefully this time it will work as expected.

Thanks for your detailed post.
I already did all of that, that's why I was trying something else.

I get the error:

rst:0x1 (POWERON_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0

E (498) camera: Camera probe failed with error 0x105(ESP_ERR_NOT_FOUND)
Camera init failed with error 0x105

Which is very generic...

OK, that is unfortunate. I encountered this "Camera probe failed with error 0x105(ESP_ERR_NOT_FOUND)" error when using the example sketch with my own "ESP32-CAM" board and changing the sketch configuration as I described in my previous reply did solve the problem for me.

There is discussion about the the error message here:

I discovered the solution that worked for me in one of the comments on that thread. I guess that specific comment won't be useful to you, but maybe you will find something useful in one of the other comments there.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.