ESP32S not returning frame buffer pointer in ESP32-CAM clone

abratchik
Posts: 5
Joined: Wed Jan 25, 2023 6:59 pm

ESP32S not returning frame buffer pointer in ESP32-CAM clone

Postby abratchik » Sun Feb 19, 2023 3:18 pm

I have made a custom PCB based on ESP32-CAM design and ordered it through EasyEDA, for my toy car project. The board is based on this diagram , which seems to be the official ESP32-CAM board schematics. The ESP32 - related part on my custom PCB is exactly like this ESP32-CAM, so it should work (or at least I thought so :).

I was able to load the sketch to my custom board, from this repo: https://github.com/abratchik/esp32-cam-webserver. The ESp32 starts normally and loads the web server, which I can access through browser. The OTA sketch upload is also working fine on my custom PCB. Moreover, the board detects the correct model of the camera (OV2640 or OV3660) and initialization of the camera passes successfully. Here is what I see in logs (Core debug level set to Verbose):

Code: Select all

17:56:54:847 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
17:56:54:853 -> configsip: 0, SPIWP:0xee
17:56:54:853 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
17:56:54:862 -> mode:DIO, clock div:1
17:56:54:862 -> load:0x3fff0030,len:1344
17:56:54:864 -> load:0x40078000,len:13864
17:56:54:867 -> load:0x40080400,len:3608
17:56:54:871 -> entry 0x400805f0
17:56:55:893 -> [   689][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
17:56:56:340 -> [  1136][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
17:56:56:359 -> Starting filesystem
17:56:56:402 -> SDHC card size: 3708MB
17:56:56:800 -> [b]OV2640 camera module detected[/b]
17:56:56:800 -> [b]Camera init succeeded[/b]
17:56:57:105 -> Camera debug is ON
17:56:57:105 -> [  1902][D][app_cam.cpp:132] loadPrefs(): [app_cam] Log level set to VERBOSE
17:56:57:130 -> Known external SSIDs: xxxxxxxxx
17:56:57:133 -> Starting WiFi
...
17:57:05:415 -> HTTP server started
So far, looking good. However, when I'm trying to snap an image from camera, it fails:

Code: Select all

fb = esp_camera_fb_get();
is stuck for some time and then it returns NULL pointer to fb. This behaviour is reproducible no matter how many times I try, so this is not a floating issue.

I checked all the connections from the camera to ESP32 and they are identical to ESP32-CAM, which I have. I even have soldered my spare ESP32S modules to both my custom PCB and the ESP32-CAM development board and the result was: the ESP32-CAM works fine with the soldered module (I mean, esp_camera_fb_get() returns the frame buffer as expected) but my custom PCB doesn't.

I almost run out of ideas how to debug this issue. Part of the problem is that esp-camera driver from ESP32 HAL doesnt print any diagnostics even when I set the debug level to VERBOSE when uploading the sketch. I only see debug printouts from the WiFI module but not from ESP camera driver. Is there any way I can enable the verbosity for the esp_camera?

If to generalize the question: if I need to enable the debug on the ESP32 HAL layer, how do I do that? I'm using VSCode + Arduino plugin v 0.5.0.

abratchik
Posts: 5
Joined: Wed Jan 25, 2023 6:59 pm

Re: ESP32S not returning frame buffer pointer in ESP32-CAM clone

Postby abratchik » Mon Feb 20, 2023 6:34 am

Found the root cause of the problem - my PCB had incorrect C13 capacitor value on the PCLK line of the camera (100n instead of 15pf). Unsoldering it fixed the issue.

Still the question remains how to debug the core modules. The upload setting of the debug level seems to have a limited effect as camera module is not exhibiting any verbosity.

Who is online

Users browsing this forum: noweare and 67 guests