Background layer failure

Hi friends, I’m still a beginner using smartmatrix, I have 2 64x64 panels with esp32, for the first time I tried the multipletextlayers and multipletextlayersGFX examples, and it worked fine, but when I tried to run featureDemo it didn’t work for 64x128 configuration, it only worked for 64x64 configuration, and I also lowered the refreshdepth to 24. After I found out, it turned out that the problem was in the background layer, and when I tried to write code using the background layer it always failed to work with the 64x128 panel configuration (it didn’t display anything). is there a solution?

Very sorry, but your post got caught up in a spam filter. If you’re still having issues with this, can you please post your code so we can try to troubleshoot?

Hi @Louis …thanks for your reply, the first time i saw the background layer failure was when i tried the demo feature example, when i used the kMatrixWidth = 64 configuration the code could run fine

but when i changed the configuration to kMatrixWidth = 128; the code could not run, and did not display anything

then i wrote a simple code and ran it in 64x64 configuration

#include <MatrixHardware_ESP32_V0.h>                // This file contains multiple ESP32 hardware configurations, edit the file to define GPIOPINOUT (or add #define GPIOPINOUT with a hardcoded number before this #include)
#include <SmartMatrix.h>

#define COLOR_DEPTH 24                  // Choose the color depth used for storing pixels in the layers: 24 or 48 (24 is good for most sketches - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24)
const uint16_t kMatrixWidth = 128;       // Set to the width of your display, must be a multiple of 8
const uint16_t kMatrixHeight = 64;      // Set to the height of your display
const uint8_t kRefreshDepth = 24;       // Tradeoff of color quality vs refresh rate, max brightness, and RAM usage.  36 is typically good, drop down to 24 if you need to.  On Teensy, multiples of 3, up to 48: 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48.  On ESP32: 24, 36, 48
const uint8_t kDmaBufferRows = 4;       // known working: 2-4, use 2 to save RAM, more to keep from dropping frames and automatically lowering refresh rate.  (This isn't used on ESP32, leave as default)
const uint8_t kPanelType = SM_PANELTYPE_HUB75_64ROW_MOD32SCAN;   // Choose the configuration that matches your panels.  See more details in MatrixCommonHub75.h and the docs: https://github.com/pixelmatix/SmartMatrix/wiki
const uint32_t kMatrixOptions = (SM_HUB75_OPTIONS_NONE);        // see docs for options: https://github.com/pixelmatix/SmartMatrix/wiki
const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE);
const uint8_t kScrollingLayerOptions = (SM_SCROLLING_OPTIONS_NONE);
const uint8_t kIndexedLayerOptions = (SM_INDEXED_OPTIONS_NONE);

SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);
SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions);
SMARTMATRIX_ALLOCATE_INDEXED_LAYER(indexedLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kIndexedLayerOptions);


//SMARTMATRIX_ALLOCATE_INDEXED_LAYER(indexedLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kIndexedLayerOptions);
const int defaultBrightness = (100*255)/100;        // full (100%) brightness
//const int defaultBrightness = (15*255)/100;       // dim: 15% brightness
const int defaultScrollOffset = 6;
const rgb24 test = {0x40,0,0xff};
void setup() {
  matrix.addLayer(&backgroundLayer); 
  matrix.addLayer(&indexedLayer); 
  matrix.begin();
  matrix.setBrightness((30*255)/100);
  indexedLayer.enableColorCorrection(true); 
}


void loop() {
  indexedLayer.setFont(gohufont11b);
  indexedLayer.setIndexedColor(1,test);//membuat warna pada index layer
  indexedLayer.fillScreen(0);
  indexedLayer.drawString(0, 0,10,"12:34");
  indexedLayer.swapBuffers(); 
}

but the code doesn’t display anything when I change the panel width to 128, and when I delete the background layer and leave only the indexed layer, the code runs fine on the 128 panel width configuration, so I think there is something wrong with the background layer on ESP32. Is there a solution?

and all can run well on teensy 4.1

solved, must use esp32 v 1.0.6, and can’t use newer versions, using newer esp32 will likely have problems with background layers with 64x128 configuration

Johan, thanks for this post. I have never been able to get 2x 64x64 LED modules to work in the past. The final solution for you was using 1.0.6 only? You didn’t have to delete the background layer?

@MStirlingC Yes, my final solution was to use arduino 1.8.19 and downgrade esp32 to version 1.0.6, then reinstall smartmatrix library, and after I did that the code can run fine on 64 x 128 configuration.

1 Like

Thank you, @JOHAN_CANDRA!