PSRAM on ESP32 CAM

How can i enable PSRAM on esp32cam?

note: Iam using arduino ide

In the IDE select Tools from the top menu bar and make sure PSRAM is set to 'Enabled'

There is no psram option

i selected AI thinker ESP Camera

For that board PSRAM is enabled by default.

Nice how should i use it if u have tutorial or something like that

Try to explore net to get the following AI generated sketch which stores "Forum" into PSRAM memory, retrives it and shows on Serial Monitor. To test the sketch, I have used ESP32-CAM Module mounted on ESP32-CAM-MB adapter board.

#include <esp_heap_caps.h>

void setup() 
{
  Serial.begin(115200);

  // Check if PSRAM is enabled
  if (psramInit()) 
  {
    Serial.println("PSRAM initialized successfully!");
  } 
  else 
  {
    Serial.println("PSRAM initialization failed...");
    while (1); // Stop if PSRAM isn't available
  }

  // Check total available PSRAM
  size_t psramSize = ESP.getPsramSize();
  Serial.print("Total PSRAM: ");
  Serial.println(psramSize);

  // Check available PSRAM
  size_t freePsram = ESP.getFreePsram();
  Serial.print("Free PSRAM: ");
  Serial.println(freePsram);

  // Allocate memory in PSRAM to store the string "Forum"
  const char* originalString = "Forum";
  int stringLength = strlen(originalString) + 1; // +1 for null terminator

  // Allocate memory in PSRAM for the string
  char* psramString = (char*) heap_caps_malloc(stringLength, MALLOC_CAP_SPIRAM);

  if (psramString == NULL) 
  {
    Serial.println("Failed to allocate memory in PSRAM");
  } 
  else 
  {
    Serial.println("PSRAM memory allocated successfully!");

    // Copy the string "Forum" to PSRAM
    strcpy(psramString, originalString);

    // Verify by printing the string from PSRAM
    Serial.print("Stored string in PSRAM: ");
    Serial.println(psramString);

    // Free the allocated memory after use (optional, depending on the application)
    heap_caps_free(psramString);
  }
}

void loop() {}

Output:

PSRAM initialized successfully!
Total PSRAM: 2095087
Free PSRAM: 2094827
PSRAM memory allocated successfully!
Stored string in PSRAM: Forum

Please, capture a picture using the Camera of ESP32-CAM and stores it into the PSRAM. Post your sketch for my learning.

Thanks

There is an output like this on my serial monitor. I am using esp32-cam, camera model is 8225N. = waiting for download
ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (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:4916
load:0x40078000,len:16436
load:0x40080400,len:4
ho 8 tail 4 room 4
load:0x40080404,len:3524
entry 0x400805b8
E (584) esp_psram: SPI SRAM memory test fail. 131072/131072 writes failed, first @ 3F800000
PSRAM initialization failed...