Adafruit QT Py S3 with 2MB PSRAM

Hello…is there a board definition for Adafruit’s QT Py S3 with 2MB PSRAM? (link)

Thanks for any help!

Seems like PlatformIO only has adafruit_qtpy_esp32s3_nopsram which points at adafruit_qtpy_esp32s3_nopsram and not variants/adafruit_qtpy_esp32s3_n4r2. However, it should be easy to add a custom board definition that uses that variant properly.

  1. Create a PlatformIO project with e.g. “Board: ESP32 Dev Module, Framework: Arduino”
  2. Create a boards folder in the root of the project
  3. In that folder, create a adafruit_qtpy_esp32s3_n4r2.json file with the content
{
  "build": {
    "arduino": {
      "ldscript": "esp32s3_out.ld",
      "partitions": "partitions-4MB-tinyuf2.csv"
    },
    "core": "esp32",
    "extra_flags": [
      "-DARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2",
      "-DARDUINO_USB_CDC_ON_BOOT=1",
      "-DARDUINO_RUNNING_CORE=1",
      "-DARDUINO_EVENT_RUNNING_CORE=1",
      "-DBOARD_HAS_PSRAM"
    ],
    "f_cpu": "240000000L",
    "f_flash": "80000000L",
    "flash_mode": "qio",
    "hwids": [
      [
        "0x239A",
        "0x8143"
      ],
      [
        "0x239A",
        "0x0143"
      ],
      [
        "0x239A",
        "0x8144"
      ]
    ],
    "mcu": "esp32s3",
    "variant": "adafruit_qtpy_esp32s3_n4r2"
  },
  "connectivity": [
    "bluetooth",
    "wifi"
  ],
  "debug": {
    "openocd_target": "esp32s3.cfg"
  },
  "frameworks": [
    "arduino",
    "espidf"
  ],
  "name": "Adafruit QT Py ESP32-S3 (4M Flash 2M PSRAM)",
  "upload": {
    "arduino": {
      "flash_extra_images": [
        [
          "0x2d0000",
          "variants/adafruit_qtpy_esp32s3_n4r2/tinyuf2.bin"
        ]
      ]
    },
    "flash_size": "4MB",
    "maximum_ram_size": 327680,
    "maximum_size": 4194304,
    "use_1200bps_touch": true,
    "wait_for_upload_port": true,
    "require_upload_port": true,
    "speed": 460800
  },
  "url": "https://www.adafruit.com/product/5700",
  "vendor": "Adafruit"
}
  1. Set the platformio.ini as
[env:adafruit_qtpy_esp32s3_n4r2]
platform = espressif32
board = adafruit_qtpy_esp32s3_n4r2
framework = arduino
  1. Set src/main.cpp as
#include <Arduino.h>

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

void loop() {
  Serial.printf("Total heap: %d\n", ESP.getHeapSize());
  Serial.printf("Free heap: %d\n", ESP.getFreeHeap());
  Serial.printf("Total PSRAM: %d\n", ESP.getPsramSize());
  Serial.printf("Free PSRAM: %d\n", ESP.getFreePsram());
  delay(1000);
}
  1. Upload + monitor and see what values you get in regards to PSRAM.

This worked great for me, thank you for the details!

Thanks for the confirmation, I’ve petitioned to add this board definition to the official repo per

Hello maxgerhardt - thanks a million for this. Works great.

The PR has been accepted, so you can equally use

[env:adafruit_qtpy_esp32s3_n4r2]
platform = https://github.com/platformio/platform-espressif32.git#2575a81db65ee07fce904d90861b13fb7817ea93
board = adafruit_qtpy_esp32s3_n4r2
framework = arduino

while deleting the old boards/ folder. This should be included in the next stable version.