fakefred / live-caption-badge

EECS 473 Project
0 stars 0 forks source link

SPI assertion fail #2

Open fakefred opened 4 hours ago

fakefred commented 4 hours ago

When running commit b7283ac on ESP32-C6-DevKitM-1, the following error message appears:

[omitted]
I (17444) epaper: caption_display: Received word "fat" (len=3)
I (17444) epaper: caption_display: Drawing "fat" (x=256:352, y=300:360, col=8, row=5)
I (17444) EPD_7in5_V2: EPD_Display_Part
I (17844) epaper: caption_display: Received word "little" (len=6)
I (17844) epaper: caption_display: Drawing "little" (x=384:576, y=300:360, col=12, row=5)
I (17844) EPD_7in5_V2: EPD_Display_Part
I (18254) epaper: caption_display: Received word "body" (len=4)
I (18254) epaper: caption_display: Drawing "body" (x=608:736, y=300:360, col=19, row=5)
I (18254) EPD_7in5_V2: EPD_Display_Part
I (18654) epaper: caption_display: Received word "off" (len=3)
I (18654) epaper: caption_display: Drawing "off" (x=0:96, y=360:420, col=0, row=6)
I (18654) EPD_7in5_V2: EPD_Display_Part
I (18804) main: EPD going to sleep
I (18804) EPD_7in5_V2: EPD_Init_Fast
I (18804) EPD_7in5_V2: EPD_Reset
I (18814) epaper: caption_display: Received word "the" (len=3)
I (18814) epaper: caption_display: Drawing "the" (x=128:224, y=360:420, col=4, row=6)
I (18814) EPD_7in5_V2: EPD_Display_Part

assert failed: spi_device_transmit spi_master.c:1266 (ret_trans == trans_desc)
Core  0 register dump:
--- Stack dump detected
MEPC    : 0x4080089e  RA      : 0x40806370  SP      : 0x40823a40  GP      : 0x4080dc94  
--- 0x4080089e: panic_abort at /home/fkfd/Projects/esp/esp-idf/components/esp_system/panic.c:463
0x40806370: __ubsan_include at /home/fkfd/Projects/esp/esp-idf/components/esp_system/ubsan.c:311

TP      : 0x40823c90  T0      : 0x37363534  T1      : 0x7271706f  T2      : 0x33323130  
S0/FP   : 0x00000079  S1      : 0x00000001  A0      : 0x40823a7c  A1      : 0x4080e1a1  
A2      : 0x00000001  A3      : 0x00000029  A4      : 0x00000001  A5      : 0x40810000  
A6      : 0x00000004  A7      : 0x76757473  S2      : 0x00000009  S3      : 0x40823b9e  
S4      : 0x4080e1a0  S5      : 0x00000080  S6      : 0x40810000  S7      : 0x00000000  
S8      : 0x00000000  S9      : 0x00000000  S10     : 0x00000000  S11     : 0x00000000  
T3      : 0x6e6d6c6b  T4      : 0x6a696867  T5      : 0x66656463  T6      : 0x62613938  
MSTATUS : 0x00001881  MTVEC   : 0x40800001  MCAUSE  : 0x00000007  MTVAL   : 0x00000000  
--- 0x40800001: _vector_table at /home/fkfd/Projects/esp/esp-idf/components/riscv/vectors_intc.S:54

MHARTID : 0x00000000  

--- Backtrace:

panic_abort (details=details@entry=0x40823a7c "assert failed: spi_device_transmit spi_master.c:1266 (ret_trans == trans_desc)") at /home/fkfd/Projects/esp/esp-idf/components/esp_system/panic.c:463
463    *((volatile int *) 0) = 0; // NOLINT(clang-analyzer-core.NullDereference) should be an invalid operation on targets
#0  panic_abort (details=details@entry=0x40823a7c "assert failed: spi_device_transmit spi_master.c:1266 (ret_trans == trans_desc)") at /home/fkfd/Projects/esp/esp-idf/components/esp_system/panic.c:463
#1  0x40806370 in esp_system_abort (details=details@entry=0x40823a7c "assert failed: spi_device_transmit spi_master.c:1266 (ret_trans == trans_desc)") at /home/fkfd/Projects/esp/esp-idf/components/esp_system/port/esp_system_chip.c:92
#2  0x4080c454 in __assert_func (file=file@entry=0x4201f7f6 "", line=line@entry=1266, func=<optimized out>, func@entry=0x42028888 <__func__.10> "", expr=expr@entry=0x4201ffbc "") at /home/fkfd/Projects/esp/esp-idf/components/newlib/assert.c:80
#3  0x42012736 in spi_device_transmit (handle=0x40813c0c, trans_desc=trans_desc@entry=0x40823b98) at /home/fkfd/Projects/esp/esp-idf/components/esp_driver_spi/src/gpspi/spi_master.c:1266
#4  0x4200c1d8 in spi_write_bytes (data=data@entry=0x4081ccf4 "", len=len@entry=13) at /home/fkfd/Mich/473/live-caption-badge/epaper/main/SPI.c:53
#5  0x4200b3f8 in EPD_SendData2 (pData=pData@entry=0x4081ccf4 "", len=len@entry=13) at /home/fkfd/Mich/473/live-caption-badge/epaper/main/EPD_7in5_V2.c:81
#6  0x4200b8e6 in EPD_7IN5_V2_Display_Part (blackimage=0x40813fe0 "", x_start=x_start@entry=128, y_start=y_start@entry=360, x_end=231, x_end@entry=224, y_end=y_end@entry=420) at /home/fkfd/Mich/473/live-caption-badge/epaper/main/EPD_7in5_V2.c:361
#7  0x4200b192 in caption_display () at /home/fkfd/Mich/473/live-caption-badge/epaper/main/epaper.c:133
#8  0x4200b260 in epaper_task (arg=<error reading variable: value has been optimized out>) at /home/fkfd/Mich/473/live-caption-badge/epaper/main/epaper.c:143
#9  0x408072a2 in vPortTaskWrapper (pxCode=<optimized out>, pvParameters=<optimized out>) at /home/fkfd/Projects/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c:255

ELF file SHA256: 74682deca

Rebooting...
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0xc (SW_CPU),boot:0x6c (SPI_FAST_FLASH_BOOT)
Saved PC:0x4001975a
SPIWP:0xee
mode:DIO, clock div:2
load:0x40875720,len:0x1804
load:0x4086c110,len:0xe2c
load:0x4086e610,len:0x2e5c
entry 0x4086c11a
I (27) boot: ESP-IDF v5.3.1-dirty 2nd stage bootloader
I (27) boot: compile time Nov  7 2024 14:56:17
I (28) boot: chip revision: v0.0
I (30) boot.esp32c6: SPI Speed      : 80MHz
I (35) boot.esp32c6: SPI Mode       : DIO
--- 0x4001975a: software_reset_cpu in ROM

Seems to be a problem with the SPI. We need to test on ESP32-S3 to see if it is reproducible.

kylerod22 commented 4 hours ago

image

From main.c, it looks like multiple tasks (main and epaper_task) are interacting with the EPaper, and thus the SPI driver. Maybe we should consider adding mutexes to the spi_write functions.