P4 RGB Matrix - max resolutions?

Hi all – thanks in advance.

Q: Is there a maximum number of pixels on a side, that the Teensy 4.1 and SmartMatrix can handle? Not asking about total resolution. The problem I’m having is with the arrangement of an array of 64x32 P4 panels.

My goal is to have a single column stack, with 9 - 64x32 horizontal panels forming a single array/screen.

I’m running an tweaked “Game of Life” code on it as part of an art project. The errors could also be my code – my skills are minimal and I’m learning as I go. I’m in the design phase exploring the tech and code. The physical parameters/panel layout are still fluid.

If I write my code (see below) so that I have 10 - 64x32 panels, stacked 1 across, 10 down, my code doesn’t work (a resolution of 64 x 320 = 20,480 pixels).

const uint8_t kMatrixWidth = 64;    // 1 panel across
const uint8_t kMatrixHeight = 320;   // 10 panels down

If I write my code so that I have 10 - 64x32 panels, stacked 2 across, 5 down, my code works (a resolution of 128 x 160 = 20,480 pixels).

const uint8_t kMatrixWidth = 128;    // 2 panels across
const uint8_t kMatrixHeight = 160;   // 5 panels down

Also, FWIW, if I do 7 panels in a vertical stack, it works (a resolution of 64 x 224 = 14,336 pixels)

const uint8_t kMatrixWidth = 64;    // 1 panels across
const uint8_t kMatrixHeight = 224;   // 7 panels down

“Doesn’t work” means the screens stop acting like an array and start mirroring the first screen, the colors are off, and the pixel positions are shifted – stair stepped.

The panels are well supplied with power. The array is connected in a long chain, simply going from Data Out to Data In.

Panels: Hub75 P4 64x32 Mod16scan
Teensy 4.1
SmartMatrix Shield 4
5V/40 Amp power supply

I can post the whole code if that helps, but here’s the relevant chunk for the SmartMatrix

#include <MatrixHardware_Teensy4_ShieldV5.h> // Include the hardware configuration for SmartLED Shield (V5)
#include <SmartMatrix.h>
#include <FastLED.h>


#define COLOR_DEPTH 24                  // This sketch and FastLED uses type `rgb24` directly, COLOR_DEPTH must be 24
const uint8_t kMatrixWidth = 128;    // 2 panels across
const uint8_t kMatrixHeight = 160;   // 5 panels down
const uint8_t kRefreshDepth = 48;       // known working: 24, 36, 48
const uint8_t kDmaBufferRows = 4;       // known working: 2-4, use 2 to save memory, more to keep from dropping frames and automatically lowering refresh rate
const uint8_t kPanelType = SMARTMATRIX_HUB75_32ROW_MOD16SCAN; // Assuming 32-row hub75 panels with mod16 scan
const uint8_t kMatrixOptions = (SMARTMATRIX_OPTIONS_NONE);      // see http://docs.pixelmatix.com/SmartMatrix for options
const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE);

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

#define NUM_LEDS (kMatrixWidth * kMatrixHeight)


uint8_t type can contains a number in range 0…255, so it’s no surprise that the code doesn’t work.

Thanks @b707 – much appreciated for pointing this out. I was suspicious it might be related to a 255 limit, but I’m stumbling in the dark with coding. :wink:

did some digging to try and learn a bit –

“a uint8_t is an unsigned 8 bit value, so it takes 1 byte. A uint16_t is an unsigned 16 bit value, so it takes 2 bytes (16/8 = 2)”

It can’t be as simple as simply using a “unit16_t”, can it?

Do you have any suggestions on how to get a 320 pixel array working? Or can you point me to a reference doc. where I can do the research?

If your matrix dimensions are greater than 255, you cannot use uint8_t, you must use uint16_t or greater.

I haven’t checked the rest of your code, there may be other errors there.