ESP32 S2 PSRAM

kcchang61
Posts: 1
Joined: Tue Jan 10, 2023 6:06 am

ESP32 S2 PSRAM

Postby kcchang61 » Tue Jan 10, 2023 6:19 am

Hi!

I'm using LOLIN S2 Mini, it support 2MB PSRAM.
In Arduino IDE, PSRAM is automatically enabled by board.txt file even PSRAM menu does not exist.

But, I could not initialize PSRAM and found any PSRAM area like this. How can I solve this problem?

Code: Select all

#define SERIAL_PRINTF_MAX_BUFF      256

void serialPrintf(const char *fmt, ...) {
  char buff[SERIAL_PRINTF_MAX_BUFF];
  va_list pargs;
  va_start(pargs, fmt);
  vsnprintf(buff, SERIAL_PRINTF_MAX_BUFF, fmt, pargs);
  va_end(pargs);
  Serial.print(buff);
}

void setup() {
  Serial.begin(115200);
  delay(3000);      // for Serial Display
  
  if (psramInit())
    serialPrintf("PSRAM init OK\n");
  else
    serialPrintf("PSRAM init NG\n");

  serialPrintf("Total RAM: %d, Free RAM: %d\n", ESP.getHeapSize(), ESP.getFreeHeap());
  serialPrintf("Total PSRAM: %d, Free PSRAM: %d\n", ESP.getPsramSize(), ESP.getFreePsram());

}

void loop() {
}
PSRAM init NG
Total RAM: 240820, Free RAM: 214684
Total PSRAM: 0, Free PSRAM: 0

Who is online

Users browsing this forum: No registered users and 71 guests