leave 32 kB PSRAM to the SDK; the adafruit qty s3 goes into a reboot-loop with all PSRAM allocated

This commit is contained in:
folkert van heusden 2024-05-05 19:33:24 +02:00
parent 1f7474cbde
commit 37f320c353
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1

View file

@ -289,10 +289,14 @@ void setup() {
Serial.println(ESP.getFreeHeap());
if (psramInit()) {
constexpr const uint32_t leave_unallocated = 32768;
uint32_t free_psram = ESP.getFreePsram();
n_pages = min(free_psram / 8192, uint32_t(256)); // start size is 2 MB max (with 1 MB, UNIX 7 behaves strangely)
Serial.printf("Free PSRAM: %d decimal bytes (or %d pages (see 'ramsize' in the debugger))", free_psram, n_pages);
Serial.println(F(""));
if (free_psram > leave_unallocated) {
n_pages = min((free_psram - leave_unallocated) / 8192, uint32_t(256)); // start size is 2 MB max (with 1 MB, UNIX 7 behaves strangely)
Serial.printf("Free PSRAM: %d decimal bytes (or %d pages (see 'ramsize' in the debugger))", free_psram, n_pages);
Serial.println(F(""));
}
}
#endif