mrcodetastic/ESP32-HUB75-MatrixPanel-DMA

Display boards with SM5266P Row drivers

DarrylStrong opened this issue · 16 comments

Hi,

I have recently had delivered some display boards which use the SM5266P drivers for the row select. This is a shift register type using only ABC signals to drive a 1:32 scan 128x64 PCB.

https://datasheetspdf.com/pdf-file/1328896/Sunmoon/SM5266P/1

Before I have a go at modifying the library to drive these has anyone had any joy previously with these?

They are a shift register with Clock, Data and Blank inputs rather that a straight 5:32 demux.

Cheers!

Daz

I have the same panel here, received last month and the rows is giving me trouble...
I addressed it in isue:
#154
But so far no solution.
If you are going to modify the lib to drive this one successfully, please keep us updated.

Okay - problem solved.

I have modified the function void MatrixPanel_I2S_DMA::clearFrameBuffer(bool _buff_id) in ESP32-HUB75-MatrixPanel-I2S-DMA.cpp

Essentially the DE row drive signals for multiplexing stay the same but the ABC signals are clk, di, bk now instead of being binay coding in three bits for the row drivers. This means that the rows to be turned on are defined by shifting data into the SM5266P chip. (Datasheet here- [https://datasheetspdf.com/pdf-file/1328896/Sunmoon/SM5266P/1])

Page six shows the setup on my 128x64 P2.5 panels.

Here is the modified code :

///////////////////////////////////////////////////////////////////////////////////////////////
//
// modifications here for row shift register type SM5266P
//
///////////////////////////////////////////////////////////////////////////////////////////////

// get last pixel index in a row of all colordepths
int x_pixel = dma_buff.rowBits[row_idx]->width * dma_buff.rowBits[row_idx]->color_depth;
//Serial.printf(" from pixel %d, ", x_pixel);
// fill all x_pixels except color_index[0] (LSB) ones, this also clears all color data to 0's black
do {
--x_pixel;
#ifdef SM5266P
row[x_pixel] = abcde & (0x18 << BITS_ADDR_OFFSET); // mask out the bottom 3 bits which are the clk di bk inputs
#else
row[x_pixel] = abcde;
#endif
} while (x_pixel != dma_buff.rowBits[row_idx]->width);
// color_index[0] (LSB) x_pixels must be "marked" with a previous's row address, 'cause it is used to display
// previous row while we pump in LSB's for a new row
abcde = ((ESP32_I2S_DMA_STORAGE_TYPE)row_idx - 1) << BITS_ADDR_OFFSET;
do {
--x_pixel;
#ifdef SM5266P
row[x_pixel] = abcde & (0x18 << BITS_ADDR_OFFSET); // mask out the bottom 3 bits which are the clk di bk inputs
#else
row[x_pixel] = abcde;
#endif
} while (x_pixel);

// now time to add the clk di and bk bits to the end of the scan to update the row select shift register SM5266P
#ifdef SM5266P
uint16_t serialCount;
uint16_t latch;
x_pixel = dma_buff.rowBits[row_idx]->width - 16; // come back 8*2 pixels to allow for 8 writes
serialCount = 8;
do {
serialCount--;
latch = row[x_pixel] | (((((ESP32_I2S_DMA_STORAGE_TYPE)row_idx) % 8) == serialCount) << 1) << BITS_ADDR_OFFSET; // data on 'B'
row[x_pixel++] = latch | (0x05 << BITS_ADDR_OFFSET); // clock high on 'A'and BK high for update
row[x_pixel++] = latch | (0x04 << BITS_ADDR_OFFSET); // clock low on 'A'and BK high for update
} while (serialCount);
#endif

///////////////////////////////////////////////////////////////////////////////////////////////
//
// modifications end here for row shift register type SM5266P
//
///////////////////////////////////////////////////////////////////////////////////////////////

This modified code is invoked if SM5266P is defined at the start of this file.

#define SM5266P
#include <Arduino.h>
#include "ESP32-HUB75-MatrixPanel-I2S-DMA.h"

I am unsure of the best way to include this as an option when setting the library up as the defines are not carried through to the library from the source code so any help there would be appreciated.

Cheers :)

If this code mod is working then this is definitely something that should be added to the library. With the SM5266P comes a whole lot of panels ...so worth looking into @mrfaptastic
On a side note, i tried the code by modifying the ESP32-hub75-matrixpanel-i2s-dma.cpp but all i get is errors compiling ...double defined variables or different expectations of a functions..etc.
Maybe its an option for you to share the modified file completely? That way we can check side to side what needs to be changed.

@DarrylStrong - Can you submit a pull request to the SM5266P tree, @donnersm can test (if you have a panel), and I might get my resident config expert @vortigont to look at the changes and see how it could be incorporated. Thanks again for your code to get SM5266P panels working - all contributions make this library better.

https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/tree/SM5266P

Will be my pleasure to help here! I'll take a look at it this weekend or once confirmed that it all ready to go. That great if we all could keep this lib up to date and make it even better
Cheers!

I am sorry - you will have to guide me through this process as I am not familiar with GitHub and especially Pull Requests. I have gone to Pull Requests and compared two branches but can't get any further.

Not a problem. How about just attaching a zip of your full modified version of this library.

Now that I can do :)

One file attached.

Cheers!
ESP32-HUB75-MatrixPanel-I2S-DMA.zip

I tried using it by replacing the lib file with the modified file, however, it will not compile. In the end it still has some definition errors. Also the clearscreen function is double declared. don't know if Darryl added that function to the i2s-sma.cpp or that it is a library version conflict. I am using 2.0.5 ( according to arduino)

I modified an older version of the library so definitely a version conflict.

Once I have working code for one of our signs I leave well alone 😊

@donnersm - Can you try the SM5266P branch of this library? @vortigont - fyi.

You can pass mxconfig.driver = HUB75_I2S_CFG::SM5266P; on setup

@donnersm - Can you try the SM5266P branch of this library? @vortigont - fyi.

You can pass mxconfig.driver = HUB75_I2S_CFG::SM5266P; on setup

Tried it. It compiles and runs but result is the same, still double horizontals

I hope we are not on a wild goose chase here and that i am dealing with a broken panel. I only have one of this type so...
Anyway did another test; activating each horizontal line one by one and it looks like the lines are mirrored every 8 bit.. so line 0 is mirrored to line 8.. line 1 is mirrored to line 9 and so on....could be a bitshift or an 16 bit driving an an 8 bit

I shall try this tomorrow.

Donnersm, do you have a picture of the back of your pcb without the plastic frame? I took mine off to see the complete chipset.

My panel behaved according to the data sheet specs. for the 5266 driver.

The pcb was marked with ABC inputs only but it also had DE lines. ABC are clock data and strobe for the address latch and the DE lines select which of the 4 row drivers are active.

I hope we are not on a wild goose chase here and that i am dealing with a broken panel.

I can't unfortuately test because I don't have one of these panels. You probably have yet another variant of the panels. You sure it isn't some 1/4 or 1/8 scan panel? These don't work with this library out of the box.

@DarrylStrong - Thanks for testing the branch of the library to see if my copy-paste of your 'SM5266P' code works.

Glad to report all working well!

Thank you for incorporating it into the library.

Video here...

https://youtu.be/Mwpp63a9-Eo

Picture of the back of the module and my CPU board.

IMG_20210817_103444.jpg

Thank you again!

Darryl

I hope we are not on a wild goose chase here and that i am dealing with a broken panel.

I can't unfortuately test because I don't have one of these panels. You probably have yet another variant of the panels. You sure it isn't some 1/4 or 1/8 scan panel? These don't work with this library out of the box.

@DarrylStrong - Thanks for testing the branch of the library to see if my copy-paste of your 'SM5266P' code works.

I have a 1/8 scan panel, is there no modification that works for it?