查看原文:https://blog.csdn.net/JackieCoo/article/details/128571623
我们只需要全局定义BOARD_HAS_PSRAM即可开启PSRAM。
打开platformio.ini文件,内容应该是这样的。

在最后一行添加下面的命令:
build_flags = -D BOARD_HAS_PSRAM

这时候简单在main文件写一个代码看看PSRAM有没有正常识别。
#include <Arduino.h>
#include <esp_heap_caps.h>
void setup() {
Serial.begin(115200);
Serial.printf("Deafult free size: %d\n", heap_caps_get_free_size(MALLOC_CAP_DEFAULT));
Serial.printf("PSRAM free size: %d\n", heap_caps_get_free_size(MALLOC_CAP_SPIRAM));
}
void loop() {
// put your main code here, to run repeatedly:
}
在串口助手可以看到打印的信息。

PSRAM的可用大小为4192139B≈4MB,所以我手上这个模块的PSRAM为4MB的版本。

Comments NOTHING