Код: Выделить всё
disp.h
#pragma once
#include "Arduino_GFX.h"
#include
#define HSPI_SPI 2 //Use HSPI for ESP32S3 (https://github.com/espressif/arduino-es ... .h#L31-L43)
//Available spare pins one the dev board: r https://s.click.aliexpress.com/e/_EG1ZBqH
// Un comment if you want to use software based SPI.
// #define USE_SOFTWARE_SPI
class LCDDisplay{
public:
LCDDisplay(){
/****************************************************************
* The Pins used in the configuration are all based on the pin information provided by the display driver manufacturer:
* https://s.click.aliexpress.com/e/_EG1ZBqH
****************************************************************/
#ifdef USE_SOFTWARE_SPI
bus = new Arduino_SWSPI(GFX_NOT_DEFINED /* DC */, 42 /* CS */,
2 /* SCK */, 1 /* MOSI */, GFX_NOT_DEFINED /* MISO */);
#else
// Setup SPI bus (used only for sending commands to ST7701)
bus = new Arduino_ESP32SPI(
GFX_NOT_DEFINED /* No info from manufacturer about DC */, 42 /* CS */, 2 /* SCK */, 1 /* MOSI */, GFX_NOT_DEFINED, HSPI_SPI
);
#endif
// For 2.1" round display: https://github.com/moononournation/Ardu ... eclaration (ESP32-S3-RGB)
rgbpanel = new Arduino_ESP32RGBPanel(
40 /* DE */, 39 /* VSYNC */, 38 /* HSYNC */, 41 /* PCLK */,
46 /* R0 */, 3 /* R1 */, 8 /* R2 */, 18 /* R3 */, 17 /* R4 */,
14 /* G0 */, 13 /* G1 */, 12 /* G2 */, 11 /* G3 */, 10 /* G4 */, 9 /* G5 */,
5 /* B0 */, 45 /* B1 */, 48 /* B2 */, 47 /* B3 */, 21 /* B4 */,
1 /* hsync_polarity */, 10 /* hsync_front_porch */, 8 /* hsync_pulse_width */, 50 /* hsync_back_porch */,
1 /* vsync_polarity */, 10 /* vsync_front_porch */, 8 /* vsync_pulse_width */, 20 /* vsync_back_porch */
);
gfx = new Arduino_RGB_Display(
480 /* width */, 480 /* height */, rgbpanel, 0 /* rotation */, true /* auto_flush */,
bus, GFX_NOT_DEFINED /* RST */, st7701_type5_init_operations, sizeof(st7701_type5_init_operations));
}
void lcdInit(){
gfx->begin();
}
private:
Arduino_ESP32RGBPanel *rgbpanel = {nullptr};
Arduino_DataBus *bus = {nullptr};
Arduino_RGB_Display *gfx = {nullptr};
uint16_t color;
};
< /code>
Вот где я использую disp.h в main.ino: < /p>
#include "disp.h"
LCDDisplay *disp = nullptr;//LCDDisplay();
// the setup function runs once when you press reset or power the board
void setup() {
disp = new LCDDisplay();
disp->lcdInit();
}
// the loop function runs over and over again forever
void loop() {}
< /code>
После прошивки этого кода на плату Dev ESP32S3-Mini-1 он бросает журнал сбоя: < /p>
ELF file SHA256: 50f8e54a0
Rebooting...
��΄(��:�J19�L��!���Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4037cc89 PS : 0x00060730 A0 : 0x82004874 A1 : 0x3fca4b00
A2 : 0x00ffff00 A3 : 0xffffffff A4 : 0x04c4b400 A5 : 0x00000001
A6 : 0x02625a00 A7 : 0x02625a00 A8 : 0x82007725 A9 : 0x3fca4af0
A10 : 0x00000000 A11 : 0x00000001 A12 : 0x0000002b A13 : 0x000000ff
A14 : 0x000000ff A15 : 0x000002a0 SAR : 0x00000016 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00ffff40 LBEG : 0x40056f5c LEND : 0x40056f72 LCOUNT : 0xffffffff
Backtrace: 0x4037cc86:0x3fca4b00 0x42004871:0x3fca4b40 0x42005ed9:0x3fca4b60 0x42002889:0x3fca4b80 0x4200aa92:0x3fca4bb0 0x4037d16e:0x3fca4bd0
< /code>
Я сделал шаги дальше, чтобы исследовать адреса памяти Backtrace с использованием команды Xtensa-ESP32-ELF-ADDR2Line на моем терминале: < /p>
/Users/user/Library/Arduino15/packages/esp32/tools/esp-x32/2405/bin/xtensa-esp32s3-elf-addr2line \
-pfiaC \
-e /private/var/folders/q9/_c1p3yd166gdhr9586t0tfbr0000gn/T/arduino/sketches/155135A44E6DEF00AC4834AA2FAA2E7F/canTask.ino.elf \
0x4037cc86 0x42004871 0x42005ed9 0x42002889 0x4200aa92 0x4037d16e
< /code>
и из возвращенного журнала диагноза из вышеуказанной команды: < /p>
0x4037cc86: xQueueSemaphoreTake at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c:1713 (discriminator 1)
0x42004871: Arduino_ESP32SPI::begin(long, signed char) at /Users/user/Documents/Arduino/libraries/Arduino_GFX-master/src/databus/Arduino_ESP32SPI.cpp:284 (discriminator 1)
0x42005ed9: Arduino_RGB_Display::begin(long) at /Users/user/Documents/Arduino/libraries/Arduino_GFX-master/src/display/Arduino_RGB_Display.cpp:31
0x42002889: LCDDisplay::lcdInit() at /Users/user/Documents/Arduino/canTask/disp.h:57
(inlined by) setup() at /Users/user/Documents/Arduino/canTask/main.ino:31
0x4200aa92: loopTask(void*) at /Users/user/Library/Arduino15/packages/esp32/hardware/esp32/3.1.2/cores/esp32/main.cpp:59
0x4037d16e: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139
< /code>
Кто -нибудь понимает, в чем проблема? Согласно Chatgpt: «Инструмент addr2line показывает паническую цепочку: < /p>
lcdinit () → arduino_rgb_display :: begin () → arduino_esp32spi :: neply () → xqueueSemaphorek xqueuesemaphoretake () работает.
, который может произойти только в том случае, если bus-> begin () не выполнила (или выполнено после первого xqueuesemaphoretake () внутри arduino_esp32spi :: begin ()). «< /p>
может быть проблема, ребята? Я уверен, что проблема проистекает из функции lcdinit (), потому что каждый раз, когда я комментирую ее, сбои останавливаются.
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/796 ... -h-library