Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FM6126 based HUB75 Panels #23

Closed
mrcodetastic opened this issue Jul 21, 2020 · 45 comments
Closed

FM6126 based HUB75 Panels #23

mrcodetastic opened this issue Jul 21, 2020 · 45 comments

Comments

@mrcodetastic
Copy link
Owner

Same issue will affect this library, reference: hzeller/rpi-rgb-led-matrix#746

Potential fix required before using: .begin() -> #20

#include <Arduino.h>
#include <TomThumb.h> // this should be in the adafruit-gfx library
#include <ESP32-RGB64x32MatrixPanel-I2S-DMA.h>

RGB64x32MatrixPanel_I2S_DMA matrix;

////////////////////////////////////////////////////////////////////
// Reset Panel
// This needs to be near the top of the code
//
// Change these to whatever suits
// recommended settings and patches are by
//
// pinout for ESP38 38pin module
// http://arduinoinfo.mywikis.net/wiki/Esp32#KS0413_keyestudio_ESP32_Core_Board
//

// R1 | G1
// B1 | GND
// R2 | G2
// B2 | E
// A | B
// C | D
// CLK| LAT
// OE | GND

#define R1 25
#define G1 26
#define BL1 27
#define R2 5 // 21 SDA
#define G2 19 // 22 SDL
#define BL2 23
#define CH_A 12
#define CH_B 16
#define CH_C 17
#define CH_D 18
#define CH_E -1 // assign to pin if using two panels
#define CLK 15
#define LAT 32
#define OE 33

void resetPanel()
{
int MaxLed = 64;

int C12[16] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
int C13[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0};

pinMode(R1, OUTPUT);
pinMode(G1, OUTPUT);
pinMode(BL1, OUTPUT);
pinMode(R2, OUTPUT);
pinMode(G2, OUTPUT);
pinMode(BL2, OUTPUT);
pinMode(CH_A, OUTPUT);
pinMode(CH_B, OUTPUT);
pinMode(CH_C, OUTPUT);
pinMode(CH_D, OUTPUT);
pinMode(CH_E, OUTPUT);
pinMode(CLK, OUTPUT);
pinMode(LAT, OUTPUT);
pinMode(OE, OUTPUT);

// Send Data to control register 11
digitalWrite(OE, HIGH); // Display reset
digitalWrite(LAT, LOW);
digitalWrite(CLK, LOW);
for (int l = 0; l < MaxLed; l++)
{
int y = l % 16;
digitalWrite(R1, LOW);
digitalWrite(G1, LOW);
digitalWrite(BL1, LOW);
digitalWrite(R2, LOW);
digitalWrite(G2, LOW);
digitalWrite(BL2, LOW);
if (C12[y] == 1)
{
digitalWrite(R1, HIGH);
digitalWrite(G1, HIGH);
digitalWrite(BL1, HIGH);
digitalWrite(R2, HIGH);
digitalWrite(G2, HIGH);
digitalWrite(BL2, HIGH);
}
if (l > MaxLed - 12)
{
digitalWrite(LAT, HIGH);
}
else
{
digitalWrite(LAT, LOW);
}
digitalWrite(CLK, HIGH);
digitalWrite(CLK, LOW);
}
digitalWrite(LAT, LOW);
digitalWrite(CLK, LOW);
// Send Data to control register 12
for (int l = 0; l < MaxLed; l++)
{
int y = l % 16;
digitalWrite(R1, LOW);
digitalWrite(G1, LOW);
digitalWrite(BL1, LOW);
digitalWrite(R2, LOW);
digitalWrite(G2, LOW);
digitalWrite(BL2, LOW);
if (C13[y] == 1)
{
digitalWrite(R1, HIGH);
digitalWrite(G1, HIGH);
digitalWrite(BL1, HIGH);
digitalWrite(R2, HIGH);
digitalWrite(G2, HIGH);
digitalWrite(BL2, HIGH);
}
if (l > MaxLed - 13)
{
digitalWrite(LAT, HIGH);
}
else
{
digitalWrite(LAT, LOW);
}
digitalWrite(CLK, HIGH);
digitalWrite(CLK, LOW);
}
digitalWrite(LAT, LOW);
digitalWrite(CLK, LOW);
}
// End of default setup for RGB Matrix 64x32 panel
///////////////////////////////////////////////////////////////

void setup(){

resetPanel(); // do this before matrix.begin

// If you experience ghosting, you will need to reduce the brightness level, not all RGB Matrix
// Panels are the same - some seem to display ghosting artefacts at lower brightness levels.
// In the setup() function do something like:

matrix.setPanelBrightness(10); // SETS THE BRIGHTNESS HERE. 60 OR LOWER IDEAL.

matrix.begin(R1, G1, BL1, R2, G2, BL2, CH_A, CH_B, CH_C, CH_D, CH_E, LAT, OE, CLK); // setup the LED matrix
// matrix.setFont(&TomThumb.h);
matrix.setTextColor(matrix.Color(96, 0, 96)); // r,g,b
matrix.setCursor(1, 15);
matrix.println("Hello World");

}

void loop(){

}
@Galaxy-Man
Copy link

Well after fettling a few settings and change -1 to 14 I have two panels together 128x32 working. Not got the 64x64 mode working yet, panels not behaving. These are some examples of animated screens for my alarm clock and the Aurora Demo.
20200722_194701_resized
20200722_194821_resized
20200722_194758_resized
20200722_195155_resized
20200722_195225_resized

@csloz
Copy link
Collaborator

csloz commented Jul 22, 2020 via email

@mrcodetastic
Copy link
Owner Author

mrcodetastic commented Jul 22, 2020

Well after fettling a few settings and change -1 to 14 I have two panels together 128x32 working. Not got the 64x64 mode working yet, panels not behaving.

Nice work. What is the second and third visualisation?

Larger than that becomes iffy.

This is what I am going to enhance in the library next. Turn off the second DMA buffer which most people don't use and therefore immediately double the pixels.

Secondly, going to investigate reducing pwm gradients to about 16 bit color (most people can't tell the difference) to further increase resolution. These would be compile time options.

@Galaxy-Man
Copy link

Galaxy-Man commented Jul 22, 2020

Aurora Flowfield and Aurora Increment are the two screens. Agree on both parts, I saw no advantage in have the second DMA, however can you write in as an option to have 1 or 2 DMA buffers? 16 bit would be a better option as who can tell difference on a 64x32 screen? these are not exactly high end commercial products! I would not waste my time doing it other than proving I could do it!

@Galaxy-Man
Copy link

As DMA is the constraint? does it stand to reason less color variations the more DMA you have and in return the more panels you could possibly have?

@Galaxy-Man
Copy link

As an update in the void resetPanel(), MaxLed is set to MATRIX_WIDTH and I have updated the library for support of 128x32 to get it to work. 64x64 does not work, yet , or I should say I cannot get it to work :-)

@Galaxy-Man
Copy link

Galaxy-Man commented Jul 23, 2020

Working currently on mrfaptastic DMA driver, NTP optional RTC and DailyAlarms all working together. I need to clean out old library files from VSC to eliminate conflicts. DailyTimers seems to work ok on ESP8266 not ESP32, however I tried your original source of forked version and that works with ESP32!

@mrcodetastic
Copy link
Owner Author

As an update in the void resetPanel(), MaxLed is set to MATRIX_WIDTH and I have updated the library for support of 128x32 to get it to work. 64x64 does not work, yet , or I should say I cannot get it to work :-)

I have created a 'development' branch of the library. Feel free to submit a pull request to that.
https://github.com/mrfaptastic/ESP32-RGB64x32MatrixPanel-I2S-DMA/tree/development

@mrcodetastic
Copy link
Owner Author

DailyTimers seems to work ok on ESP8266 not ESP32, however I tried your original source of forked version and that works with ESP32!

Just to clarify is it my fork that works or is it the original that works?

@Galaxy-Man
Copy link

Galaxy-Man commented Jul 24, 2020

Thanks for the developemnt branch, I'll do a pull request this weekend.

Sorry when it's late I sometimes do not make myself clear. Yours works on ESP8266 and the original (Bulldog) works on ESP32, I'm using VSC to build. I have not looked into why thats is yet, this was just an inital observation.

I have tried your forked version using VSC and the Arduino IDE with same results on the ESP32. Sorry I should of put this in on last post.

ESP32 Serial Monitor

Stack smashing protect failure!

abort() was called at PC 0x400d5290 on core 1

Backtrace: 0x4008b560:0x3ffb1ee0 0x4008b78d:0x3ffb1f00 0x400d5290:0x3ffb1f20 0x400d0d45:0x3ffb1f40 0x400d2675:0x3ffb1fb0 0x40088215:0x3ffb1fd0

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
Active Timers=2
Active days: 100000
LED OFF FUNCTION
Time:23:57:55 Date:05/16/2017 (mm/dd/yyyy)

@Galaxy-Man
Copy link

Galaxy-Man commented Jul 24, 2020

Ok sorted it if I change the following it works...

sprintf(timeBuffer, "Time:%02d:%02d:%02d\tDate:%02d/%02d/%4d (mm/dd/yyyy)", hour(), minute(), second(), month(), day(), year());

to

sprintf(timeBuffer, "Time:%02d:%02d:%02d\tDate:%02d/%02d/%4d\t mm-dd-yy", hour(), minute(), second(), day(), month(), year());

Sorted the issue may be I should of read the updated source code first, however the zip i downloaded had the old sprint line in it! I double checked and downloaded again 2 mins ago and it has the old sprint line.

I see you update the basic.ino 12 months ago, the zip file is not sync'd.

Not to worry all fixed now and works well, thanks.

@Galaxy-Man
Copy link

Galaxy-Man commented Jul 27, 2020

Panel working with NTPClient, TIme, TimeLib and mrFaptastic DMA library and DailyTimers both excellent. Lesson learned here is make sure you avoid global libraries where possible, pull them into each project. Opinion VSC is far better than Arduino IDE. I had to play hide and seek with the Time/TimeLib using wrong versions etc but got there in the end.

Working on adding WiFiConnectLite, audio and animation next.

@mrcodetastic
Copy link
Owner Author

I moved from PlatformIO (VS Code) about a year ago and will never move back. It's so much better. I wish I knew about VSC when I was working on the original ESP32-RGB64x32MatrixPanel-I2S-DMA library, would have made debugging so much easier. Arduino IDE is painful for anything other than creating a 'blink' sketch.

@Galaxy-Man
Copy link

Have you bought yourself one of these yet?

https://www.youtube.com/watch?v=psMqilqlrRQ&feature=youtu.be

@mrcodetastic
Copy link
Owner Author

Have you bought yourself one of these yet?

https://www.youtube.com/watch?v=psMqilqlrRQ&feature=youtu.be

I haven't but I might one day.

On another note, I have submitted a large change to the library to improve performance and reduce memory consumption significantly (disable double buffering). Also the possibility to use for much much longer chains of panels is possible, but as I don't have any more than one 32x64 panel. I can't confirm. Refer to the readme.

https://github.com/mrfaptastic/ESP32-RGB64x32MatrixPanel-I2S-DMA/tree/development

@mrcodetastic
Copy link
Owner Author

I had trouble getting > 128 x 32 going (4096pixels), as I ran into memory problems. Larger than that becomes iffy.

@csloz - Can you try again with something larger than that? Use the development branch and enable (uncomment) line #define SPLIT_MEMORY_MODE 1. I'm curious to know how far we can now push the ESP32.

@csloz
Copy link
Collaborator

csloz commented Jul 29, 2020 via email

@Galaxy-Man
Copy link

Hi mrfaptastic, thanks for the replies and your time doing the updates.

I'll order more panels today, hopefully I can find the correct panel on eBay or Amazon, when it comes to tech details the suppliers are not vey good at telling you what you are buying as all they do is box shift!

However my usual supplier is out of stock since March, I wonder why! I found someone else so will order a single 64x32 panel and if correct I'll order more.

How big (many) do you wish to go with the panels? I may need a bigger PSU lol

mrfaptastic which country are you in? if these are correct panels I don't mind sending you some in the post, it's a small price to pay for the effort you are putting in to this project.

@Galaxy-Man
Copy link

404 on the development link, it was there before the weekend but has dropped off.

@Galaxy-Man
Copy link

Galaxy-Man commented Jul 29, 2020

mrfaptastic, is there a particular order for loading the includes after <Arduino.h> ?

Reason for question is other panel drivers had issues when loading and starting<Wifi.h> after other developers panel drivers cause issues like locking up, flicker, wifi not working correctly very unstable.

Thoughts for beginner developers note:
I urge all developers to use VSC your life will be so much easier, only thing that was good to come out of Microsoft? and it's free!
Where "" are used then the #include are in the Local project directory, where <> is used then includes are Global.
NOT all libraries are the same, if you find one that works keep it in the project directory and make notes where you got it from.

This is the order of my code (not an exact cut & paste)

#include <Arduino.h>
#include <SPI.h>
#include <Wire.h>
////////////////////////////////////////////////////////////////////

#include "WiFiConnect.h"
#include <WiFiClient.h>
#include <HTTPClient.h>

WiFiConnect wc;

WiFiClient client;
HTTPClient http;

//const char *ssid = "EE5G";
//const char *ssid = "testreserved";
//const char *password = "Pa55w0rd!6101";
//const char *ssid = "SSID";
//const char *password = "PASSWORD";
/////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
#include "NTPClient.h"
#include <WiFiUdp.h>
#include "Time.h"
#include "DailyTimer.h"
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP);
/////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
#include "ESP32-RGB64x32MatrixPanel-I2S-DMA.h"

RGB64x32MatrixPanel_I2S_DMA matrix;
/////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
#include "GFX_fonts/Font4x7Fixed.h"
/////////////////////////////////////////////

@Galaxy-Man
Copy link

In void setup()

//////////////////
resetPanel(); // do this before matrix.begin
// matrix.begin(); // use default settings in library
matrix.begin(R1, G1, BL1, R2, G2, BL2, CH_A, CH_B, CH_C, CH_D, CH_E, LAT, OE, CLK); // setup the LED matrix

startWiFi();

startTimeClient();

@mrcodetastic
Copy link
Owner Author

mrcodetastic commented Jul 29, 2020

However my usual supplier is out of stock since March, I wonder why! I found someone else so will order a single 64x32 panel and if correct I'll order more.

How big (many) do you wish to go with the panels? I may need a bigger PSU lol

Hold on! You're putting me under pressure here :)! I just did some testing of the library (as one doesn't need to physically have panels connected to see if the library theoretically works), and managed to get 64x384 to work if I reduced to colour depth to about 5 bits/per pixel (~50k?) and enabled SPLIT_MEMORY_MODE. However there is no guarantee this will look any good in the real world as the refresh rate is pretty low and it may be super dim as a result. At least the ESP32 doesn't just die.

#ifndef MATRIX_HEIGHT
#define MATRIX_HEIGHT               64 
#endif

#ifndef MATRIX_WIDTH
#define MATRIX_WIDTH                384
#endif

#ifndef MATRIX_ROWS_IN_PARALLEL
#define MATRIX_ROWS_IN_PARALLEL     2
#endif

#define PIXEL_COLOR_DEPTH_BITS        5   

404 on the development link, it was there before the weekend but has dropped off.

Sorry. It's back again now.

mrfaptastic, is there a particular order for loading the includes after <Arduino.h> ?

None whatsoever. Are you referring to the examples? I probably need to clean these up if I have the includes in the wrong order.

mrfaptastic which country are you in? if these are correct panels I don't mind sending you some in the post, it's a small price to pay for the effort you are putting in to this project.

I'm in the UK. You don't need to do that however (although getting one of these FM6126 panels would be useful for testing)!

@Galaxy-Man
Copy link

Galaxy-Man commented Jul 29, 2020

Sorry there is no pressure, I thought I was helping if you had panels rather than waiting for others to reply. Even if I send you some panels they are free of charge I am not expecting anything from you. I know what its like doing these projects, people expect too much in return. This is onyl a hobby for me, a leaning experience nothing more. I do these things at my own pace and as long as I am enjoying myself then I continue to program and do electronics. I'm in UK too, based around South West

@mrcodetastic
Copy link
Owner Author

Apoloiges. It was a humour fail on my behalf. I just didn't want you going out buying 50 panels with the library only being able to handle a couple haha!

Looks like 256x32 or even 256x64 should be doable however! YYMV of course!

@Galaxy-Man
Copy link

Galaxy-Man commented Jul 29, 2020

No problem, I thought it was :-)

Reference to start order is to do with something from another site saying ESP32 need to load Wifi drivers first as thye allocate memory in a particular way. Since then I have always loaded them first. I had a lot of issues with reset of ESP32 and wifi. This could be the way the other matrix drivers were written?

All other panel drivers need the reset program to work or they did last time I tested them.

@Galaxy-Man
Copy link

Galaxy-Man commented Jul 29, 2020

Thoughts;

If the panels are dumb using shift registers then the limitation is on how quickly and brightly we can light the LED to get POV?
There will be a compromise fps, to get more panels and as you said may be dimmer?

What if we find the compromise then use muliple ESP32 to sync each other to drive many panels?

Is the question can we transfer the data quick enough for one to control them all and then sync?

Do the big array panels use active shift registers that stay on and change only the bits when asked to?

I know there is a limit to what can be done with these types of panels.

@Galaxy-Man
Copy link

@mrcodetastic
Copy link
Owner Author

mrcodetastic commented Jul 29, 2020

I had a lot of issues with reset of ESP32 and wifi. This could be the way the other matrix drivers were written?

I haven't had any issues with WiFi with my library, but with other Matrix libraries, they don't use DMA, and simply use a timer interrupt every millisecond to refresh the panels. This generally is what causes the ESP32 to crash and burn with hundreds of interrupts/second.

If the panels are dumb using shift registers then the limitation is on how quickly and brightly we can light the LED to get POV?
There will be a compromise fps, to get more panels and as you said may be dimmer?

What if we find the compromise then use muliple ESP32 to sync each other to drive many panels?

You could have an infinite size array of panels if you have a cluster of ESP's driving say a single 256x64 portion.

If you're displaying a static image it would be easier to sync (just crop the image up or something). If you wanted to display video or something... probably impossible.

I think if you wanted to go down this interesting route of multiple ESP32 driving one massive panel of sub-panels. You'd have 1) One 'master' ESP sending packets of bitmap data to all of them (via UDP or whatever), which gets stored on each sub-panel's ESP32's buffer.
2) A confirmation back from each sub-panel ESP32 they've got all the packet.
3) Then the master sends an 'OK, switch buffer!' message.

Frames per second would be limited to the throughput... would be super slow probably.

@Galaxy-Man
Copy link

Galaxy-Man commented Jul 31, 2020

New Dev version up and running and working with FM6126 panels. Is there any particular test you need me to do or shall I just run some of my code through it? I'll fully test when the other panels arrive which should be Monday. If these work then we could try pushing higher until it all falls over.

@Galaxy-Man
Copy link

Galaxy-Man commented Aug 3, 2020

Ok done a quick test and the panels are Chipone icnd2038s based (no reset required) not the FM6126 (reset required).

Not to worry they still work, even if two different chipset panels are chained together.

The main test we both were trying to do was multi panel? so who cares what chipset :-)

icn2038s.pdf

@Galaxy-Man
Copy link

Two different panels, good colour match no issues.

20200803_175521_resized

@Galaxy-Man
Copy link

Galaxy-Man commented Aug 4, 2020

Interesting use of the I2S DMA and Matrix Panels, I would guess you have seen these already.

https://github.com/yetifrisstlama/espirgbani_pio

https://esp32.com/viewtopic.php?t=3188

@Galaxy-Man
Copy link

Galaxy-Man commented Aug 4, 2020

FM6126A dataSheet in German but readable. Use Google to translate, it does a reasonable job of it.
Will continue to look for the english version.

FM6126A.de.pdf

Bob Davis with a good explaintion of the FM6126A panel reset.

http://bobdavis321.blogspot.com/2019/02/p3-64x32-hub75e-led-matrix-panels-with.html

@Galaxy-Man
Copy link

Galaxy-Man commented Aug 17, 2020

I have a full set of 4x FM 6126/6124 panels arriving this week I will test with the reset code and your library, I am sure it will be ok.

I will let you know how I get on.

@atc1441
Copy link

atc1441 commented Aug 20, 2020

Hey so since the FM6126 did not started correctly after a software reset it was needed to Reset the I2S hardware before a software reset and then send the FM6126 enable cmds again otherwise the GPIOs are allready in use and can not be accesed by a digitalWrite.

This is a function i use to reset the I2S:

void i2s_reset(i2s_dev_t *dev) {
dev->out_link.start = 0;
dev->conf.tx_start = 0;
dev->lc_conf.in_rst = 1; dev->lc_conf.out_rst = 1; dev->lc_conf.ahbm_rst = 1; dev->lc_conf.ahbm_fifo_rst = 1;
dev->lc_conf.in_rst = 0; dev->lc_conf.out_rst = 0; dev->lc_conf.ahbm_rst = 0; dev->lc_conf.ahbm_fifo_rst = 0;
dev->conf.tx_reset = 1; dev->conf.tx_fifo_reset = 1; dev->conf.rx_fifo_reset = 1;
dev->conf.tx_reset = 0; dev->conf.tx_fifo_reset = 0; dev->conf.rx_fifo_reset = 0;
}

Added this into the https://github.com/mrfaptastic/ESP32-RGB64x32MatrixPanel-I2S-DMA/blob/master/esp32_i2s_parallel.c file so it has all the dependences already. and also to the .h then it can be called from Arduino when needed.

Also the Enable function for the FM6126 on the top of this issue is quite long this on is a bit shorter, but not really better there is a lot of potential to make it "smarter":

int MaxLed = 256;

#define P_LAT 22
#define P_A 19
#define P_B 23
#define P_C 18
#define P_D 5
#define P_E 15
#define P_OE 2
#define CLK 14
#define R1 13
#define R2 27
#define G1 21
#define G2 17
#define B1 12
#define B2 4

void set_RGB(bool state) {
digitalWrite (R1, state);
digitalWrite (G1, state);
digitalWrite (B1, state);
digitalWrite (R2, state);
digitalWrite (G2, state);
digitalWrite (B2, state);
}
void init_matrix() {
bool C12[16] = {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
bool C13[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0};

pinMode(CLK, OUTPUT);
pinMode(P_LAT, OUTPUT);
pinMode(P_OE, OUTPUT);
pinMode(B1, OUTPUT);
pinMode(R1, OUTPUT);
pinMode(R2, OUTPUT);
pinMode(G1, OUTPUT);
pinMode(G2, OUTPUT);
pinMode(B2, OUTPUT);
pinMode(P_A, OUTPUT);
pinMode(P_B, OUTPUT);
pinMode(P_C, OUTPUT);
pinMode(P_D, OUTPUT);
pinMode(P_E, OUTPUT);

digitalWrite (P_OE, HIGH);
digitalWrite (P_LAT, LOW);
digitalWrite (CLK, LOW);

// Send Data to control register 11
for (int l = 0; l < MaxLed; l++) {
int y = l % 16;
set_RGB(LOW);
if (C12[y]) set_RGB(HIGH);
digitalWrite(P_LAT, (l > MaxLed - 12) ? HIGH : LOW);
digitalWrite(CLK, HIGH);
digitalWrite(CLK, LOW);
}
digitalWrite (P_LAT, LOW);
digitalWrite (CLK, LOW);

// Send Data to control register 12
for (int l = 0; l < MaxLed; l++) {
int y = l % 16;
set_RGB(LOW);
if (C13[y])set_RGB(HIGH);
digitalWrite(P_LAT, (l > MaxLed - 13) ? HIGH : LOW);
digitalWrite(CLK, HIGH);
digitalWrite(CLK, LOW);
}
digitalWrite (P_LAT, LOW);
digitalWrite (CLK, LOW);
}

Repository owner deleted a comment from Galaxy-Man Sep 16, 2020
Repository owner deleted a comment from Galaxy-Man Sep 16, 2020
Repository owner deleted a comment from Galaxy-Man Sep 16, 2020
Repository owner deleted a comment from Galaxy-Man Sep 16, 2020
Repository owner deleted a comment from Galaxy-Man Sep 16, 2020
Repository owner deleted a comment from Galaxy-Man Sep 16, 2020
Repository owner deleted a comment from Galaxy-Man Sep 16, 2020
Repository owner deleted a comment from Galaxy-Man Sep 16, 2020
Repository owner deleted a comment from Galaxy-Man Sep 16, 2020
Repository owner deleted a comment from Galaxy-Man Sep 16, 2020
Repository owner deleted a comment from Galaxy-Man Sep 16, 2020
@mrcodetastic
Copy link
Owner Author

@Galaxy-Man. All received! Thank you kindly, will start testing. Did you end up receiving any FM6126 based panels in the end? I think you did that they worked fine when chained with non-FM6126 panels?

Note: Cleaning up this issue to remove our messages to each other. Nothing personal :-)

@Galaxy-Man
Copy link

Galaxy-Man commented Sep 16, 2020 via email

@pilly52
Copy link

pilly52 commented Oct 1, 2020

@Galaxy-Man How did you finally achieve to chain FM6126 panels ? Using a single 64x32 panel (same ref as yours from amazon) works perfectly, but if I try to simply chain them, I'm getting the same image on both matrices.

Here is the code I'm using :

`// How to use this library with a FM6126 panel, thanks goes to:
// hzeller/rpi-rgb-led-matrix#746

#include <Arduino.h>
#include <ESP32-RGB64x32MatrixPanel-I2S-DMA.h>

RGB64x32MatrixPanel_I2S_DMA matrix;

////////////////////////////////////////////////////////////////////
// Reset Panel
// This needs to be near the top of the code
//
// Change these to whatever suits
// recommended settings and patches are by
//
// pinout for ESP38 38pin module
// http://arduinoinfo.mywikis.net/wiki/Esp32#KS0413_keyestudio_ESP32_Core_Board
//

// R1 | G1
// B1 | GND
// R2 | G2
// B2 | E
// A | B
// C | D
// CLK| LAT
// OE | GND

#define R1 25
#define G1 26
#define BL1 27
#define R2 5 // 21 SDA
#define G2 19 // 22 SDL
#define BL2 23
#define CH_A 12
#define CH_B 16
#define CH_C 17
#define CH_D 18
#define CH_E 14 // assign to pin if using two panels
#define CLK 2
#define LAT 32
#define OE 33

/////////////////////////////////////////////////////////////////
// how many pixels wide if you chain panels
// 4 panels of 64x32 is 256 wide.
int MaxLed = 128;

int C12[16] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
int C13[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0};

void resetPanel()
{
pinMode(CLK, OUTPUT);
pinMode(LAT, OUTPUT);
pinMode(OE, OUTPUT);
pinMode(R1, OUTPUT);
pinMode(G1, OUTPUT);
pinMode(BL1, OUTPUT);
pinMode(R2, OUTPUT);
pinMode(G2, OUTPUT);
pinMode(BL2, OUTPUT);
pinMode(CH_A, OUTPUT);
pinMode(CH_B, OUTPUT);
pinMode(CH_C, OUTPUT);
pinMode(CH_D, OUTPUT);
pinMode(CH_E, OUTPUT);

// Send Data to control register 11
digitalWrite(OE, HIGH); // Display reset
digitalWrite(LAT, LOW);
digitalWrite(CLK, LOW);
for (int l = 0; l < MaxLed; l++)
{
int y = l % 16;
digitalWrite(R1, LOW);
digitalWrite(G1, LOW);
digitalWrite(BL1, LOW);
digitalWrite(R2, LOW);
digitalWrite(G2, LOW);
digitalWrite(BL2, LOW);
if (C12[y] == 1)
{
digitalWrite(R1, HIGH);
digitalWrite(G1, HIGH);
digitalWrite(BL1, HIGH);
digitalWrite(R2, HIGH);
digitalWrite(G2, HIGH);
digitalWrite(BL2, HIGH);
}
if (l > MaxLed - 12)
{
digitalWrite(LAT, HIGH);
}
else
{
digitalWrite(LAT, LOW);
}
digitalWrite(CLK, HIGH);
digitalWrite(CLK, LOW);
}
digitalWrite(LAT, LOW);
digitalWrite(CLK, LOW);
// Send Data to control register 12
for (int l = 0; l < MaxLed; l++)
{
int y = l % 16;
digitalWrite(R1, LOW);
digitalWrite(G1, LOW);
digitalWrite(BL1, LOW);
digitalWrite(R2, LOW);
digitalWrite(G2, LOW);
digitalWrite(BL2, LOW);
if (C13[y] == 1)
{
digitalWrite(R1, HIGH);
digitalWrite(G1, HIGH);
digitalWrite(BL1, HIGH);
digitalWrite(R2, HIGH);
digitalWrite(G2, HIGH);
digitalWrite(BL2, HIGH);
}
if (l > MaxLed - 13)
{
digitalWrite(LAT, HIGH);
}
else
{
digitalWrite(LAT, LOW);
}
digitalWrite(CLK, HIGH);
digitalWrite(CLK, LOW);
}
digitalWrite(LAT, LOW);
digitalWrite(CLK, LOW);
}

// End of default setup for RGB Matrix 64x32 panel
/////////////////////////////////////////////////////////////////

void setup(){

resetPanel(); // do this before matrix.begin

// If you experience ghosting, you will need to reduce the brightness level, not all RGB Matrix
// Panels are the same - some seem to display ghosting artefacts at lower brightness levels.
// In the setup() function do something like:
// If using multi panels watch your power levels when running full brightness.

matrix.setPanelBrightness(10); // SETS THE BRIGHTNESS HERE. 60 OR LOWER IDEAL.
matrix.begin(R1, G1, BL1, R2, G2, BL2, CH_A, CH_B, CH_C, CH_D, CH_E, LAT, OE, CLK); // setup the LED matrix
matrix.setTextColor(matrix.color444(96, 0, 96)); // r,g,b
matrix.setCursor(1, 15);
matrix.println("Hello World");

}

void loop(){

}`

@mrcodetastic
Copy link
Owner Author

but if I try to simply chain them, I'm getting the same image on both matrices.

So both panels do work then when chained? Did you change the MATRIX_WIDTH in the .h file? The arduino/library doesn't know if you've chained panels unless you set the MATRIX_WIDTH to the pixel width of the chained panels. 2 x 64x32 panels = 128 for MATRIX_WIDTH for example etc.

@pilly52
Copy link

pilly52 commented Oct 1, 2020

I added it in the code with :

#define MATRIX_WIDTH 128
#define MATRIX_HEIGHT 32

I haven't modified the .h, but looking at the H if it's already defined it shouldn't overwrite it.

@mrcodetastic
Copy link
Owner Author

Can you hack the .h directly and set the width to 128 and see if it makes a difference? I have noticed some compilers don't respect defines not in the .h file itself.

@pilly52
Copy link

pilly52 commented Oct 1, 2020

That was it :) Thx for the hint !

@Galaxy-Man
Copy link

Morning mrfaptastic hope you are ok, sorry not replied to pilly52 earlier. It looks like i'm not getting notifications from Github to my mailbox.
I'm using VSC and your library is per project and not loaded anywhere in public folders. This was something that caused me a lot of issues earlier on with time libraries and 'TheOneMatrix' library aka yours. If pilly52 shows where to get panel I will order one and try it out and send on to you. Another pair of eyes is always useful.

@mrcodetastic
Copy link
Owner Author

mrcodetastic commented Nov 28, 2020

Another pair of eyes is always useful.

That is super kind of you. I have still yet to chain the 12 64x32 panels you kindly donated! Rest assured, now that it's closer to Christmas I'll have time to do this and test the memory capabilties. It seems the 64x64 panels and FM6126 are now pretty good with this library, so I might close this issue for now.

@daveythacher
Copy link

daveythacher commented Jan 9, 2022

I have still yet to chain the 12 64x32 panels

Just a warning there could be issues with long chains in terms of timing. This is a bit of a guess.

Edit:
Created #232 as this should help. It does nothing for the memory consumption. However, it could help the quality and/or refresh rate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants