[SOLVED] Should an ESP32 be able to drive 8192 leds ? (128x64) / 4x(64x32)

Hello !

I am trying to use one ESP32 with 4 LED Panels. The panels are 64x32 p5 with a 1/8 scan.

I’ve finally done the wiring and finished up the mapping, but the resulting map doesn’t work.
I went and done the mapping again and this map was identical to the first one. I don’t think I’ve made any mistakes when doing to it. I have done this before and it’s the first map that isn’t working properly.

I’ve done the mapping with these:

const uint16_t kMatrixWidth = 512; // 128x64/16
const uint8_t kMatrixHeight = 16; // 1/8 scan
const uint8_t kPanelType = SMARTMATRIX_HUB75_16ROW_MOD8SCAN;
const uint8_t kRefreshDepth = 24;
const uint8_t kDmaBufferRows = 2;
const uint8_t kMatrixOptions = (SMARTMATRIX_OPTIONS_NONE);
const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE);

And this is the map that resulted :

const PanelMappingEntry panelMapP5_2727_128x64[] = {

buuut it does not work.

The last 16 rows behave strangely:

  • they are a whitish-greenish color;
  • they all flash up whenever 1 led from the first 16 top rows lights up;
  • through the flashes they also do the same thing as the first rows: so they go from left to right, from 0 to 127, the whole width.

So I basically have obtained two 16 rows identical behaviors with the sole difference that one of them flashes and doesn’t have the right colors.

MODE_MAP_TESTING actually goes from left to right 128 LEDs, but it goes only the first 16 rows from top to bottom all the while the last 16 rows are flashing. Then, after a while, it continues from row 16 until it “walks” the whole 128x64 display. The flashing never stops, and the last 16 rows leds still remain the wrong color.


Does this mean that it can’t be done ?

I have tried using the above mapping with one of my single panel projects and it got me the following errors:

Starting SmartMatrix Mallocs
Heap/32-bit Memory Available: 289788 bytes total, 113792 bytes largest free block
8-bit/DMA Memory Available  : 237340 bytes total, 113792 bytes largest free block
SmartMatrix Layers Allocated from Heap:
Heap/32-bit Memory Available: 239120 bytes total, 113792 bytes largest free block
Starting SmartMatrix DMA Mallocs
assertion "matrixUpdateFrames[1] != NULL" failed: file "lib/SmartMatrix-teensylc/src/SmartMatrixMultiplexedRefreshEsp32_Impl.h", line 195, function: static void SmartMatrix3RefreshMultiplexed<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::begin(uint32_t) [with int refreshDepth = 24; int matrixWidth = 128; int matrixHeight = 64; unsigned char panelType = 13u; unsigned char optionFlags = 0u; uint32_t = unsigned int]
abort() was called at PC 0x400eb657 on core 1

Backtrace: 0x4008c9ec:0x3ffb1bf0 0x4008cc1d:0x3ffb1c10 0x400eb657:0x3ffb1c30 0x400d49b2:0x3ffb1c60 0x400d4ed5:0x3ffb1d30 0x400d6451:0x3ffb1d60 0x400e5c2b:0x3ffb1fb0 0x400887fd:0x3ffb1fd0

Decoding stack results
0x400eb657: _svfiprintf_r at ../../../.././newlib/libc/stdio/vfprintf.c line 1192
0x400d49b2: _Unwind_Find_FDE at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libgcc/unwind-dw2-fde.c line 319
0x400d4ed5: esp_vfs_lseek at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/vfs/vfs.c line 430
0x400d6451: __d2b at ../../../.././newlib/libc/stdlib/mprec.c line 902
0x400e5c2b: _vfiprintf_r at ../../../.././newlib/libc/stdio/vfprintf.c line 1544
0x400887fd: vTaskPrioritySet at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/include/freertos/portable.h line 208

The changes that I have made were small.
I went from this:

#define kMatrixWidth  64
#define kMatrixHeight 32
const uint8_t kPanelType = SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN_P5_2727;

to this:

#define kMatrixWidth  128
#define kMatrixHeight 64
const uint8_t kPanelType = SMARTMATRIX_HUB75_64ROW_128COL_MOD8SCAN_P5_2727;

and that’s it.

These are all the include in the respective project. It is pretty big and uses some resources

#include <Arduino.h>
#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#include <SPIFFS.h>
#include <HTTPClient.h>
#include <Adafruit_GFX.h>
#include <SmartMatrix_GFX.h>
#include <SmartMatrix3.h>
#include <Fonts/FreeSansBold18pt7b.h>
#include <Fonts/FreeSans9pt7b.h>
#include <Update.h>
#include <esp_wifi.h>

The weird thing is that if I keep the initial values:

#define kMatrixWidth  64
#define kMatrixHeight 32
const uint8_t kPanelType = SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN_P5_2727;

I get the same image across all of the 4 panels.

So why can it push the same image on 4 different displays, but can’t push one image on a form factor made up from those 4 panels ?

In one case SmartMatrix Library is allocating enough RAM to refresh 128x64 pixels, in the other case it’s allocating RAM for 64x32 pixels. It’s likely running out of RAM in the first case

1 Like

You are probably right. At least this is what I’ve assumed and by looking at my project there are quite a few things that eat up RAM. This was a good test. I needed to know what was the limit of the ESP32.

I will be switching to a Raspberry Pi 4.

Thank you !

Hi @GeorgeFlorian yes, what you hit is totally an out of memory error on ESP32. I hit the same thing added more debugging to make it clear that you are running out of RAM.
Actually you are not quite running out of RAM, but ESP32 RAM is segmented, so SmartMatrix can’t get it all, sadly.
Apparently an ESP32 with PSRam could offload some of your RAM needs while leaving DMA RAM for SmartMatrix, but with teensy 4 that just came out with 512KB of RAM, that might be your best bet.

1 Like

wells, turns out teensy 4.0 will not work with smartmatrix or the existing shield, so your best bet may be psram on ESP32

Great info ! Thank you !

For bigger displays / more panels I’ve switched to using a Raspberry Pi 4 with the following library: https://github.com/hzeller/rpi-rgb-led-matrix

But why won’t the teensy 4.0 work ? Wasn’t the library made first for the teensy ?

it’s using assembly and processor specific features that are not compatible on teensy 4.0