Modify code for 64*64 pixel, HUB75E, 1/32 Scan led panels

Hello.

I need work with led panels 64*64, HUB75E, 1/32 Scan. I have read a post about it and seem current Smartmatrix code do not support yet this kind of panels.

I have check source code, to see if may I modify it to add support to HUB75E. Seem there are 3 source files to modify, MatrixHardware_KitV1.h, SmartMatrix.h and SmartMatrix_Impl.h.
.

1.- Modify in MatrixHardware_KitV1.h need add the 5th pin (E) to Scan 1/32, so something like this:

#define ADDX_PIN_0 3
#define ADDX_PIN_1 4
#define ADDX_PIN_2 1
#define ADDX_PIN_3 2
#define ADDX_PIN_4 zz // Must replace zz for the hardware pin to assing in Arduino, I must to check yet what pin use
#define ADDX_PIN_MASK ( (1 << ADDX_PIN_0) | (1 << ADDX_PIN_1) | (1 << ADDX_PIN_2) | (1 << ADDX_PIN_3) | (1 << ADDX_PIN_4) )
.

2.- Modify in SmartMatrix.h

#define SMARTMATRIX_HUB75_32ROW_MOD16SCAN 0
#define SMARTMATRIX_HUB75_16ROW_MOD8SCAN 1
#define SMARTMATRIX_HUB75_64ROW_MOD32SCAN 2

#define CONVERT_PANELTYPE_TO_MATRIXPANELHEIGHT(x) ( (x == SMARTMATRIX_HUB75_32ROW_MOD16SCAN ? 32 : 0) |
(x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? 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_16ROW_MOD8SCAN ? 8 : 0) | (x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? 32 : 0) )

#define CONVERT_PANELTYPE_TO_MATRIXROWSPERFRAME(x) ((x == SMARTMATRIX_HUB75_32ROW_MOD16SCAN ? 16 : 0) |
(x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? 8 : 0) | (x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? 32 : 0) )

.
3.- Modify in SmartMatrix_Impl.h

// fill addressLUT
for (i = 0; i < matrixRowsPerFrame; i++) {

    // set all bits that are 1 in address
    addressLUT[i].bits_to_set = 0x00;
    if (i & 0x01)
        addressLUT[i].bits_to_set |= (1 << ADDX_PIN_0);
    if (i & 0x02)
        addressLUT[i].bits_to_set |= (1 << ADDX_PIN_1);
    if (i & 0x04)
        addressLUT[i].bits_to_set |= (1 << ADDX_PIN_2);
  #ifdef ADDX_PIN_3
    if (i & 0x08) addressLUT[i].bits_to_set |= (1 << ADDX_PIN_3);
  #endif

#ifdef ADDX_PIN_4
if (i & 0x16) addressLUT[i].bits_to_set |= (1 << ADDX_PIN_4);
#endif

    // set all bits that are clear in address
    addressLUT[i].bits_to_clear = (~addressLUT[i].bits_to_set) & ADDX_PIN_MASK;
}
1 Like

ADDX pins need to be inside PORTA on the Freescale processor used for the Teensy. Options: A4 is Teensy pin 33, A5 is Teensy pin 24. These are on the underside of the Teensy 3.2 and hard to access.

I only skimmed through your changes but I think they look good.

I’m weeks away from releasing SmartMatrix Shield V5 which has support for 5 ADDX pins using a new technique that requires no ADDX GPIO pins. You need a flip flop chip to implement the changes. I’m using this one if you want to order one in advance: SN74AHCT374PWR

You can use the editor button that looks like this </> to format your code to make it easier to read.

1 Like

Thak you Louis for your suggestions, very useful for me. I think I have the 74HCT374, or I will order.

Then with your new V5 version, will be possible work with the HUB75E led panels (5 pins to select row), 6464 pixel, Scan 1/32 ??, I need it to do a led panel 19264 pixels. I work currently with Teensy 3.6 and also with a custom board with a Kinetis MK66 at 180 Mhz.

Also I want to see if possible port source code to a Cortex M7, Atmel SAM S70, 300Mhz. Im checking currently how config DMA and interrupts.

It should work with those panels

The V4 shield fits a Teensy 3.6 as well. Not sure if a Teensy 3.6 is powerful enough to drive a 192x64, hopefully it is. Please post back if you try with a large display like this.

ok, thank you.
I will post my test with Kinetis MK66 and 1/32 Scan led panels.

Hello Louis.

I have modify source code, but there is no data clock in the 5th pin I have add to scan Led panels 1/32 Scan. I have check with my oscilloscope and no pulses in this pin.

My E pin is assigned to port PTC10, pin 37 in Teensy. E is the 5th pin I add to have 5 pins, A, B, C, D, E, to scan 64 rows (2 x 32 rows).

Some suggestion ??, I check source code and really do not know where assign the new IO Port to output data signals.
.

I have add/modify this code to MatrixHardware_RGB_DMD.h

#define ADDX_PIN_0 3
#define ADDX_PIN_1 0
#define ADDX_PIN_2 1
#define ADDX_PIN_3 2
#define ADDX_PIN_4 4 // E para barrer paneles con 5 pines por linea

#define ADDX_PIN_MASK ((1 << ADDX_PIN_0) | (1 << ADDX_PIN_1) | (1 << ADDX_PIN_2) | (1 << ADDX_PIN_3) | (1 << ADDX_PIN_4))

// Pines A, B, C, D, E, seleccion linea panel, codigo binario 5 pines para paneles 1/32 Scan
// Pin9 = PTC3 (A0), Pin15 = PTC0 (A1), Pin22 = PTC1(A2), Pin23 = PTC2(A3), Pin37 = PTC10 (A4)
#define ADDX_TEENSY_PIN_0 9 // PTC3
#define ADDX_TEENSY_PIN_1 15 // PTC0
#define ADDX_TEENSY_PIN_2 22 // PTC1
#define ADDX_TEENSY_PIN_3 23 // PTC2
#define ADDX_TEENSY_PIN_4 37 // PTC10. pin E para barrer paneles con 5 pines por linea

.

And add/modify this code to SmartMatrix_Impl.h

for (i = 0; i < matrixRowsPerFrame; i++)
{

  // set all bits that are 1 in address
    addressLUT[i].bits_to_set = 0x00;
    if (i & 0x01)
        addressLUT[i].bits_to_set |= (1 << ADDX_PIN_0);
    if (i & 0x02)
        addressLUT[i].bits_to_set |= (1 << ADDX_PIN_1);
    if (i & 0x04)
        addressLUT[i].bits_to_set |= (1 << ADDX_PIN_2);
   #ifdef ADDX_PIN_3
        if (i & 0x08)  addressLUT[i].bits_to_set |= (1 << ADDX_PIN_3);
  #endif
  #ifdef ADDX_PIN_4
    if (i & 0x16)  addressLUT[i].bits_to_set |= (1 << ADDX_PIN_4);
 #endif

// set all bits that are clear in address
    addressLUT[i].bits_to_clear = (~addressLUT[i].bits_to_set) & ADDX_PIN_MASK;

}

// configure the address pins
pinMode(ADDX_TEENSY_PIN_0, OUTPUT);
pinMode(ADDX_TEENSY_PIN_1, OUTPUT);
pinMode(ADDX_TEENSY_PIN_2, OUTPUT);
#ifdef ADDX_TEENSY_PIN_3
    pinMode(ADDX_TEENSY_PIN_3, OUTPUT);
#endif
#ifdef ADDX_TEENSY_PIN_4
   pinMode(ADDX_TEENSY_PIN_4, OUTPUT);
#endif

One more question Louis.
Do you know already when will release your V5 Smartmatrix Library with support for 1/32 Scan Led panels ??, I’m really very interested.

Thank you.

#define ADDX_PIN_4 4 // E para barrer paneles con 5 pines por linea

This should be:

#define ADDX_PIN_4 10 // E para barrer paneles con 5 pines por linea

It should match with PTC10. I didn’t look at the rest of the code.

I have 100 pcs of the new hardware manufactured, but they need to be tested and I need to make a test fixture. I expect to release the new shield in July.

Thanks, I will check source modification.
I wait for your new V5 library version with support for 1/32 Scan led panels.

Hello Louise.
I have check your source modification suggestion, and now there is clock data in the 5th pin (PTC10), but do not know why yet, the frequency in that pin is not as expected.

I understand that if we have 5 pins to scan the Led panel, A, B, C, D and E, each one must to be half frequency of preceding, but I have check with my oscilloscope and frequency of E is same than C, instead of to be half of D.

So, these are my frequency mesures for 64 rows, 1/32 Scan:

A —> 1923 Hz
B —> 961 Hz
C —> 480 Hz
D —> 240 Hz
E —> 480 Hz.

Some suggestion about what may need modify to amend the E output ??, I understand that in the E output I must measure 120 Hz instead of 480 Hz .

At any rate I have order already some chips to do it by external hardware like you suggested, I ordered the 74HCT374, and also some 74HCT4040 and 74LS93, all counter/dividers, so may work with only one signal and get the rest of the signals with several cascading flip-flops (working like dividers).

Do you think may be possible you release Smartmatrix V5 library software some time before than board shield is available ??.

Found another issue with your changes:

  #ifdef ADDX_PIN_4
    if (i & 0x16)  addressLUT[i].bits_to_set |= (1 << ADDX_PIN_4);
 #endif

should be:

  #ifdef ADDX_PIN_4
    if (i & 0x10)  addressLUT[i].bits_to_set |= (1 << ADDX_PIN_4);
 #endif

Thanks Louis, I will check.

Tested and now work perfectly.
I have yet a little problem to solve, but its with my input data, output with Smartmatrix work perfect with 1/32 Scan Led panels 64 rows.

In picture attached, my tests with a 192x64 Led panel, work very well, Im very happy. Now only display half of screen, but its not a Smartmatrix problem, but of my application that I must modify to read correclty 64 rows.

Thank you Louis, for your support, very useful.

I solved already my input data problem, and now the display work practically perfect, all the 64 rows are there. Screen is very stable, with no blinks or Lateral displacements.

I’m very happy, after source modifications library work very well with 1/32 Scan led panels. Display in pictures attached, is 192x64 (3 x 64*64 1/32 Scan).

That’s great! That’s the biggest pixel count SmartMatrix setup I’ve seen. Thanks for posting pictures.

I’m curious what board you’re using to drive the panels. It looks like a custom board, maybe using the same processor as the Teensy 3.6, and an ESP8266 for WiFi, is that correct?

1 Like

Hello Louis.

Yes, I have test with a Teensy 3.6, and also with my own custom board with a Kinetis MK66 TQFP144. My board install also a WIFI ESP8266, USB and SDIO 4bit parallel SD card. To read inputs I add a CD4050 chip to convert 5v logic levels to 3.3v.

My final display is a big PCB with the 3 Led panel, a Kinetis MK66 TQFP144, SD card and a switched DC-DC 12v to 5v XL4015. I made also a 128x32 display with 1/16 Scan led panels, that work very well with same firmware.

Hi @pinballsp, do you have your code available?

I received a 64x64 matrix and applied your changes on a Teensy 3.2, though adjusted ADDX_TEENSY_PIN_4 from 37 to 16 (as 37 isn’t exposed on Teensy 3.2). I only seem to be able to drive the top quarter and 3rd quarter of the rows. Granted, the docs for the board state it’s /16 scan rate rather than /32 (64x64_RGB_LED_Matrix_-_3mm_pitch_SKU_DFR0499-DFRobot)

I updated to Teensy 3.6 and do have the full 64x64 working, but it’s not the cleanest. One half is slightly off color and there is various flickering. I’ve also tried overclocking to 192MHz. Any suggestions on improving this? I’m simply taking data from a camera (with similar resolution) and spitting it out to the panel.

Thanks!

I think all those pins (A, B, C, D, E) must to be in same PORT, PTC. So if you have replace a PTC10 by PTB0, can not work because different PORT. At any rate Louis will confirm you.