ESP32-WROOM-32 SPI crashed

lionelsab38
Posts: 1
Joined: Sat Nov 18, 2023 6:08 pm

ESP32-WROOM-32 SPI crashed

Postby lionelsab38 » Sat Nov 18, 2023 7:15 pm

<r>Hello,<br/>
I am an amateur in C and an expert in electronic design since more then 30 years.<br/>
I am working on a personal project on a MINI D1 ESP32 based on the module AZ-delivery EPS32-WROOM-32.<br/>
The goal of this project is to convert 18 channels Spectrum audio analyser.<br/>
Actually, the code is converting the right and left channels into 2048 FFT signals and crates the 18 channels to displays. These data have to be send to another MCU through a SPI single data.<br/>
When the code try to send the first data, the MCU goes into panic mode and reboot. See below :
<QUOTE><s>
</s>
<br/>
I (796) main: N° : 0 .tx_buffer : 170 <br/>
<br/>
I (796) check_trans_valid: check_trans_valid <br/>
I (806) check_trans_valid: check_trans_valid 2<br/>
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.<br/>
<br/>
Core 0 register dump:<br/>
PC : 0x400833c8 PS : 0x00060030 A0 : 0x80083cc7 A1 : 0x3ffc0d40<br/>
0x400833c8: check_trans_valid at C:/Espressif/frameworks/esp-idf-v5.1.1/components/driver/spi/gpspi/spi_master.c:768 (discriminator 13)<br/>
<br/>
A2 : 0x00000001 A3 : 0x3ffc0df8 A4 : 0x3f406550 A5 : 0x0000000c<br/>
A6 : 0x3ffafba0 A7 : 0x3ffafce0 A8 : 0x800833c8 A9 : 0x3ffc0cf0<br/>
A10 : 0x00000003 A11 : 0x3f406550 A12 : 0x3f405528 A13 : 0x00000326<br/>
A14 : 0x3f406550 A15 : 0x00000004 SAR : 0x00000004 EXCCAUSE: 0x0000001c <br/>
EXCVADDR: 0x00000061 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffb<br/>
0x400014fd: strlen in ROM<br/>
<br/>
0x4000150d: strlen in ROM<br/>
<br/>
<br/>
<br/>
Backtrace: 0x400833c5:0x3ffc0d40 0x40083cc4:0x3ffc0d80 0x40083e30:0x3ffc0da0 0x400d687c:0x3ffc0dc0 0x400e9edd:0x3ffc0e80 0x40089b55:0x3ffc0ea0<br/>
0x400833c5: check_trans_valid at C:/Espressif/frameworks/esp-idf-v5.1.1/components/driver/spi/gpspi/spi_master.c:766 (discriminator 13)<br/>
<br/>
0x40083cc4: spi_device_polling_start at C:/Espressif/frameworks/esp-idf-v5.1.1/components/driver/spi/gpspi/spi_master.c:1068 (discriminator 2)<br/>
<br/>
0x40083e30: spi_device_polling_transmit at C:/Espressif/frameworks/esp-idf-v5.1.1/components/driver/spi/gpspi/spi_master.c:1140<br/>
<br/>
0x400d687c: app_main at C:/Users/lionel.sabatier/Documents/Perso/Spectrum_Audio_FFT_ESP32/Spectrum_Audio_FFT_ESP32/main/Spectrum_Audio_FFT_ESP32_main.c:633 (discriminator 13)<br/>
<br/>
0x400e9edd: main_task at C:/Espressif/frameworks/esp-idf-v5.1.1/components/freertos/app_startup.c:208<br/>
<br/>
0x40089b55: vPortTaskWrapper at C:/Espressif/frameworks/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
ELF file SHA256: 23081d138c2c6b39<br/>
<br/>
Rebooting in 5 seconds...
<e>
</e></QUOTE>

To find the root cause of this crash, I place several traces in the code. The issue is in the file <QUOTE><s>
</s>spi_master.c<e>
</e></QUOTE> at the line spi_host_t *host = handle->host;<br/>

<CODE><s>

Code: Select all

</s><i>
</i>static SPI_MASTER_ISR_ATTR esp_err_t check_trans_valid(spi_device_handle_t handle, spi_transaction_t *trans_desc)
{
    static const char TAG[] = "check_trans_valid";
    ESP_LOGI(TAG, "check_trans_valid ");
    SPI_CHECK(handle!=NULL, "invalid dev handle", ESP_ERR_INVALID_ARG);
    ESP_LOGI(TAG, "check_trans_valid 2");

[b][u][i]    spi_host_t *host = handle->host;[/i][/u][/b]
    ESP_LOGI(TAG, "check_trans_valid 2q");
    const spi_bus_attr_t* bus_attr = host->bus_attr;
    ESP_LOGI(TAG, "check_trans_valid 2a");
    bool tx_enabled = (trans_desc->flags & SPI_TRANS_USE_TXDATA) || (trans_desc->tx_buffer);
    ESP_LOGI(TAG, "check_trans_valid 2z");
    bool rx_enabled = (trans_desc->flags & SPI_TRANS_USE_RXDATA) || (trans_desc->rx_buffer);
    ESP_LOGI(TAG, "check_trans_valid 2e");
    spi_transaction_ext_t *t_ext = (spi_transaction_ext_t *)trans_desc;
<e>
</e></CODE></r>

The code is written under Vscode with :
* Espressif IDF v1.6.5
* boot: ESP-IDF v5.1.1-dirty 2nd stage bootloader

I Would like to know how to solve the issue.
Is Someone can help me in this task ?

Regards
Lionelsab38

PS : Starting traces of the board :
<QUOTE><s>
</s>
<br/>
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:7084
ho 0 tail 12 room 4
load:0x40078000,len:15584
load:0x40080400,len:4
0x40080400: _init at ??:?

load:0x40080404,len:3876
entry 0x4008064c
I (31) boot: ESP-IDF v5.1.1-dirty 2nd stage bootloader
I (31) boot: compile time Nov 10 2023 11:32:32
I (31) boot: Multicore bootloader
I (36) boot: chip revision: v1.0
I (40) boot.esp32: SPI Speed : 40MHz
I (44) boot.esp32: SPI Mode : DIO
I (49) boot.esp32: SPI Flash Size : 4MB
I (53) boot: Enabling RNG early entropy source...
I (59) boot: Partition Table:
I (62) boot: ## Label Usage Type ST Offset Length
I (70) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (77) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (84) boot: 2 factory factory app 00 00 00010000 00100000
I (92) boot: End of partition table
I (96) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0c978h ( 51576) map
I (115) esp_image: segment 1: paddr=0001c9a0 vaddr=3ffb0000 size=022b4h ( 8884) load
I (118) esp_image: segment 2: paddr=0001ec5c vaddr=40080000 size=013bch ( 5052) load
I (123) esp_image: segment 3: paddr=00020020 vaddr=400d0020 size=1a66ch (108140) map
I (152) esp_image: segment 4: paddr=0003a694 vaddr=400813bc size=0d658h ( 54872) load
I (174) boot: Loaded app from partition at offset 0x10000
I (174) boot: Disabling RNG early entropy source...
I (186) cpu_start: Multicore app
I (186) cpu_start: Pro cpu up.
I (186) cpu_start: Starting app cpu, entry point is 0x40081314
0x40081314: call_start_cpu1 at C:/Espressif/frameworks/esp-idf-v5.1.1/components/esp_system/port/cpu_start.c:154
<e>
</e></QUOTE>

PS2 : my code in attachment
Attachments
Spectrum_Audio_FFT_ESP32_main.c
(25.54 KiB) Downloaded 3789 times

Who is online

Users browsing this forum: No registered users and 19 guests