Closed ahshah closed 1 year ago
Arduino board: Seeduino XIAO ESP32C3
Arduino IDE version (found in Arduino -> About Arduino menu): 2.2.1
List the steps to reproduce the problem:
#include <Adafruit_GFX.h> // Core graphics library #include <Adafruit_ST7789.h> // Hardware-specific library for ST7735 #include <SPI.h> //Display connections: #define TFT_RST -1 #define TFT_CS D6 #define TFT_DC D7 #define TFT_MISO D9 #define TFT_MOSI D10 #define TFT_SCLK D8 const uint16_t DIM_X = 320; const uint16_t DIM_Y = 170; SPIClass* hspi = NULL; Adafruit_ST7789* tft = NULL; void setup() { Serial.begin(9600); hspi = new SPIClass(HSPI); hspi->begin(TFT_SCLK, TFT_MISO, TFT_MOSI, TFT_CS); pinMode(TFT_CS, OUTPUT); pinMode(TFT_DC, OUTPUT); Serial.printf("Hello world: initial delay\n"); delay(5 * 1000); Serial.printf("SPI setup, TFT Program start\n"); } #define USE_HW_SPI void loop() { #ifdef USE_HW_SPI // This does *not* work tft = new Adafruit_ST7789(hspi, TFT_CS, TFT_DC, TFT_RST); #else // This works but is very slow ~ 2000 ms to update the full screen tft = new Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST); #endif // USE_HW_SPI tft->init(DIM_Y, DIM_X); tft->setRotation(1); tft->fillScreen(ST77XX_RED); delay(30 * 1000); }
Yields:
19:56:56.985 -> Rebooting... 19:56:56.985 -> ESP-ROM:esp32c3-api1-20210207 19:56:56.985 -> Build:Feb 7 2021 19:56:56.985 -> rst:0x3 (RTC_SW_SYS_RST),boot:0xa (SPI_FAST_FLASH_BOOT) 19:56:56.985 -> Saved PC:0x403818b8 19:56:56.985 -> SPIWP:0xee 19:56:56.985 -> mode:DIO, clock div:1 19:56:56.985 -> load:0x3fcd5810,len:0x438 19:56:56.985 -> load:0x403cc710,len:0x918 19:56:56.985 -> load:0x403ce710,len:0x25f4 19:56:56.985 -> entry 0x403cc710 19:56:57.050 -> Hello world: initial delay 19:57:02.040 -> SPI setup, TFT Program start 19:57:02.040 -> Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled. 19:57:02.040 -> 19:57:02.040 -> Core 0 register dump: 19:57:02.040 -> MEPC : 0x42002094 RA : 0x42000c8e SP : 0x3fc95340 GP : 0x3fc8bc00 19:57:02.072 -> TP : 0x3fc8b2e8 T0 : 0x4005890e T1 : 0x3fc94f1c T2 : 0x00000000 19:57:02.072 -> S0/FP : 0x3fc912a4 S1 : 0x01e84800 A0 : 0x00000000 A1 : 0xffffffff 19:57:02.072 -> A2 : 0xffffffff A3 : 0xffffffff A4 : 0xffffffff A5 : 0x00000001 19:57:02.072 -> A6 : 0xffffffff A7 : 0x003c4002 S2 : 0x00000000 S3 : 0x00000000 19:57:02.072 -> S4 : 0x00000000 S5 : 0x00000000 S6 : 0x00000000 S7 : 0x00000000 19:57:02.105 -> S8 : 0x00000000 S9 : 0x00000000 S10 : 0x00000000 S11 : 0x00000000 19:57:02.105 -> T3 : 0x00000000 T4 : 0x00000000 T5 : 0x00000000 T6 : 0x00000000 19:57:02.105 -> MSTATUS : 0x00001881 MTVEC : 0x40380001 MCAUSE : 0x00000005 MTVAL : 0x00000004 19:57:02.105 -> MHARTID : 0x00000000 19:57:02.105 -> 19:57:02.105 -> Stack memory: 19:57:02.105 -> Stack memory: 19:57:02.137 -> 3fc95340: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000140 0x00000000 0x3fc912a4 0x4200267e 19:57:02.137 -> 3fc95360: 0x00000000 0x3fc912a4 0x3fc912a4 0x420028ac 0x00000000 0x000000aa 0x3fc912a4 0x4200256e 19:57:02.137 -> 3fc95380: 0x00000000 0x3fc912a4 0x3fc8e838 0x420000e4 0x00000000 0x00000000 0x00000000 0x42004976 19:57:02.137 -> 3fc953a0: 0x00000000 0x00000000 0x00000000 0x403874a4 0x00000000 0x00000000 0x00000000 0x00000000 19:57:02.170 -> 3fc953c0: 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xbaad5678 0x00000160 0xabba1234 19:57:02.170 -> 3fc953e0: 0x00000154 0x3fc952c0 0x0000138b 0x3fc8ddbc 0x3fc8ddbc 0x3fc953e4 0x3fc8ddb4 0x00000018 19:57:02.170 -> 3fc95400: 0x8998cca4 0x47560bb5 0x3fc953e4 0x00000000 0x00000001 0x3fc933d4 0x706f6f6c 0x6b736154 19:57:02.170 -> 3fc95420: 0x6f29c700 0x00e1c9e3 0x00000000 0x3fc953d0 0x00000001 0x00000000 0x00000000 0x00000000 19:57:02.202 -> 3fc95440: 0x00000000 0x3fc8f474 0x3fc8f4dc 0x3fc8f544 0x00000000 0x00000000 0x00000001 0x00000000 19:57:02.202 -> 3fc95460: 0x00000000 0x00000000 0x42019624 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 19:57:02.202 -> 3fc95480: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 19:57:02.202 -> 3fc954a0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 19:57:02.236 -> 3fc954c0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 19:57:02.236 -> 3fc954e0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 19:57:02.236 -> 3fc95500: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 19:57:02.266 -> 3fc95520: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xf5000000 0xbaad5678 0x00000060 19:57:02.266 -> 3fc95540: 0xabba1234 0x00000054 0x00000000 0x3fc95548 0x00000000 0x00000000 0x00000000 0x3fc95560 19:57:02.266 -> 3fc95560: 0xffffffff 0x3fc95560 0x3fc95560 0x00000000 0x3fc95574 0xffffffff 0x3fc95574 0x3fc95574 19:57:02.266 -> 3fc95580: 0x00000001 0x00000001 0x00000000 0x0b00ffff 0x00000000 0xb33fffff 0x00000000 0xbaad5678 19:57:02.298 -> 3fc955a0: 0x00000160 0xabba1234 0x00000154 0x3fc95600 0x3fc95600 0x3fc95700 0x3fc956ff 0x00000000 19:57:02.298 -> 3fc955c0: 0x3fc955c4 0xffffffff 0x3fc955c4 0x3fc955c4 0x00000000 0x3fc955d8 0xffffffff 0x3fc955d8 19:57:02.298 -> 3fc955e0: 0x3fc955d8 0x00000000 0x00000100 0x00000001 0x6a00ffff 0x00000000 0xb33fffff 0x00000000 19:57:02.298 -> 3fc95600: 0xeadcdecb 0x876055ee 0x51ec5c2c 0xf28f4f81 0xa9698cff 0x823a4fe9 0x24583d20 0xeb1717e2 19:57:02.330 -> 3fc95620: 0x0ab14d20 0x39cd6eac 0x5e85c515 0x5569fb05 0x1275c70a 0x6433cad4 0x5e42ac92 0x4cd4b28d 19:57:02.330 -> 3fc95640: 0xaf7134ad 0x0a7d32f0 0x0ab0ab2f 0xc54943f3 0xd7b3aae6 0xd3899464 0x9a65969c 0xd52e6a8b 19:57:02.330 -> 3fc95660: 0xebabebd8 0x6ef85369 0xbe0f9e71 0xf8897783 0xb000a653 0xe9f4eea2 0x7fd0e100 0xa71a8f1c 19:57:02.330 -> 3fc95680: 0xf3e70821 0x39f2baa8 0x3e34dab8 0xc060f223 0xb28d9a06 0x28af4371 0x2d6043e8 0xb9f8eec8 19:57:02.363 -> 3fc956a0: 0xc5a575bf 0x836206c8 0x259a50a9 0xe4017fcd 0x4398ec50 0xdcee154f 0xaa2bca99 0xba658a52 19:57:02.363 -> 3fc956c0: 0x6d411b08 0x94ba3741 0x45d16ca0 0xaacf1176 0x632d9d94 0xf2d17203 0xd0d36e29 0x0dbc3824 19:57:02.363 -> 3fc956e0: 0xc4685b5b 0xe80716e7 0xf79da17a 0xf2d07680 0xe712e33c 0x1c6f2cfb 0x2d813269 0xf55f1e43 19:57:02.363 -> 3fc95700: 0xbaad5678 0x000000f8 0xabba1234 0x000000ec 0x00000100 0x00000100 0x00000002 0x4038481e 19:57:02.395 -> 3fc95720: 0x40384314 0x40383c08 0x403847c2 0x403847a6 0x3fc95844 0x3fc95844 0x3fc95844 0x3fc95844 19:57:02.395 -> 19:57:02.395 -> 19:57:02.395 -> 19:57:02.395 -> ELF file SHA256: bde8109236d91c10 19:57:02.460 -> 19:57:02.460 -> Rebooting... 19:57:02.460 -> ESP-ROM:esp32c3-api1-20210207
I believe the panic is the result of the underlying call in the Adafruit GFX library to the SPI driver's writePixels() call:
void Adafruit_SPITFT::writePixels(uint16_t *colors, uint32_t len, bool block, bool bigEndian) { if (!len) return; // Avoid 0-byte transfers // avoid paramater-not-used complaints (void)block; (void)bigEndian; #if defined(ESP32) if (connection == TFT_HARD_SPI) { if (!bigEndian) { hwspi._spi->writePixels(colors, len * 2); // Inbuilt endian-swap } else { hwspi._spi->writeBytes((uint8_t *)colors, len * 2); // Issue bytes direct } return; }
Around line 1008:
hwspi._spi->writePixels(colors, len * 2); // Inbuilt endian-swap
Commenting this line out, stops the panic- but then the screen doesn't work.
Yup, bad client side code- closing this.
Arduino board: Seeduino XIAO ESP32C3
Arduino IDE version (found in Arduino -> About Arduino menu): 2.2.1
List the steps to reproduce the problem:
Yields:
I believe the panic is the result of the underlying call in the Adafruit GFX library to the SPI driver's writePixels() call:
Around line 1008:
Commenting this line out, stops the panic- but then the screen doesn't work.