PSRAM init failed! - can't get esp32-cam board to work

thelocaldude
Posts: 2
Joined: Fri Dec 23, 2022 10:58 pm

PSRAM init failed! - can't get esp32-cam board to work

Postby thelocaldude » Fri Dec 23, 2022 11:30 pm

Hello everyone!

I've bought this ESP32-CAM board https://www.ebay.de/itm/175340316484?var=474577788572 and have been trying to get the camera webserver https://github.com/MakeMagazinDE/ESP32- ... sp32-gucki to work. However, whatever I do it always fails on startup with this message:

Code: Select all

Fatal Error; Halting
No PSRAM found; camera cannot be initialised: Please check the board config for your module.
I used both the latest version of the Arduino IDE (2.0.x) and 1.8.18. I configured it as an AI Thinker board and have had no trouble connecting to it (through the serial-to-USB converter that was included) and running other code on it, but once it tries to access the PSRAM it fails. Querying the memory via

Code: Select all

#include <Arduino.h>

void setup() {
  log_d("Total heap: %d", ESP.getHeapSize());
  log_d("Free heap: %d", ESP.getFreeHeap());
  log_d("Total PSRAM: %d", ESP.getPsramSize());
  log_d("Free PSRAM: %d", ESP.getFreePsram());
}
void loop() {}
gives this result:

Code: Select all

E (80) psram: PSRAM ID read error: 0xffffffff
[     5][W][esp32-hal-psram.c:71] psramInit(): PSRAM init failed!
[    41][D][sketch_dec24a.ino:4] setup(): Total heap: 367968
[    41][D][sketch_dec24a.ino:5] setup(): Free heap: 344736
[    41][D][sketch_dec24a.ino:6] setup(): Total PSRAM: 0
[    46][D][sketch_dec24a.ino:7] setup(): Free PSRAM: 0






I have tried setting the IDE to other random ESP32 boards but no luck. The metal cover over the chip has the following inscription:

DM - ESP32-s
FCC-ID: 2ahmr-esp32s

So it doesn't actually say "AI Thinker". Is there a way to find out which board I actually have?

Using this code:

Code: Select all

void loop() {
	for(int i=0; i<17; i=i+8) {
	  chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
	}
	Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision());
	Serial.printf("This chip has %d cores\n", ESP.getChipCores());
  Serial.print("Chip ID: "); Serial.println(chipId);
	delay(3000);
}
gives me this answer:

Code: Select all

19:53:39.398 -> Chip ID: 7659584
19:53:42.413 -> ESP32 Chip model = ESP32-D0WDQ5 Rev 3
19:53:42.413 -> This chip has 2 cores
Can anyone help me? Do I have a bad board?

giltal
Posts: 4
Joined: Wed Sep 30, 2020 5:34 am

Re: PSRAM init failed! - can't get esp32-cam board to work

Postby giltal » Sun Dec 25, 2022 10:08 am

Hi
Edit this file in the SDK:
esp32-hal-psram.c
Change the following line:
#if CONFIG_SPIRAM_SUPPORT || CONFIG_SPIRAM
to
#if 1
Then just choose the regular ESP32 Dev kit

Use this code to init the pSARM
if (psramInit())
printf("PSRAM init OK\n");
printf("PSRAM size: %d\n", ESP.getFreePsram());

thelocaldude
Posts: 2
Joined: Fri Dec 23, 2022 10:58 pm

Re: PSRAM init failed! - can't get esp32-cam board to work

Postby thelocaldude » Tue Dec 27, 2022 7:52 pm

Thank you, but unfortunately, it still doesn't work. I changed this file:

Code: Select all

C:\Users\USERNAME\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.6\cores\esp32\esp32-hal-psram.c
to this:

Code: Select all

//#if CONFIG_SPIRAM_SUPPORT || CONFIG_SPIRAM
#if 1
I then changed the board in Arduino IDE to "ESP32 Dev Module" and set PSRAM to "enable". But after disconnecting and reconnecting, and restarting the IDE the error persists and the PSRAM cannot be initialised:

Code: Select all

20:50:56.810 -> E (249) psram: PSRAM ID read error: 0xffffffff
20:50:56.810 -> [     5][W][esp32-hal-psram.c:72] psramInit(): PSRAM init failed!
Any other ideas? I have ordered another board from another seller https://www.ebay.de/itm/293698345787 in the hope that it works better.

giltal
Posts: 4
Joined: Wed Sep 30, 2020 5:34 am

Re: PSRAM init failed! - can't get esp32-cam board to work

Postby giltal » Wed Dec 28, 2022 6:49 am

It might be a defective module.
Please also make sure to enable: PSRAM enabled the options menu
I have checked it with an ESP-CAM module that I have:
void setup()
{
Serial.begin(115200);
delay(250);
// Setup WiiMote
if (psramInit())
printf("PSRAM init OK\n");
printf("PSRAM size: %d\n", ESP.getFreePsram());
}

Uploading to I/O board
Opening port
Port open
PSRAM init OK
PSRAM size: 4192139

Horseflesh
Posts: 1
Joined: Wed Oct 04, 2023 8:47 pm

Re: PSRAM init failed! - can't get esp32-cam board to work

Postby Horseflesh » Wed Oct 04, 2023 8:51 pm

giltal wrote:
Sun Dec 25, 2022 10:08 am
Hi
Edit this file in the SDK...
Thanks, this info worked for me with my ESP32-S board.

I am new to ESP32 and the Arduino IDE... Can you explain why this change worked? And is there a way to make a change in the project code that will meet the same goal, so we don't have to change the SDK? I am worried about this causing problems with other boards, but maybe I am worried about nothing.

Edit to add: As I feared the library edit did cause problems with another board.

But, I also learned that while the method cited did get PSRAM working, the project that I was trying to compile could be made to work with a different change. Instead of defining the board as the DOIT Dev Kit as the sample code suggested, defining it as an AI THINKER board allowed the project to compile with no PSRAM tweaks.

This is probably obvious to most, but this was my very first esp32 project!

Who is online

Users browsing this forum: No registered users and 104 guests