Weird panel layout

I need a little help for setting up yet another panel I got my hands on :slight_smile:
I used instructions from MultiRowRefreshMapping example and got one panel working with these settings:

   {0,  8, -8},
   {0, 24, -8},
   {0, 40, -8},
   {0, 56, -8},
   {4,  9,  8},
   {4, 25,  8},
   {4, 41,  8},
   {4, 57,  7},
   {4,  0,  1},
   {0,  0,  0}   // last entry is all zeros

This works perfectly while only one panel is used: Video

But when I connect 4 panels (2x2), starting with 4th row (counting from 0), pixel appears in the wrong place. You can check that on the video nr 2.

Looks like that one pixel that they put separately cause the problem. Is there something I can do about it?

PS. I’m still using SmartMatrix v3 and branch for esp32.

It seems unlikely that they put one pixel separate from the others. There could be a problem with the clock polarity or not having level shifters or something else that’s compensated for one panel with a bad map, but doesn’t scale past one panel

Wow… that doesn’t sound good :frowning:
Any ideas how I can fix this?

Try inverting the clock with this option:
SMARTMATRIX_OPTIONS_ESP32_INVERT_CLK

Try adding 5v level shifters for the signals if you haven’t already

Try lowering the clock speed:

I update SmartMatrix to v4 and now Test in multirowRefreshMapping shows pixel in correct order!
But, when I connect all 4 panels, and try turning on a pixel in each position (like in refresh mapping sketch), many pixels in two rows turn on. Any ideas what it may be and what to try to fix it?

Turning on pixel by pixel works (code below). But when I put the same settings into FeatureDemo, text is not visible: test - YouTube

#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 = 64;       // Set to the width of your display, must be a multiple of 8
const uint16_t kMatrixHeight = 32;      // Set to the height of your display
const uint8_t kRefreshDepth = 36;       // 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 = SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11;   // 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_BOTTOM_TO_TOP_STACKING);// (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);

void setup() {
  matrix.addLayer(&backgroundLayer); 
  matrix.begin();
  matrix.setBrightness(128);
}

void loop() {
  for(int j=0; j<kMatrixHeight; j++) {    
        for(int i=0; i<kMatrixWidth; i++) {
            backgroundLayer.drawPixel(i,j,{0xff, 0xff, 0xff});
            backgroundLayer.swapBuffers();   
            delay(50);
            backgroundLayer.fillScreen({0,0,0});
        }
    }
}

If I add SM_HUB75_OPTIONS_ESP32_INVERT_CLK text looks more like a text, but is still not readable, pixels are not in theirs places.

It could be an issue with the rest of your SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11 defines, can you share the other changes you made to the library? MatrixCommonHub75.h is the most important

Also, when you say it works, did you watch the entire panel being scanned? It could work for the first couple rows and then break

Yes, of course:

MatrixCommonHub75.h:

/*
 * SmartMatrix Library - Common Definitions for Driving HUB75 Panels
 *
 * Copyright (c) 2020 Louis Beaudoin (Pixelmatix)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef SmartMatrixCommonHUB75_h
#define SmartMatrixCommonHUB75_h

#define DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS       32
#define HUB75_RGB_COLOR_CHANNELS_IN_PARALLEL        2

#define SM_PANELTYPE_HUB75_32ROW_MOD16SCAN          0
#define SM_PANELTYPE_HUB75_16ROW_MOD8SCAN           1
#define SM_PANELTYPE_HUB75_64ROW_MOD32SCAN          2
#define SM_PANELTYPE_HUB75_4ROW_MOD2SCAN            3
#define SM_PANELTYPE_HUB75_8ROW_MOD4SCAN            4
#define SM_PANELTYPE_HUB75_16ROW_32COL_MOD2SCAN     5
#define SM_PANELTYPE_HUB12_16ROW_32COL_MOD4SCAN     6   // HUB12 panels have limited support, the height needs to be doubled to account for the fact they only use one RGB channel, though SmartMatrix Library will fill the second channel
#define SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN     7
#define SM_PANELTYPE_HUB75_2ROW_MOD1SCAN            8
#define SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN_V2  9
#define SM_PANELTYPE_HUB75_32ROW_64COL_MOD8SCAN     10
#define SM_PANELTYPE_HUB75_64ROW_64COL_MOD16SCAN    11
#define SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN_V11  21

#define SMARTMATRIX_HUB75_32ROW_MOD16SCAN           SM_PANELTYPE_HUB75_32ROW_MOD16SCAN        
#define SMARTMATRIX_HUB75_16ROW_MOD8SCAN            SM_PANELTYPE_HUB75_16ROW_MOD8SCAN         
#define SMARTMATRIX_HUB75_64ROW_MOD32SCAN           SM_PANELTYPE_HUB75_64ROW_MOD32SCAN        
#define SMARTMATRIX_HUB75_4ROW_MOD2SCAN             SM_PANELTYPE_HUB75_4ROW_MOD2SCAN          
#define SMARTMATRIX_HUB75_8ROW_MOD4SCAN             SM_PANELTYPE_HUB75_8ROW_MOD4SCAN          
#define SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN      SM_PANELTYPE_HUB75_16ROW_32COL_MOD2SCAN   
#define SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN      SM_PANELTYPE_HUB12_16ROW_32COL_MOD4SCAN   
#define SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN      SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN   
#define SMARTMATRIX_HUB75_2ROW_MOD1SCAN             SM_PANELTYPE_HUB75_2ROW_MOD1SCAN          
#define SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2   SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN_V2
#define SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN      SM_PANELTYPE_HUB75_32ROW_64COL_MOD8SCAN
#define SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN     SM_PANELTYPE_HUB75_64ROW_64COL_MOD16SCAN
#define SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11     SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN_V11

#define CONVERT_PANELTYPE_TO_MATRIXPANELHEIGHT(x)   ((x == SMARTMATRIX_HUB75_32ROW_MOD16SCAN ? 32 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN ? 64 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? 16 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN ? 16 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_4ROW_MOD2SCAN ? 4 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_8ROW_MOD4SCAN ? 8 : 0) | \
                                                    (x == SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN ? 16*2 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN ? 32 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN ? 16 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2 ? 16 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_2ROW_MOD1SCAN ? 2 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11 ? 16 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? 64 : 0))

#define CONVERT_PANELTYPE_TO_MATRIXROWPAIROFFSET(x) ((x == SMARTMATRIX_HUB75_32ROW_MOD16SCAN ? 16 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN ? 32 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? 8 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN ? 8 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_4ROW_MOD2SCAN ? 2 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_8ROW_MOD4SCAN ? 4 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN ? 16 : 0) | \
                                                    (x == SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN ? 8*2 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN ? 8 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2 ? 8 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_2ROW_MOD1SCAN ? 1 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11 ? 8 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? 32 : 0))

#define CONVERT_PANELTYPE_TO_MATRIXSCANMOD(x)  ((x == SMARTMATRIX_HUB75_32ROW_MOD16SCAN ? 16 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN ? 16 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? 8 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN ? 2 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_4ROW_MOD2SCAN ? 2 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_8ROW_MOD4SCAN ? 4 : 0) | \
                                                    (x == SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN ? 4 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN ? 4 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2 ? 4 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN ? 8 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_2ROW_MOD1SCAN ? 1 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11 ? 4 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? 32 : 0))

#define CONVERT_PANELTYPE_TO_MATRIXPANELWIDTH(x)  ((x == SMARTMATRIX_HUB75_32ROW_MOD16SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0) | \
                                                    (x == SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN ? 64 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN ? 32 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_4ROW_MOD2SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0) | \
                                                    (x == SMARTMATRIX_HUB75_8ROW_MOD4SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0) | \
                                                    (x == SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN ? 32 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN ? 64 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN ? 32 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2 ? 32 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11 ? 32 : 0) | \
                                                    (x == SMARTMATRIX_HUB75_2ROW_MOD1SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0) | \
                                                    (x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0))

#define MATRIX_PANEL_HEIGHT (CONVERT_PANELTYPE_TO_MATRIXPANELHEIGHT(panelType))
#define MATRIX_STACK_HEIGHT (matrixHeight / MATRIX_PANEL_HEIGHT)

#define COLOR_CHANNELS_PER_PIXEL        3
#define LATCHES_PER_ROW (refreshDepth/COLOR_CHANNELS_PER_PIXEL)
#define COLOR_DEPTH_BITS (refreshDepth/COLOR_CHANNELS_PER_PIXEL)
#define MATRIX_SCAN_MOD (CONVERT_PANELTYPE_TO_MATRIXSCANMOD(panelType))
#define COLS_PER_PANEL (CONVERT_PANELTYPE_TO_MATRIXPANELWIDTH(panelType))
#define PHYSICAL_ROWS_PER_REFRESH_ROW (MATRIX_PANEL_HEIGHT / MATRIX_SCAN_MOD / HUB75_RGB_COLOR_CHANNELS_IN_PARALLEL)
#define ROW_PAIR_OFFSET (CONVERT_PANELTYPE_TO_MATRIXROWPAIROFFSET(panelType))
#define MULTI_ROW_REFRESH_REQUIRED (PHYSICAL_ROWS_PER_REFRESH_ROW > 1)

#define PIXELS_PER_LATCH    ((matrixWidth * matrixHeight) / MATRIX_PANEL_HEIGHT * PHYSICAL_ROWS_PER_REFRESH_ROW)

#define SM_HUB75_OPTIONS_NONE                       0
#define SM_HUB75_OPTIONS_C_SHAPE_STACKING           (1 << 0)
#define SM_HUB75_OPTIONS_BOTTOM_TO_TOP_STACKING     (1 << 1)
#define SM_HUB75_OPTIONS_HUB12_MODE                 (1 << 2)
#define SM_HUB75_OPTIONS_MATRIXCALC_LOWPRIORITY     (1 << 3)
#define SM_HUB75_OPTIONS_ESP32_INVERT_CLK           (1 << 4)
#define SM_HUB75_OPTIONS_ESP32_CALC_TASK_CORE_1     (1 << 5)
#define SM_HUB75_OPTIONS_FM6126A_RESET_AT_START     (1 << 6)
#define SM_HUB75_OPTIONS_T4_CLK_PIN_ALT             (1 << 7)

// old naming convention kept for compatibility
#define SMARTMATRIX_OPTIONS_NONE                    SM_HUB75_OPTIONS_NONE                   
#define SMARTMATRIX_OPTIONS_C_SHAPE_STACKING        SM_HUB75_OPTIONS_C_SHAPE_STACKING       
#define SMARTMATRIX_OPTIONS_BOTTOM_TO_TOP_STACKING  SM_HUB75_OPTIONS_BOTTOM_TO_TOP_STACKING 
#define SMARTMATRIX_OPTIONS_HUB12_MODE              SM_HUB75_OPTIONS_HUB12_MODE             
#define SMARTMATRIX_OPTIONS_MATRIXCALC_LOWPRIORITY  SM_HUB75_OPTIONS_MATRIXCALC_LOWPRIORITY 
#define SMARTMATRIX_OPTIONS_ESP32_INVERT_CLK        SM_HUB75_OPTIONS_ESP32_INVERT_CLK       
#define SMARTMATRIX_OPTIONS_ESP32_CALC_TASK_CORE_1  SM_HUB75_OPTIONS_ESP32_CALC_TASK_CORE_1 
#define SMARTMATRIX_OPTIONS_FM6126A_RESET_AT_START  SM_HUB75_OPTIONS_FM6126A_RESET_AT_START 
#define SMARTMATRIX_OPTIONS_T4_CLK_PIN_ALT          SM_HUB75_OPTIONS_T4_CLK_PIN_ALT         


// defines data bit order from bit 0-7, four times to fit in uint32_t
#define PACKED_HUB75_WORD_ORDER p0r1:1, p0g1:1, p0b1:1, p0r2:1, p0g2:1, p0b2:1, p1r1:1, p1g1:1, \
    p1b1:1, p1r2:1, p1g2:1, p1b2:1, p2r1:1, p2g1:1, p2b1:1, p2r2:1, \
    p2g2:1, p2b2:1, p3r1:1, p3g1:1, p3b1:1, p3r2:1, p3g2:1, p3b2:1 
    
#endif

MatrixPanelMaps.cpp:

/*
 * SmartMatrix Library - Matrix Panel Map Definitions
 *
 * Copyright (c) 2020 Louis Beaudoin (Pixelmatix)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#include "MatrixCommonHub75.h"
#include "MatrixPanelMaps.h"

// use this for all linear panels (e.g. panels that draw a single left-to-right line for each RGB channel)
const PanelMappingEntry defaultPanelMap[] =
{
    {0, 0, DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS},
    {0, 0, 0}   // last entry is all zeros
};

const PanelMappingEntry panelMap32x16Mod2[] =
{
    {0, 71,  -8},
    {0, 87,  -8},
    {0, 103, -8},
    {0, 119, -8},
    {2, 72,   8},
    {2, 88,   8},
    {2, 104,  8},
    {2, 120,  8},
    {4,  7,  -8},
    {4, 23,  -8},
    {4, 39,  -8},
    {4, 55,  -8},
    {6,  8,   8},
    {6, 24,   8},
    {6, 40,   8},
    {6, 56,   8},
    {0, 0, 0}   // last entry is all zeros
};

const PanelMappingEntry panelMapHub12_32x16Mod4[] =
{
    {0,  24,  8},
    {0,  56,  8},
    {0,  88,  8},
    {0,  120, 8},
    {4,  16,  8},
    {4,  48,  8},
    {4,  80,  8},
    {4,  112, 8}, 
    {8,  8,   8},
    {8,  40,  8},
    {8,  72,  8},
    {8,  104, 8},
    {12, 0,   8},
    {12, 32,  8},
    {12, 64,  8},
    {12, 96,  8},
    {0, 0, 0}   // last entry is all zeros
};

const PanelMappingEntry panelMap32x16Mod4[] =
{
    {0, 0,  8},
    {0, 16, 8},
    {0, 32, 8},
    {0, 48, 8},
    {4, 8,  8},
    {4, 24, 8},
    {4, 40, 8},
    {4, 56, 8}, 
    {0, 0, 0}   // last entry is all zeros
};

const PanelMappingEntry panelMap32x16Mod4V2[] =
{
    {0, 15, -8},
    {0, 31, -8},
    {0, 47, -8},
    {0, 63, -8},
    {4, 0,   8},
    {4, 16,  8},
    {4, 32,  8},
    {4, 48,  8}, 
    {0, 0, 0}   // last entry is all zeros
};

const PanelMappingEntry panelMap64x32Mod8[] =
{
    {0, 64, 64},
    {8, 0, 64},
    {0, 0, 0}   // last entry is all zeros
};

const PanelMappingEntry panelMap64x64Mod16[] =
{
{0,64,64},
{16,0,64},
{0,0,0}
};

const PanelMappingEntry panelMap32x16Mod4V11[] =
{
    {0,  7, -8},
    {0, 23, -8},
    {0, 39, -8},
    {0, 55, -8},
    {4,  8,  8},
    {4, 24,  8},
    {4, 40,  8},
    {4, 56,  8},
    {0,  0,  0}   // last entry is all zeros
};

//const PanelMappingEntry panelMap32x16Mod4V11[] =
//{
//    {0,  8, -8},
//    {0, 24, -8},
//    {0, 40, -8},
//    {0, 56, -8},
//    {4,  9,  8},
//    {4, 25,  8},
//    {4, 41,  8},
//    {4, 57,  7},
//    {4,  0,  1},
//    {0,  0,  0}   // last entry is all zeros
//};

const PanelMappingEntry * getMultiRowRefreshPanelMap(unsigned char panelType) {
    switch(panelType) {
        case SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN:
            return panelMap64x64Mod16;
        case SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN:
            return panelMap64x32Mod8;
        case SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN:
            return panelMap32x16Mod2;
        case SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN:
            return panelMapHub12_32x16Mod4;
        case SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN:
            return panelMap32x16Mod4;
        case SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2:
            return panelMap32x16Mod4V2;
        case SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11:
            return panelMap32x16Mod4V11;
        default:
            return defaultPanelMap;            
    }
}

I think that should be it.

Is the issue just with text? Are you defining USE_ADAFRUIT_GFX_LAYERS in the sketch? Does the Bitmaps sketch work?

Nope, nothing works. Even program at the top with running pixel, stops working if I run two pixels at the same time:

for(int j=0; j<kMatrixHeight; j++) {    
        for(int i=0; i<kMatrixWidth; i+=2) {
            backgroundLayer.fillScreen({0,0,0});
            backgroundLayer.drawPixel(i,j,{0xff, 0xff, 0xff});
            backgroundLayer.drawPixel(i+1,j,{0xff, 0xff, 0xff});
            backgroundLayer.swapBuffers();   
            delay(50);
        }
    }

Even if I compile the same program not in Arduino IDE but in Platformio, it stops working. So definitely something wrong with how hardware is controlled.

It’s very strange, because library v3 was working almost well, except the last pixel which was misplaced :slight_smile:

OK, So I’m back with the same panel type :slight_smile:

If I set its size to 32x16 (1 panel) it works, but many off pixels flicker a little all the time. When I change the size to 64x16 (2 panels) positions of pixels break.

Maybe there is something I can do (like with multirow mapping sketch and instructions) to debug what is wrong and suggest a fix?

PS. IC used is “MBI5124IC”, I would guess this is its datasheet: http://www.88869188.com/uploads/201801/5a542453754da.pdf

I have found very interesting commit in MRFaptastic library: Clock phase toggling option, required to support MBI5124 chips · mrfaptastic/ESP32-HUB75-MatrixPanel-DMA@15eaa3e · GitHub

As far as I understand the difference with “normal” panels is that you have to switch data lines on raising clock edge. Is this something doable in SmartMatrix?

I think you’ve already tried that:

Ahh, yes… Now I have entered this option back into MultiRowRefreshMapping and restarted from the beginning to map everything and I am back to the first mapping I posted in my first message, where there is one pixel out of group. With such setup I have 8 pixels in the wrong place.
Then what came to my mind is that maybe I should join this pixel to another group, that has only 7 places. And voila - addresses are now correct! :slight_smile:
The only thing that appeared after this change is that quite a lot of other pixels are now flickering. And their position looks predetermined by what other pixels are on at the same time (if you show an image, switch to something else and then back to the first image, the same pixels are flickering). Plus in MultiRowRefreshMapping you still always get that first image in the wrong place. If I use panel mapping with one separate pixel, no flickering is visible.
Looks like there is one pixel/signal that is expected to be send either before or after everything else.

It’s rare but not unheard of to have a HUB75 panel that’s designed wrong. I had someone contact me trying to get panels working for a commercial project and after a lot of debugging we found that the panels expected data on a rising clock edge (normal), but output data on the falling clock edge. Without an inverter or other circuitry between the panels they couldn’t be chained reliably.

Chinese engineering at its best :frowning: