2dom / PxMatrix

Adafruit GFX compatible graphics driver for LED matrix panels
BSD 3-Clause "New" or "Revised" License
845 stars 171 forks source link

64x64 refuses to even give a light #334

Open jphnnss opened 8 months ago

jphnnss commented 8 months ago

I have some broken LED panels that Iwant tofix. To identify dead pixels, I want to use an esp32 to drive a white screen on the panel. No matter what i try, what libraries, I can't get it to work. No pixels light up. When I have the panel on and unconnected a stripe of green broken pixels lights up but when I connect the esp32 it all goes dark. I do Know that this panel does work with an MRV328 receiving card and whatever sending card my church uses. One time, I was using the esp32 Hub75 dma Matrix library and I got a couple lines that promptly disapeared after pressing the enable button. The problem with using that library is that it doesn't actually support the drivers that are on my panel. It has hc245, which needs 5v so I have a level shifter out of my esp32, ICN2012, and ICN2053 chips. I am using an esp32 devkit1. My panel is 64x64 but doesn't have an e pin so I assume it is 1/16 scan. Anything helps.

include

// Pins for LED MATRIX

ifdef ESP32

define P_LAT 16

define P_A 19

define P_B 23

define P_C 18

define P_D 5

define P_E 32

define P_OE 2

hw_timer_t * timer = NULL; portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;

endif

ifdef ESP8266

include

Ticker display_ticker;

define P_LAT 16

define P_A 5

define P_B 4

define P_C 15

define P_D 12

define P_E 32

define P_OE 22

endif

define matrix_width 64

define matrix_height 64

// This defines the 'on' time of the display is us. The larger this number, // the brighter the display. If too large the ESP will crash uint8_t display_draw_time=30; //30-70 is usually fine

//PxMATRIX display(64,64,P_LAT, P_OE,P_A,P_B,P_C); PxMATRIX display(64,64,P_LAT, P_OE,P_A,P_B,P_C,P_D); //PxMATRIX display(64,64,P_LAT, P_OE,P_A,P_B,P_C,P_D,P_E);

// Some standard colors uint16_t myRED = display.color565(255, 0, 0); uint16_t myGREEN = display.color565(0, 255, 0); uint16_t myBLUE = display.color565(0, 0, 255); uint16_t myWHITE = display.color565(255, 255, 255); uint16_t myYELLOW = display.color565(255, 255, 0); uint16_t myCYAN = display.color565(0, 255, 255); uint16_t myMAGENTA = display.color565(255, 0, 255); uint16_t myBLACK = display.color565(0, 0, 0);

uint16_t myCOLORS[8]={myRED,myGREEN,myBLUE,myWHITE,myYELLOW,myCYAN,myMAGENTA,myBLACK};

ifdef ESP8266

// ISR for display refresh void display_updater() { display.display(display_draw_time); }

endif

ifdef ESP32

void IRAM_ATTR display_updater(){ // Increment the counter and set the time of ISR portENTER_CRITICAL_ISR(&timerMux); display.display(display_draw_time); portEXIT_CRITICAL_ISR(&timerMux); }

endif

void display_update_enable(bool is_enable) {

ifdef ESP8266

if (is_enable) display_ticker.attach(0.004, display_updater); else display_ticker.detach();

endif

ifdef ESP32

if (is_enable) { timer = timerBegin(0, 80, true); timerAttachInterrupt(timer, &display_updater, true); timerAlarmWrite(timer, 4000, true); timerAlarmEnable(timer); } else { timerDetachInterrupt(timer); timerAlarmDisable(timer); }

endif

}

void setup() {

Serial.begin(9600); // Define your display layout here, e.g. 1/8 step, and optional SPI pins begin(row_pattern, CLK, MOSI, MISO, SS) display.begin(16); //display.begin(8, 14, 13, 12, 4);

// Define multiplex implemention here {BINARY, STRAIGHT} (default is BINARY) display.setMuxPattern(BINARY);

// Set the multiplex pattern {LINE, ZIGZAG,ZZAGG, ZAGGIZ, WZAGZIG, VZAG, ZAGZIG} (default is LINE) display.setScanPattern(LINE);

// Rotate display //display.setRotate(true);

// Flip display //display.setFlip(true);

// Control the minimum color values that result in an active pixel //display.setColorOffset(5, 5,5);

// Set the multiplex implemention {BINARY, STRAIGHT} (default is BINARY) //display.setMuxPattern(BINARY);

// Set the color order {RRGGBB, RRBBGG, GGRRBB, GGBBRR, BBRRGG, BBGGRR} (default is RRGGBB) //display.setColorOrder(RRGGBB);

// Set the time in microseconds that we pause after selecting each mux channel // (May help if some rows are missing / the mux chip is too slow) //display.setMuxDelay(0,1,0,0,0);

// Set the number of panels that make up the display area width (default is 1) //display.setPanelsWidth(2);

// Set the brightness of the panels (default is 255) //display.setBrightness(50);

// Set driver chip type //display.setDriverChip(SHIFT);

display.clearDisplay(); display.setTextColor(myCYAN); display.setCursor(2,0); display.print("Pixel"); display.setTextColor(myMAGENTA); display.setCursor(2,8); display.print("Time"); display_update_enable(true);

delay(3000);

} union single_double{ uint8_t two[2]; uint16_t one; } this_single_double;

// This draws the weather icons void draw_weather_icon (uint8_t icon) { if (icon>10) icon=10; for (int yy=0; yy<10;yy++) { for (int xx=0; xx<10;xx++) { uint16_t byte_pos=(xx+icon10)2+yy*220; this_single_double.two[1]=weather_icons[byte_pos]; this_single_double.two[0]=weather_icons[byte_pos+1]; display.drawPixel(1+xx,yy,this_single_double.one); } } }

unsigned long last_draw=0; void scroll_text(uint8_t ypos, unsigned long scroll_delay, String text, uint8_t colorR, uint8_t colorG, uint8_t colorB) { uint16_t text_length = text.length(); display.setTextWrap(false); // we don't wrap text so it scrolls nicely display.setTextSize(1); display.setRotation(0); display.setTextColor(display.color565(colorR,colorG,colorB));

// Asuming 5 pixel average character width
for (int xpos=matrix_width; xpos>-(matrix_width+text_length*5); xpos--)
{
  display.setTextColor(display.color565(colorR,colorG,colorB));
  display.clearDisplay();
  display.setCursor(xpos,ypos);
  display.println(text);
  delay(scroll_delay);
  yield();

  // This might smooth the transition a bit if we go slow
  // display.setTextColor(display.color565(colorR/4,colorG/4,colorB/4));
  // display.setCursor(xpos-1,ypos);
  // display.println(text);

  delay(scroll_delay/5);
  yield();

}

}

uint8_t icon_index=0; void loop() { scroll_text(1,50,"Welcome to PxMatrix!",96,96,250); display.clearDisplay();

draw_weather_icon(icon_index); icon_index++; if (icon_index>10) icon_index=0;

for (int xx=0; xx<16;xx++) { display.drawLine(xx+16,0,xx+16,5,display.color565(xx16,0,0)); display.drawLine(xx+16,6,xx+16,10,display.color565(0,xx16,0)); display.drawLine(xx+16,11,xx+16,15,display.color565(0,0,xx*16)); } delay(1000); for (uint8_t dimm=255; dimm>0; dimm--) { display.setBrightness(dimm); delay(5); } for (uint8_t dimm=0; dimm<255; dimm++) { display.setBrightness(dimm); delay(5); }

}

I deleted weather Icons because it is so long.

Rules

  1. Post your code
  2. Post a picture of the problem and describe what you expect to see
  3. Run the pattern test and post the result as gif/video (need to have a bit more than one full RED/YELLOW/WHITE cycle)
  4. State what version of PxMatrix you are running and what MicroController you use
radical-las commented 6 months ago

Hi, @jphnnss. I got 64x32 P4 Matrix, it also based on hc245 chip. I assume that our LED panels should use same mux pattern - SHIFTREG_ABC_BIN_DE. Also, you don't need to define e pin. And don't forget to check wiring, you need both connectors as shown in description of library (i messed up when wired my panel first time).

Setup code should be something like that:

void setup() {

Serial.begin(9600);
// Define your display layout here, e.g. 1/8 step, and optional SPI pins begin(row_pattern, CLK, MOSI, MISO, SS)
display.begin(16);

// Define multiplex implemention here {BINARY, STRAIGHT} (default is BINARY)
display.setMuxPattern(SHIFTREG_ABC_BIN_DE);

display.clearDisplay();
display.setTextColor(myCYAN);
display.setCursor(2,0);
display.print("Pixel");
display.setTextColor(myMAGENTA);
display.setCursor(2,8);
display.print("Time");
display_update_enable(true);

delay(3000);
}

For some reasons in latest releases PxMatrix lost support for bunch of mux patterns, but it is still present in master branch. I copied lost part of code to the latest release and made a fork link. For my LED panel it works. But beware I'm dummy programmer, so bugs might be somewhere.