Customer:
I’m working on an open Arduino project to add a lot of user-friendly features to the Inkplate 10. When I compile the examples it looks like PSRAM is not enabled. Is this true?
If PSRAM is not enabled, how can I enable it?
Originally submitted via email support on 18 February 2025. Migrated to the forum for community visibility.
Soldered Support:
You can enable PSRAM in code. Just make sure you’re using a partition scheme which supports it.
Here is a code snippet that was tested on Inkplate to check functionality of PSRAM:
int n_elements = 1000;
unsigned char * acc_data_all;
void setup() {
delay(3000);
Serial.begin(115200);
acc_data_all = (unsigned char *) ps_malloc (n_elements * sizeof (unsigned char));
if (psramInit()) {
Serial.println("\nPSRAM is correctly initialized");
}
}
void loop() {
Serial.println( );
= 'a';
delay(5000);
}
The compiler will recognize automatically if your sketch uses PSRAM or not.
Attachment omitted in migration: image.png
Customer:
From what I understand, if PSRAM isn’t configured in the ESP-Arduino Board definition layer, the basic memory allocation features won’t use this memory space, so standard libraries would need to be modified to use the PSRAM calls instead of standard calls like “new” and “malloc”.
Can you check if standard calls memory allocation calls succeed when allocating, say, 1024KB?
Attachment omitted in migration: image.png
Soldered Support:
PSRAM seems to be configured. Here’s test output for 1024KB, tested on Inkplate 6 PLUS (but it will be the same on all Inkplates).
I used this sketch:
// Allocate 1MB (1024 * 1024 bytes) of PSRAM
const size_t n_elements = 1024 * 1024;
unsigned char *acc_data_all = NULL;
void setup() {
Serial.begin(115200);
delay(3000); // Give time for the serial monitor to open
// Initialize PSRAM first
if (psramInit()) {
Serial.println("PSRAM is correctly initialized");
}
// Allocate 1MB from PSRAM
acc_data_all = (unsigned char *)ps_malloc(n_elements * sizeof(unsigned char));
if (acc_data_all == NULL) {
Serial.println("PSRAM allocation failed! Halting.");
while (true); // Halt if allocation fails
}
Serial.println("Allocated 1MB PSRAM successfully");
}
void loop() {
// Write a repeating pattern into the allocated PSRAM
Serial.println("Writing data to PSRAM...");
for (size_t i = 0; i < n_elements; i++) {
= (unsigned char)(i % 256); // Pattern: 0, 1, 2, ... 255, then repeat
}
Serial.println("Data written!");
// Read back data from different parts to verify it worked:
// First 10 bytes:
Serial.print("First 10 bytes: ");
for (size_t i = 0; i < 10; i++) {
Serial.print( , DEC);
Serial.print(" ");
}
Serial.println();
// 10 bytes from the middle:
size_t mid = n_elements / 2;
Serial.print("Middle 10 bytes: ");
for (size_t i = mid; i < mid + 10; i++) {
Serial.print( , DEC);
Serial.print(" ");
}
Serial.println();
// Last 10 bytes:
Serial.print("Last 10 bytes: ");
for (size_t i = n_elements - 10; i < n_elements; i++) {
Serial.print( , DEC);
Serial.print(" ");
}
Serial.println();
Serial.println("PSRAM test complete.");
// Stop further execution so the test runs only once
while (true);
}
PSRAM works on the ESP32 Inkplate board definitions. Try this code snippet and see if it outputs the same results. I’m using the Huge APP partition scheme.
Attachment omitted in migration: image.png