How to enable psram on XIAO esp32s3 Sense

what are the flags i should use in my platformio ini file to get the esp32s3 sense to use psram ?

HI there,

And Welcome back…
To enable PSRAM on your ESP32-S3 Sense board within PlatformIO, you need to configure your platformio.ini file with specific build flags and board settings. The exact configuration might vary slightly depending on your specific board variant (e.g., N16R8, N8R2) and the type of PSRAM (Quad SPI or Octal SPI).

Here are the common flags and settings to use:

ini
[env:xiao_esp32s3_sense]
platform = espressif32
board = seeed_xiao_esp32s3_sense
framework = arduino

build_flags = 
  -DBOARD_HAS_PSRAM
  -mfix-esp32-psram-cache-issue

board_build.arduino.memory_type = qio_qspi

Explanation of the flags

  • board = seeed_xiao_esp32s3_sense: This is the board ID specific to the ESP32-S3 Sense, which should pull in most of the correct board-specific settings.
  • build_flags = -DBOARD_HAS_PSRAM: This is a necessary preprocessor macro that tells the Arduino core to recognize and use the on-board PSRAM.
  • build_flags = -mfix-esp32-psram-cache-issue: This flag is a workaround for a specific cache issue related to PSRAM on the ESP32.
  • board_build.arduino.memory_type = qio_qspi: This sets the memory type to Quad I/O (QIO) for both the Flash and PSRAM, which is standard for the ESP32-S3 Sense board.

HTH
GL :slight_smile: PJ :v:

I just use the following

build_flags = 
	-D BOARD_HAS_PSRAM
	-D CORE_DEBUG_LEVEL=5

The Debug Level show the installed PSRam as well…

=========== After Setup Start ============
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   360148 B ( 351.7 KB)
  Free Bytes        :   275324 B ( 268.9 KB)
  Allocated Bytes   :    77584 B (  75.8 KB)
  Minimum Free Bytes:   275324 B ( 268.9 KB)
  Largest Free Block:   233460 B ( 228.0 KB)
------------------------------------------
SPIRAM Memory Info:
------------------------------------------
  Total Size        :  8388608 B (8192.0 KB)
  Free Bytes        :  8374212 B (8177.9 KB)
  Allocated Bytes   :    11412 B (  11.1 KB)
  Minimum Free Bytes:  8370324 B (8174.1 KB)
  Largest Free Block:  8257524 B (8064.0 KB)
------------------------------------------

Once enabled, I use the following to print…

  Serial.println("Testing PSRAM");
  if (psramInit())
  {
    Serial.println("PSRAM found!!!");
    Serial.printf("Total PSRAM size: %lu kB\r\n", ESP.getPsramSize() / 1024);
    Serial.printf("Free PSRAM size: %lu kB\r\n", ESP.getFreePsram() / 1024);
  }
  else
  {
    Serial.println("No PSRAM found");
  }

The -mfix-esp32-psram-cache-issue flag mentioned above is for the (earlier) ESP32 and doesn’t apply to the ESP32-S3.

here’s what i get when i type : board = seeed_xiao_esp32s3_sense

Resolving xiao_esp32s3_sense dependencies…
UnknownBoard: Unknown board ID ā€˜seeed_xiao_esp32s3_sense’

using, board = seeed_xiao_esp32s3 works tho

1 Like

what is the difference between using if(psramFound()) and if (psramInit()) ?

Hi there,

Super nugget… :grin: LOL forgot about that one… Nice Work :+1:

GL :slight_smile: PJ :v: