I’ve got P4 LED matrix with mux pattern SHIFTREG_ABC_BIN_DE and the only library that supports it – PxMatrix by 2dom. And it is abandoned for a couple of years, that why many issues are still opened.
So, the problem I faced with:
I’ve tried platforms v1.0.6 and v2.0.14 using WiFi and PxMatrix libraries, on both platforms, if LED matrix initialized before WiFi.begin() – board gets core panic.
On platform v2.0.14, if LED matrix initialized after WiFi.begin() and WiFi connection failed – board gets core panic. But if WiFi connected successfully, board seems to work fine until WiFi reconnection is required for any reason.
On platform v1.0.6, if LED matrix initialized after WiFi.begin() – board works fine, at least for dozens of minutes, didn’t tried for longer.
I’ve created issue on Espressif github – my issue. And that is where from I know what part of code causing this problem:
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);
}
Error log:
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:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4
assert failed: xQueueSemaphoreTake queue.c:1554 (!( ( xTaskGetSchedulerState() == ( ( BaseType_t ) 0 ) ) && ( xTicksToWait != 0 ) ))
Backtrace: 0x40083b91:0x3ffbf38c |<-CORRUPTED
#0 0x40083b91:0x3ffbf38c in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:408
I tried:
- change IDE from VS Code + PlatfromIO + ArduinoFramework to Arduino IDE, but no effect.
- replace display part with a flag and trigger it in main loop as guy from Espressif team told me in my issue on github, but matrix start to flicker and updates not correctly.
- get rid of this part of code and just update display in main loop, but again matrix start to flicker and updates not correctly.
- change display_draw_time to lower values, still no effect.
- initialize WiFi and LED matrix in different order and different delays in between, no use.
I’m just a hobbyist and I need a helping hand to solve this problem.
Here is minimal code based on author’s examples to reproduce the problem:
#include <Arduino.h>
#include <PxMatrix.h>
#include <WiFi.h>
const char *ssid = "ssid";
const char *password = "password";
#define P_LAT 22
#define P_A 19
#define P_B 23
#define P_C 18
#define P_D 5
#define P_OE 16
#define MATRIX_WIDTH 64
#define MATRIX_HEIGHT 32
#define PxMATRIX_double_buffer true
PxMATRIX display(MATRIX_WIDTH, MATRIX_HEIGHT, P_LAT, P_OE, P_A, P_B, P_C, P_D);
// 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
// 10-50 is usually fine
uint8_t display_draw_time = 10;
hw_timer_t *timer = NULL;
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;
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);
}
void display_update_enable(bool is_enable) {
if (is_enable) {
timer = timerBegin(0, 80, true);
timerAttachInterrupt(timer, &display_updater, true);
timerAlarmWrite(timer, 2000, true);
timerAlarmEnable(timer);
} else {
timerDetachInterrupt(timer);
timerAlarmDisable(timer);
}
}
void setup() {
Serial.begin(115200);
display.begin(16);
display.setMuxPattern(SHIFTREG_ABC_BIN_DE);
display.setFastUpdate(true);
display.setTextWrap(false);
display.clearDisplay();
display_update_enable(true);
display.showBuffer();
WiFi.begin(ssid, password);
}
void loop() {
delay(1000);
}
user24881949 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.