ESP32 crashes on SPI usage
Attempting to use HSPI on an ESP32-WROOM module fails with a guru meditation:
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_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:0x3fff0018,len:4
load:0x3fff001c,len:4928
ho 0 tail 12 room 4
load:0x40078000,len:9332
load:0x40080400,len:6216
entry 0x400806e8
I (433) cpu_start: Pro cpu up.
I (434) cpu_start: Application information:
I (434) cpu_start: Compile time: 07:44:16
I (436) cpu_start: Compile date: May 29 2019
I (441) cpu_start: ESP-IDF: v3.3-beta1-268-g5c88c5996
I (448) cpu_start: Starting app cpu, entry point is 0x4008294c
I (0) cpu_start: App cpu up.
I (458) heap_init: Initializing. RAM available for dynamic allocation:
I (465) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (471) heap_init: At 3FFB9B88 len 00026478 (153 KiB): DRAM
I (477) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (484) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (490) heap_init: At 40093398 len 0000CC68 (51 KiB): IRAM
I (496) cpu_start: Pro cpu start user code
I (67) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
MicroPython v1.11 on 2019-05-29; ESP32 module with ESP32
Type "help()" for more information.
>>> from machine import SPI, Pin
>>> SPI(1, sck=Pin(14), mosi=Pin(13), miso=Pin(12))
I (390583) gpio: GPIO[14]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400ff550: ffffffff ffffffff ffffffff
Core 1 register dump:
PC : 0x400ff556 PS : 0x00060330 A0 : 0x800fe580 A1 : 0x3ffc15d0
A2 : 0x00000001 A3 : 0x3ffc1674 A4 : 0x00000001 A5 : 0x3f41f558
A6 : 0x3ffe8494 A7 : 0x00000034 A8 : 0x800ff516 A9 : 0x3ffc15b0
A10 : 0xffffffff A11 : 0x00001000 A12 : 0x00049038 A13 : 0x00000021
A14 : 0x3ffc1828 A15 : 0x0000002e SAR : 0x0000000b EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
Backtrace: 0x400ff556:0x3ffc15d0 0x400fe57d:0x3ffc1610 0x400f3587:0x3ffc1650 0x400f3667:0x3ffc16f0 0x400ed715:0x3ffc1760 0x400e517e:0x3ffc17a0 0x400dbf7d:0x3ffc17c0 0x400dbfe5:0x3ffc17e0 0x400e920b:0x3ffc1800 0x400dfdfc:0x3ffc18a0 0x400dbf7d:0x3ffc1920 0x400dbfaa:0x3ffc1940 0x400f7666:0x3ffc1960 0x400f78b0:0x3ffc1a00 0x400f00dc:0x3ffc1a40 0x4009086d:0x3ffc1a70
Rebooting...
This was using https://micropython.org/resources/firmware/esp32-idf3-20190529-v1.11.bin.
Multiple crashes when using UART (ESP32-S on ESP32-CAM)
I'm using MicroPython 1.19.1 on the ESP32-CAM (ESP32_SPIRAM). I used the precompiled binary esp32spiram-20220618-v1.19.1.bin on micropython.org.
I am seeing multiple issues when playing around with UART. A lot of the errors are Guru meditation errors (LoadProhibited), with both low addresses and really scrambled addresses in the register dump. Just now I got a different error: MemoryError: NLR jump failed, val=0x3f817780. What triggers the errors is a uart instance .init(...) after de-initializing or .read().
Here's the latest crash, along with all the code running when it happened:
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_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:4540
ho 0 tail 12 room 4
load:0x40078000,len:12788
load:0x40080400,len:4176
entry 0x40080680
MicroPython v1.19.1 on 2022-06-18; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> from machine import UART
>>> rx = UART(1)
>>> rx.init(9600, bits=8, parity=0, stop=1, rx=14)
>>> rx.any()
0
>>> rx.any()
15
>>> rx.read()
b'ok now see this'
>>> rx.read()
>>> rx.read()
b'ok now see this'
>>> while True:
... if rx.any(): print(rx.read())
...
MemoryError: NLR jump failed, val=0x3f817780
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:4540
ho 0 tail 12 room 4
load:0x40078000,len:12788
load:0x40080400,len:4176
entry 0x40080680
MicroPython v1.19.1 on 2022-06-18; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>>
I'll grab a dump next time the guru stops meditating. :stuck_out_tongue: