mrcodetastic / ESP32-HUB75-MatrixPanel-DMA

An Adafruit GFX Compatible Library for the ESP32, ESP32-S2, ESP32-S3 to drive HUB75 LED matrix panels using DMA for high refresh rates. Supports panel chaining.
MIT License
975 stars 215 forks source link

After 'pio pkg update' my 4 chained panels now just flicker #544

Closed jdeltoft closed 11 months ago

jdeltoft commented 11 months ago

Hi, today I got back to a project I wanted to create with this project so I started working on my 4 panel (each 64x64) chain and everything was going well all day. The repo was several months old, btw.

I ran into an issue trying to also have the esp32 download a text file locally over wifi, which led me to an issue (https://github.com/espressif/arduino-esp32/issues/6129) which made me try my first ever pio pkg update

This is the log of that. Now I went from 4 beautifully working panels to just random flicker, which based on the error I think makes sense because it ran out of memory (RAM) for the buffers.

Did I just run out of memory size and I need to optimize my code? I can try that but was wondering if the latest versions of things are just that much larger or maybe I need to configure something now that I updated?

[  1243][E][ESP32-HUB75-MatrixPanel-I2S-DMA.cpp:58] allocateDMAmemory(): [I2S-DMA] CRITICAL ERROR: Not enough memory for requested colour depth! Please reduce pixel_color_depth_bits value.

[  1249][E][ESP32-HUB75-MatrixPanel-I2S-DMA.cpp:59] allocateDMAmemory(): [I2S-DMA] Could not allocate rowBitStruct 27!.

[  4107][E][WiFiClient.cpp:67] fillBuffer(): Not enough memory to allocate buffer
[  4107][E][WiFiClient.cpp:467] read(): fail on fd 48, errno: 11, "No more processes"
Error code: -7
[Disconnected]

Here is the upgrade as it ran also:

Justins:Led jeltoft$ pio pkg update
Resolving esp32 dependencies...
Platform Manager: Updating espressif32 @ 6.3.2
Platform Manager: Removing espressif32 @ 6.3.2
Platform Manager: espressif32@6.3.2 has been removed!
Platform Manager: Installing platformio/espressif32 @ 6.4.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Platform Manager: espressif32@6.4.0 has been installed!
Library Manager: Updating Adafruit BusIO @ 1.14.1
Library Manager: Removing Adafruit BusIO @ 1.14.1
Library Manager: Adafruit BusIO@1.14.1 has been removed!
Library Manager: Installing adafruit/Adafruit BusIO @ 1.14.5
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Library Manager: Adafruit BusIO@1.14.5 has been installed!
Library Manager: Updating Adafruit GFX Library @ 1.11.7
Library Manager: Removing Adafruit GFX Library @ 1.11.7
Library Manager: Adafruit GFX Library@1.11.7 has been removed!
Library Manager: Installing adafruit/Adafruit GFX Library @ 1.11.9
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Library Manager: Adafruit GFX Library@1.11.9 has been installed!
Library Manager: Resolving dependencies...
Library Manager: Updating ESP32 HUB75 LED MATRIX PANEL DMA Display @ 3.0.9+sha.3d7c2df
git version 2.43.0
remote: Enumerating objects: 2857, done.
remote: Counting objects: 100% (2857/2857), done.
remote: Compressing objects: 100% (1002/1002), done.
remote: Total 2778 (delta 1803), reused 2665 (delta 1718), pack-reused 0
Receiving objects: 100% (2778/2778), 4.50 MiB | 3.11 MiB/s, done.
Resolving deltas: 100% (1803/1803), completed with 60 local objects.
From https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA
   3d7c2df..61960e1  master     -> origin/master
 * [new tag]         1.0.2      -> 1.0.2
 * [new tag]         1.1.0      -> 1.1.0
 * [new tag]         1.2.2      -> 1.2.2
 * [new tag]         1.2.4      -> 1.2.4
 * [new tag]         2.0.0      -> 2.0.0
 * [new tag]         2.0.6      -> 2.0.6
 * [new tag]         2.0.7      -> 2.0.7
 * [new tag]         3.0.5      -> 3.0.5
Updating 3d7c2df..61960e1
Fast-forward
 .github/workflows/{esp-idf_with-gfx.yml => esp-idf-5.1.2_with-gfx.yml}       | 14 +++++++-------
 .github/workflows/{esp-idf_without-gfx.yml => esp-idf-5.1.2_without-gfx.yml} | 10 +++++-----
 .github/workflows/{pio_build.yml => pio_arduino_build.yml}                   | 11 ++++++-----
 README.md                                                                    | 31 ++++++++++++++-----------------
 src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp                                      |  8 +++++---
 src/ESP32-HUB75-MatrixPanel-I2S-DMA.h                                        | 17 ++++++++++-------
 src/ESP32-HUB75-MatrixPanel-leddrivers.cpp                                   |  3 ++-
 src/ESP32-VirtualMatrixPanel-I2S-DMA.h                                       |  4 ++--
 src/platforms/esp32/esp32_i2s_parallel_dma.cpp                               | 36 ++++++++++++++++++++++++------------
 src/platforms/esp32/esp32_i2s_parallel_dma.hpp                               | 11 ++++++++++-
 src/platforms/esp32s3/gdma_lcd_parallel16.cpp                                |  9 +++++----
 src/platforms/esp32s3/gdma_lcd_parallel16.hpp                                |  2 ++
 src/platforms/platform_detect.hpp                                            |  4 ++--
 13 files changed, 94 insertions(+), 66 deletions(-)
 rename .github/workflows/{esp-idf_with-gfx.yml => esp-idf-5.1.2_with-gfx.yml} (82%)
 rename .github/workflows/{esp-idf_without-gfx.yml => esp-idf-5.1.2_without-gfx.yml} (74%)
 rename .github/workflows/{pio_build.yml => pio_arduino_build.yml} (86%)
Resolving esp32idf dependencies...
Already up-to-date.
Justins:Led jeltoft$ pio run
Processing esp32 (framework: arduino; platform: espressif32; board: wemos_d1_mini32)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/framework-arduinoespressif32 @ ~3.20011.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: framework-arduinoespressif32@3.20011.230801 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (6.4.0) > WEMOS D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20011.230801 (2.0.11) 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 38 compatible libraries
Scanning dependencies...
Dependency Graph
|-- FastLED @ 3.6.0
|-- Wire @ 2.0.0
|-- Adafruit BusIO @ 1.14.5
|-- Adafruit GFX Library @ 1.11.9
|-- ESP32 HUB75 LED MATRIX PANEL DMA Display @ 3.0.9+sha.61960e1
|-- PubSubClient @ 2.8.0
|-- HTTPClient @ 2.0.0
|-- WiFi @ 2.0.0
Building in release mode
Compiling .pio/build/esp32/lib4d4/FastLED/FastLED.cpp.o
Compiling .pio/build/esp32/lib4d4/FastLED/bitswap.cpp.o
Compiling .pio/build/esp32/lib4d4/FastLED/colorpalettes.cpp.o
Compiling .pio/build/esp32/lib4d4/FastLED/colorutils.cpp.o
Compiling .pio/build/esp32/lib4d4/FastLED/hsv2rgb.cpp.o
Compiling .pio/build/esp32/lib4d4/FastLED/lib8tion.cpp.o
Compiling .pio/build/esp32/lib4d4/FastLED/noise.cpp.o
Compiling .pio/build/esp32/lib4d4/FastLED/platforms.cpp.o
Compiling .pio/build/esp32/lib4d4/FastLED/platforms/esp/32/clockless_rmt_esp32.cpp.o
Compiling .pio/build/esp32/lib4d4/FastLED/power_mgt.cpp.o
Compiling .pio/build/esp32/lib4d4/FastLED/wiring.cpp.o
Compiling .pio/build/esp32/src/main.cpp.o
Compiling .pio/build/esp32/src/stoplite.cpp.o
Compiling .pio/build/esp32/src/util.cpp.o
Building .pio/build/esp32/bootloader.bin
esptool.py v4.5.1
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Compiling .pio/build/esp32/lib9b3/SPI/SPI.cpp.o
Compiling .pio/build/esp32/lib88a/Wire/Wire.cpp.o
Compiling .pio/build/esp32/lib7a8/Adafruit BusIO/Adafruit_BusIO_Register.cpp.o
Compiling .pio/build/esp32/lib7a8/Adafruit BusIO/Adafruit_I2CDevice.cpp.o
Compiling .pio/build/esp32/lib7a8/Adafruit BusIO/Adafruit_SPIDevice.cpp.o
In file included from .pio/libdeps/esp32/FastLED/src/FastLED.h:75,
                 from src/main.h:2,
                 from src/stoplite.cpp:7:
.pio/libdeps/esp32/FastLED/src/fastspi.h:157:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output
 #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling .pio/build/esp32/liba09/Adafruit GFX Library/Adafruit_GFX.cpp.o
Compiling .pio/build/esp32/liba09/Adafruit GFX Library/Adafruit_GrayOLED.cpp.o
Compiling .pio/build/esp32/liba09/Adafruit GFX Library/Adafruit_SPITFT.cpp.o
Compiling .pio/build/esp32/liba09/Adafruit GFX Library/glcdfont.c.o
In file included from .pio/libdeps/esp32/FastLED/src/FastLED.h:75,
                 from src/main.h:2,
                 from src/util.cpp:8:
.pio/libdeps/esp32/FastLED/src/fastspi.h:157:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output
 #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from .pio/libdeps/esp32/FastLED/src/FastLED.h:75,
                 from src/main.cpp:11:
.pio/libdeps/esp32/FastLED/src/fastspi.h:157:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output
 #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling .pio/build/esp32/libe10/ESP32 HUB75 LED MATRIX PANEL DMA Display/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp.o
Compiling .pio/build/esp32/libe10/ESP32 HUB75 LED MATRIX PANEL DMA Display/ESP32-HUB75-MatrixPanel-leddrivers.cpp.o
Archiving .pio/build/esp32/lib9b3/libSPI.a
Compiling .pio/build/esp32/libe10/ESP32 HUB75 LED MATRIX PANEL DMA Display/platforms/esp32/esp32_i2s_parallel_dma.cpp.o
Compiling .pio/build/esp32/libe10/ESP32 HUB75 LED MATRIX PANEL DMA Display/platforms/esp32s3/gdma_lcd_parallel16.cpp.o
Indexing .pio/build/esp32/lib9b3/libSPI.a
Compiling .pio/build/esp32/libcd9/PubSubClient/PubSubClient.cpp.o
Compiling .pio/build/esp32/lib9d4/WiFi/WiFi.cpp.o
Archiving .pio/build/esp32/lib7a8/libAdafruit BusIO.a
Archiving .pio/build/esp32/lib88a/libWire.a
Indexing .pio/build/esp32/lib7a8/libAdafruit BusIO.a
Indexing .pio/build/esp32/lib88a/libWire.a
Compiling .pio/build/esp32/lib9d4/WiFi/WiFiAP.cpp.o
.pio/libdeps/esp32/ESP32 HUB75 LED MATRIX PANEL DMA Display/src/platforms/esp32/esp32_i2s_parallel_dma.cpp:30:19: note: #pragma message: Compiling for original ESP32 (released 2016)
   #pragma message "Compiling for original ESP32 (released 2016)"
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling .pio/build/esp32/lib9d4/WiFi/WiFiClient.cpp.o
Compiling .pio/build/esp32/lib9d4/WiFi/WiFiGeneric.cpp.o
Compiling .pio/build/esp32/lib9d4/WiFi/WiFiMulti.cpp.o
Compiling .pio/build/esp32/lib9d4/WiFi/WiFiSTA.cpp.o
Compiling .pio/build/esp32/lib9d4/WiFi/WiFiScan.cpp.o
Compiling .pio/build/esp32/lib9d4/WiFi/WiFiServer.cpp.o
Compiling .pio/build/esp32/lib9d4/WiFi/WiFiUdp.cpp.o
Compiling .pio/build/esp32/lib2e6/WiFiClientSecure/WiFiClientSecure.cpp.o
Compiling .pio/build/esp32/lib2e6/WiFiClientSecure/esp_crt_bundle.c.o
Archiving .pio/build/esp32/liba09/libAdafruit GFX Library.a
Compiling .pio/build/esp32/lib2e6/WiFiClientSecure/ssl_client.cpp.o
Indexing .pio/build/esp32/liba09/libAdafruit GFX Library.a
Compiling .pio/build/esp32/lib9d8/HTTPClient/HTTPClient.cpp.o
Archiving .pio/build/esp32/libcd9/libPubSubClient.a
Archiving .pio/build/esp32/libe10/libESP32 HUB75 LED MATRIX PANEL DMA Display.a
Indexing .pio/build/esp32/libcd9/libPubSubClient.a
Indexing .pio/build/esp32/libe10/libESP32 HUB75 LED MATRIX PANEL DMA Display.a
Compiling .pio/build/esp32/FrameworkArduino/Esp.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/FirmwareMSC.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/HWCDC.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/IPv6Address.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/MD5Builder.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/Print.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/StreamString.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/USB.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/USBCDC.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/USBMSC.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/WMath.cpp.o
Archiving .pio/build/esp32/lib9d4/libWiFi.a
Compiling .pio/build/esp32/FrameworkArduino/WString.cpp.o
Indexing .pio/build/esp32/lib9d4/libWiFi.a
Compiling .pio/build/esp32/FrameworkArduino/base64.cpp.o
Archiving .pio/build/esp32/lib2e6/libWiFiClientSecure.a
Compiling .pio/build/esp32/FrameworkArduino/cbuf.cpp.o
Indexing .pio/build/esp32/lib2e6/libWiFiClientSecure.a
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-adc.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-bt.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-cpu.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-dac.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-gpio.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-i2c-slave.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-i2c.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-ledc.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-matrix.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-misc.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-psram.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-rgb-led.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-rmt.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-sigmadelta.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-spi.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-time.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-timer.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-tinyusb.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-touch.c.o
Compiling .pio/build/esp32/FrameworkArduino/esp32-hal-uart.c.o
Compiling .pio/build/esp32/FrameworkArduino/firmware_msc_fat.c.o
Compiling .pio/build/esp32/FrameworkArduino/libb64/cdecode.c.o
Archiving .pio/build/esp32/lib9d8/libHTTPClient.a
Compiling .pio/build/esp32/FrameworkArduino/libb64/cencode.c.o
Indexing .pio/build/esp32/lib9d8/libHTTPClient.a
Compiling .pio/build/esp32/FrameworkArduino/main.cpp.o
Compiling .pio/build/esp32/FrameworkArduino/stdlib_noniso.c.o
Compiling .pio/build/esp32/FrameworkArduino/wiring_pulse.c.o
Compiling .pio/build/esp32/FrameworkArduino/wiring_shift.c.o
Archiving .pio/build/esp32/libFrameworkArduino.a
Indexing .pio/build/esp32/libFrameworkArduino.a
Linking .pio/build/esp32/firmware.elf
Retrieving maximum program size .pio/build/esp32/firmware.elf
Checking size .pio/build/esp32/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  29.3% (used 95908 bytes from 327680 bytes)
Flash: [=======   ]  74.6% (used 977257 bytes from 1310720 bytes)
Building .pio/build/esp32/firmware.bin
esptool.py v4.5.1
Creating esp32 image...
Merged 25 ELF sections
Successfully created esp32 image.
======================================================================================== [SUCCESS] Took 53.35 seconds ========================================================================================

Environment    Status    Duration
-------------  --------  ------------
esp32          SUCCESS   00:00:53.352
========================================================================================= 1 succeeded in 00:00:53.352 =========================================================================================
Justin:Led jeltoft$ pio run -t upload
mrcodetastic commented 11 months ago

What version of the library did you use before? If the old library worked then I'd suggest sticking with that version.

I don't believe memory consumption has grown much over the versions. Most likely the espressif IDF libraries have overall.

jdeltoft commented 11 months ago

Ok, just tried with

-platform = espressif32 +platform = espressif32@6.3.2

to go back per the log I captured above, and it's working again. Sorry to bug you, and thanks so much for this great library!!!

Here is my album art so far...

image