Louis,
Thanks very much for your response.
In the past we’ve tried using the matrix.begin(minMemoryToSave) to set aside heap for other things but have seen problems introduced with SmartMatrix performance (I don’t recall the details, it’s been many months.) I could try this but it seems like we can’t make a huge dent in the ~60k deficit created by the Wifi allocation. (I added reporting of free heap before and after the Wifi.begin() in my working demo sketch and saw a 58k drop.)
Is it possible to use PSRAM for all the SmartMatrix buffers and layers? On my ESP32 WROVER I’ve got about 3MB of PSRAM available.
As far as the “free heap” I’m referencing, it’s what’s reported by the call Serial.println(ESP.getFreeHeap());
After the SmartMatrix allocations in my main sketch, this number is reported as 105k just after I mount LittleFS and then it drops to 87k just after launching NimBLE.
Here’s the output of my matrix.begin(). (This occurs before the LittleFS and NimBLE allocations.) The last free heap report here shows ~107k.
16:47:58.574 → Starting SmartMatrix Mallocs
16:47:58.812 → Heap/32-bit Memory Available: 181728 bytes total, 113792 bytes largest free block
16:47:58.812 → 8-bit/DMA Memory Available : 142564 bytes total, 113792 bytes largest free block
16:47:58.812 → Total PSRAM used: 0 bytes total, 4194252 PSRAM bytes free
16:47:58.812 → SmartMatrix Layers Allocated from Heap:
16:47:58.812 → Heap/32-bit Memory Available: 179716 bytes total, 113792 bytes largest free block
16:47:58.812 → Starting SmartMatrix DMA Mallocs
16:47:58.812 → sizeof framestruct: 00008000
16:47:58.812 → DMA Memory Available before ptr1 alloc: 74568 bytes total, 48224 bytes largest free block
16:47:58.812 → matrixUpdateFrames[0] pointer: 3FFE4374
16:47:58.812 → DMA Memory Available before ptr2 alloc: 74568 bytes total, 48224 bytes largest free block
16:47:58.812 → matrixUpdateFrames[1] pointer: 3FFEC384
16:47:58.812 → Frame Structs Allocated from Heap:
16:47:58.812 → Heap/32-bit Memory Available: 113732 bytes total, 48224 bytes largest free block
16:47:58.812 → 8-bit/DMA Memory Available : 74568 bytes total, 48224 bytes largest free block
16:47:58.812 → Total PSRAM used: 24576 bytes total, 4169644 PSRAM bytes free
16:47:58.812 → Allocating refresh buffer:
16:47:58.812 → lsbMsbTransitionBit of 0 requires 49152 RAM, 48224 available, leaving -928 free:
16:47:58.812 → lsbMsbTransitionBit of 1 requires 24576 RAM, 48224 available, leaving 23648 free:
16:47:58.812 → Raised lsbMsbTransitionBit to 1/7 to fit in RAM
16:47:58.812 → lsbMsbTransitionBit of 1 gives 76 Hz refresh, 240 requested:
16:47:58.812 → lsbMsbTransitionBit of 2 gives 150 Hz refresh, 240 requested:
16:47:58.812 → lsbMsbTransitionBit of 3 gives 287 Hz refresh, 240 requested:
16:47:58.812 → Raised lsbMsbTransitionBit to 3/7 to meet minimum refresh rate
16:47:58.812 → Descriptors for lsbMsbTransitionBit 3/7 with 16 rows require 6144 bytes of DMA RAM
16:47:58.812 → SmartMatrix Mallocs Complete
16:47:58.812 → Heap/32-bit Memory Available: 107556 bytes total, 48224 bytes largest free block
16:47:58.812 → 8-bit/DMA Memory Available : 68392 bytes total, 48224 bytes largest free block
16:47:58.812 → Total PSRAM used: 24576 bytes total, 4169644 PSRAM bytes free
16:47:58.812 → Setting up parallel I2S bus at I2S1
Thanks!
Rick