hideakitai / ESP32DMASPI

SPI library for ESP32 which use DMA buffer to send/receive transactions
MIT License
172 stars 37 forks source link

My program is executing "master.begin();" crashed #64

Closed piul200 closed 4 weeks ago

piul200 commented 4 weeks ago

5JTB%I1L3D} W0M@Y$AG@6I

ELF file SHA256: 8e95fda5b922372e

Re-entered core dump! Exception happened during core dump! Rebooting... ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT) Saved PC:0x4202231e SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3808,len:0x4bc load:0x403c9700,len:0xbd8 load:0x403cc700,len:0x2a0c entry 0x403c98d0 Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception). Debug exception reason: Stack canary watchpoint triggered (spi_master_task) Core 1 register dump: PC : 0x4037ce53 PS : 0x00060936 A0 : 0x8037ad0b A1 : 0x3fcec240 A2 : 0x3fcf0810 A3 : 0xb33fffff A4 : 0x0000cdcd A5 : 0x00060923 A6 : 0x00060920 A7 : 0x0000abab A8 : 0xb33fffff A9 : 0xffffffff A10 : 0x00060923 A11 : 0x00000000 A12 : 0x00060920 A13 : 0x0000000c A14 : 0x02cf0810 A15 : 0x00ffffff SAR : 0x0000001f EXCCAUSE: 0x00000001 EXCVADDR: 0x00000000 LBEG : 0x400570e8 LEND : 0x400570f3 LCOUNT : 0x00000000

Backtrace: 0x4037ce50:0x3fcec240 0x4037ad08:0x3fcec280 0x4037adc0:0x3fcec2c0 0x4037867d:0x3fcec2e0 0x40378755:0x3fcec310 0x40378824:0x3fcec330 0x4201887a:0x3fcec360 0x4201b8a1:0x3fcec670 0x420235f5:0x3fcec6a0 0x4200dfbe:0x3fcec6d0 0x4200e053:0x3fcec700 0x4200352e:0x3fcec780 0x4200418d:0x3fcec830 0x42001d1b:0x3fcec880

hideakitai commented 4 weeks ago

What is the version of Arduino-esp32?

Can you run the example as is without crashing? For example https://github.com/hideakitai/ESP32DMASPI/blob/main/examples/transfer_big_data_one_by_one/transfer_big_data_one_by_one_master/transfer_big_data_one_by_one_master.ino

piul200 commented 4 weeks ago

My development environment is vscode+platformio (Core 6.1.15 Home 3.4.4). I try to run this example, but it still crashes. I removed "master.begin();" and the program didn't crash, but doing so would cause DMASPI to not work

hideakitai commented 4 weeks ago

What is the version of the esp32 on Platformio? (Please give me your platformio.ini)

https://docs.platformio.org/en/latest/platforms/espressif32.html

Please try adding monitor_filters = esp32_exception_decoder to the example's platformio.ini to decode the backtrace. After running and crashing again, please give me your log again.

piul200 commented 4 weeks ago

Thanks for your reply, here is my platformio.ini and the log of the program crashing again

[env:4d_systems_esp32s3_gen4_r8n16]
platform = espressif32
board = 4d_systems_esp32s3_gen4_r8n16
framework = arduino
lib_deps = hideakitai/ESP32DMASPI@^0.6.3
monitor_filters = esp32_exception_decoder

log.txt

hideakitai commented 4 weeks ago

Thank you! Could you try again with build_flags = -DCORE_DEBUG_LEVEL=4 to your platformio.ini? I need this flag and debug log to determine the cause of the panic.

piul200 commented 4 weeks ago

Okay, here's the new log

[env:4d_systems_esp32s3_gen4_r8n16]
platform = espressif32
board = 4d_systems_esp32s3_gen4_r8n16
framework = arduino
lib_deps = hideakitai/ESP32DMASPI@^0.6.3
monitor_filters = esp32_exception_decoder
build_flags = -DCORE_DEBUG_LEVEL=4

log_1.txt

hideakitai commented 4 weeks ago

Can you try the following begin() (with arguments) method instead of begin() (empty argment)?

  master.begin(HSPI, SCK, MISO, MOSI, SS);
piul200 commented 4 weeks ago

Thanks for your help, I ran with master.begin(FSPI,12,13,11,10); and the program worked successfully. Now my console is constantly printing the following information at a very fast frequency, is this normal?

[  3199][D][ESP32DMASPIMaster.h:161] spi_master_task(): [ESP32DMASPIMaster] new transaction request received (size = 1)
[  3212][D][ESP32DMASPIMaster.h:187] spi_master_task(): [ESP32DMASPIMaster] transaction complete: 2048 bits (256 bytes) received
[  3223][D][ESP32DMASPIMaster.h:210] spi_master_task(): [ESP32DMASPIMaster] all requested transactions completed
hideakitai commented 4 weeks ago

OK, thank you for testing.

Yes, because you are sending the data as fast as possible in the loop() (no delay())