easytarget / esp32-cam-webserver

Expanded version of the Espressif ESP webcam
https://hackaday.io/project/168563-7-esp32-cam-example-expanded
GNU Lesser General Public License v2.1
1.27k stars 341 forks source link

Getting No PSRAM found on first boot #287

Open Drizzt321 opened 1 year ago

Drizzt321 commented 1 year ago

So I got this esp32-cam, and when using your sketch I get No PSRAM found; camera cannot be initialised: Please check the board config for your module. as an error on first boot. Screenshot and full output is below.

I did ensure in Tools->PSRAM -> Enabled is set, using latest Arduino (2.0.3) and esp32 boards (2.0.6) is installed.

psram enabled

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:13836
load:0x40080400,len:3608
entry 0x400805f0
E (242) psram: PSRAM ID read error: 0xffffffff

====

esp32-cam-webserver: ESP32 camera server
Code Built: Feb  3 2023 @ 11:15:57
Base Release: 4.0

Fatal Error; Halting
No PSRAM found; camera cannot be initialised: Please check the board config for your module.
sonofcy commented 1 year ago

You have the wrong board selected, it has to be AI Thinker ESP32-CAM

Drizzt321 commented 1 year ago

Instructions in the README says to use the generic ESP32 Dev Module

sonofcy commented 1 year ago

THINK, does that have a camera? I have dozens of these and work with them all the time. The README is wrong.

Drizzt321 commented 1 year ago

Set the board to AI Thinker ESP32-CAM, same issue, No PSRAM found.

Note, this is NOT an AI-Thinker branded board, see Amazon link I have above, is what I'm trying to use. Wonder if this particular module, ESP32-S, just doesn't have any PSRAM.

sonofcy commented 1 year ago

The board I am using is also NOT an AI-THINKER, it is similar to what you have. I do NOT fool around with the settings on the IDE board menu. I just compiled and it works.

sonofcy commented 1 year ago

12:45:49.781 -> 0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 (POWERON_RESET),boot:0x13 (S0x1 AST_FLASH_BOOT) 12:45:49.781 -> configsip: 0, SPIWP:0xee 12:45:49.781 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 12:45:49.781 -> mode:DIO, clock div:1 12:45:49.781 -> load:0x3fff0030,len:1344 12:45:49.781 -> load:0x40078000,len:13836 12:45:49.781 -> load:0x40080400,len:3608 12:45:49.781 -> entry 0x400805f0 12:45:50.731 -> 12:45:51.617 -> ... 12:45:52.601 -> WiFi connected 12:45:52.601 -> Camera Ready! Use 'http://192.168.0.122' to connect

Drizzt321 commented 1 year ago

What were your compile settings? I didn't "mess around", I followed the README on the project. If that's wrong, then please tell me what the correct settings are.

sonofcy commented 1 year ago

Ialmost never read README's, they get out of date the first change. My IDE is set up the same for any board, either ALL or DEFAULT compiler warnings, then all the usual stuff, I have NEVER changed any setting in the boards, I don't even see the PSRAM setting you changed. The sample sketch is set up for AI-THINKER, I specify the AI-THINKER board and it just works, I just tried it. IMG_F36C4C3106FF-1

Screenshot 2023-02-03 at 13 10 39
Ropese commented 1 year ago

Good morning I also have the psram problem I tried 3 esp32-s only one goes the others psram error I changed the camera modules but still the same. how can it be that 1 goes and the others don't? i tried with other skretch and other modules work too but not with this any idea? Thank you

Emstar commented 11 months ago

EDIT: While the procedure below does work, as I feared it did cause problems when compiling projects for other boards. I found that as @sonofcy said, you must select the AI Thinker board type in the IDE, and NOT the ESP32 Dev Module as the docs say. With AI Thinker selected the PSRAM is detected without workarounds.


I have the same kind of ESP32-S board and had the same PSRAM problem when using board type ESP32 Dev Module.

I found the solution in this post: https://www.esp32.com/viewtopic.php?t=31247#p107434

In C:\Users\USERNAME\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.13\cores\esp32\esp32-hal-psram.c rig the PSRAM test:

//#if CONFIG_SPIRAM_SUPPORT || CONFIG_SPIRAM
#if 1

In esp32-cam-webserver.ino, in setup(), add this after the block of startup serial.print() statements near line 650.

    if (psramInit()) {
      Serial.print("PSRAM OK. Size: ");
      Serial.println(ESP.getFreePsram());
      }

In myconfig.h continue to use the default AI_THINKER definition.

While this worked there is probably a better way to do it. This is my first project, I don't know this environment or hardware at all. Modifying a core library file sucks and seems like it would break compatibility with other boards.

I also noticed that PSRAM did not seem to initialize properly on every bootup. Sometimes you have to push the reset button to get the board to come up.

If anyone can suggest the right way to implement this support without messing with esp32-hal-psram.c I would love to know.