← index #6166Issue #5942
Related · high · value 2.691
QUERY · ISSUE

ESP32-spiram - UART panic error

openby pidou46opened 2020-06-18updated 2026-03-21
port-esp32proposed-close

Hello,

I get a panic error when trying to initialize UART port, with ESP32-spiram firmware.

I have tried with the stable V1.12 and the latest:

`[quote]MicroPython v1.12-553-gc521c178e on 2020-06-18; ESP32 module (spiram) with ESP32
Type "help()" for more information.

from machine import UART, PIn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: can't import name PIn
from machine import UART, Pin
uart=UART(2, 9600)

Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400dfb48 PS : 0x00060d30 A0 : 0x800d2dc9 A1 : 0x3ffce8b0
A2 : 0x3f8177c0 A3 : 0x000000b1 A4 : 0x3ffce8d0 A5 : 0xff1d0000
A6 : 0x00000001 A7 : 0x000000ff A8 : 0x00000019 A9 : 0x3ffce890
A10 : 0xff1d0000 A11 : 0x00000001 A12 : 0x00000001 A13 : 0x3ffc2338
A14 : 0x00000003 A15 : 0x3ffce990 SAR : 0x00000000 EXCCAUSE: 0x0000001c
EXCVADDR: 0xff1d001c LBEG : 0x400d2fe0 LEND : 0x400d3038 LCOUNT : 0x00000000

ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000

Backtrace: 0x400dfb48:0x3ffce8b0 0x400d2dc6:0x3ffce8d0 0x400f74ec:0x3ffce910 0x400d303b:0x3ffce930 0x400d3364:0x3ffce950 0x400d2974:0x3ffce970 0x400d621d:0x3ffce990 0x400d62e1:0x3ffce9b0 0x400d6c09:0x3ffce9d0 0x4010741e:0x3ffcea50 0x40107531:0x3ffceae0 0x400f739d:0x3ffceb10 0x4009571e:0x3ffceb40

Rebooting...
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:0x3fff0018,len:4
load:0x3fff001c,len:5008
ho 0 tail 12 room 4
load:0x40078000,len:11608
ho 0 tail 12 room 4
load:0x40080400,len:6120
entry 0x400806bc
I (615) psram: This chip is ESP32-D0WD
I (615) spiram: Found 64MBit SPI RAM device
I (615) spiram: SPI RAM mode: flash 40m sram 40m
I (618) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (625) cpu_start: Pro cpu up.
I (629) cpu_start: Application information:
I (634) cpu_start: Compile time: Jun 18 2020 00:56:09
I (640) cpu_start: ELF file SHA256: 0000000000000000...
I (646) cpu_start: ESP-IDF: v3.3.2
I (651) cpu_start: Starting app cpu, entry point is 0x40083574
I (641) cpu_start: App cpu up.
I (1526) spiram: SPI SRAM memory test OK
I (1527) heap_init: Initializing. RAM available for dynamic allocation:
I (1527) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (1533) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (1539) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (1546) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (1552) heap_init: At 3FFCABA8 len 00015458 (85 KiB): DRAM
I (1558) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1564) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1571) heap_init: At 4009A528 len 00005AD8 (22 KiB): IRAM
I (1577) cpu_start: Pro cpu start user code
I (254) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
MicroPython v1.12-553-gc521c178e on 2020-06-18; ESP32 module (spiram) with ESP32
Type "help()" for more information.[/quote]`

The error can rise immediately or after some delay.

CANDIDATE · ISSUE

ESP32-CAM Guru Meditation Error: Core 1 panic'ed (LoadStoreAlignment)

closedby sky5mediaopened 2020-04-19updated 2020-06-22
port-esp32

Hello,

I am trying to build latest micropython for ESP32-CAM. Board has 8M PSRAM chip (IPUS IPS1704L-SQ)

Development Board: ESP32-CAM
Module or chip used: ESP32-S
IDF version: v3.3 / v4.0 (tried both)
Build System: Make
Compiler version: xtensa-esp32-elf-gcc (crosstool-NG esp-2019r2) 8.2.0

When trying to allocate 160 KB buffer with:
heap_caps_calloc(_fb2->size, 1, MALLOC_CAP_SPIRAM)
I am getting Guru Meditation Error
Guru Meditation Error: Core 1 panic'ed (LoadStoreAlignment). Exception was unhandled.

I tried both CONFIG_SPIRAM_USE_CAPS_ALLOC=y and CONFIG_SPIRAM_USE_MALLOC=y
same result

Some debugging info:

heap_caps_get_free_size(MALLOC_CAP_DEFAULT) -> -1431534259 (negative)
heap_caps_get_free_size(MALLOC_CAP_INTERNAL) -> 172184
heap_caps_get_free_size(MALLOC_CAP_SPIRAM) -> -1431655771 (negative)
heap_caps_get_free_size(MALLOC_CAP_8BIT) -> -1431501531 (negative)
heap_caps_get_free_size(MALLOC_CAP_32BIT) -> -1431483587 (negative)
heap_caps_get_free_size(MALLOC_CAP_DMA) -> 154240

esp_get_free_heap_size() -> 2863433037
esp_spiram_get_size() -> 8388608
esp_himem_get_free_size() -> 4325376
esp_himem_get_phys_size() -> 4325376
esp_himem_reserved_area_size() -> 131072

Please notice that heap_caps_get_free_size(MALLOC_CAP_SPIRAM) returns negative value.

himem API seems to be working and can recognize and use PSRAM chip.

When using CONFIG_SPIRAM_USE_MEMMAP=y
heap_caps_get_free_size(MALLOC_CAP_SPIRAM) is obviously 0, but
(uint8_t*) calloc(_fb2->size, 1);
ain't working either

When dumping or trying to get info about heap with MALLOC_CAP_SPIRAM getting same Guru Meditation Error after which device restarts

Same behavior on 2 different boards of the same type

Board images:

20200416_221611
20200416_221634

Depending on CONFIG_SPIRAM_USE I am getting Guru Meditation Error either when calling :
(uint8_t*) calloc(_fb2->size, 1);

or when doing:
(uint8_t*) heap_caps_calloc(_fb2->size, 1, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);

Debug Logs

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:5200
ho 0 tail 12 room 4
load:0x40078000,len:14032
load:0x40080400,len:3800
entry 0x4008063c
I (579) psram: This chip is ESP32-D0WD
I (579) spiram: Found 64MBit SPI RAM device
I (579) spiram: SPI RAM mode: flash 40m sram 40m
I (582) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (589) cpu_start: Pro cpu up.
I (593) cpu_start: Application information:
I (598) cpu_start: Compile time:     Apr 16 2020 21:10:15
I (604) cpu_start: ELF file SHA256:  0000000000000000...
I (610) cpu_start: ESP-IDF:          v4.0
I (614) cpu_start: Starting app cpu, entry point is 0x40083484
I (606) cpu_start: App cpu up.
I (1463) spiram: SPI SRAM memory test OK
I (1464) heap_init: Initializing. RAM available for dynamic allocation:
I (1464) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (1470) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (1476) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (1482) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (1489) heap_init: At 3FFCCD18 len 000132E8 (76 KiB): DRAM
I (1495) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1501) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1508) heap_init: At 4009B9C4 len 0000463C (17 KiB): IRAM
I (1514) cpu_start: Pro cpu start user code
I (1519) spiram: Adding pool of 3968K of external SPI memory to heap allocator
I (1551) esp_himem: Initialized. Using last 4 32KB address blocks for bank switching on 4224 KB of physical memory.
I (1552) spi_flash: detected chip: generic
I (1556) spi_flash: flash io: dio
I (1561) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (1571) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
MicroPython v1.12-263-g8d34344dc-dirty on 2020-04-16; ESP32 module (spiram) with ESP32
Type "help()" for more information.
import camera
camera.init()
I (1060751) sccb: pin_sda 26 pin_scl 27

I (1060751) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (1060881) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1060881) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1060891) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1060901) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1060911) gpio: GPIO[21]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1060921) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1060931) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1060941) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1060951) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1060961) gpio: GPIO[23]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1060971) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1060981) camera: Allocating 1 frame buffers (160 KB total)

Guru Meditation Error: Core  1 panic'ed (LoadStoreAlignment). Exception was unhandled.
Core 1 register dump:
PC      : 0x40094aee  PS      : 0x00060133  A0      : 0x80096a82  A1      : 0x3ffd8820
A2      : 0x66555559  A3      : 0x00060520  A4      : 0x00000001  A5      : 0x0000abab
A6      : 0xb33fffff  A7      : 0x00000001  A8      : 0x0000cdcd  A9      : 0x3ffd8920
A10     : 0x0000abab  A11     : 0x00000000  A12     : 0x00000003  A13     : 0x3ffc8534
A14     : 0x3ffba7ec  A15     : 0x00000000  SAR     : 0x00000004  EXCCAUSE: 0x00000009
EXCVADDR: 0x66555559  LBEG    : 0x400973ad  LEND    : 0x400973bd  LCOUNT  : 0xfffffff8

ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000

Backtrace: 0x40094aeb:0x3ffd8820 0x40096a7f:0x3ffd8850 0x40096ab4:0x3ffd8870 0x40085c64:0x3ffd88a0 0x40085c9a:0x3ffd88c0 0x40098a92:0x3ffd88e0 0x40098ab4:0x3ffd8900 0x4016ae0d:0x3ffd8920 0x4016b285:0x3ffd89d0 0x400fbb07:0x3ffd8a00 0x400e3d6b:0x3ffd8a20 0x400dfdd1:0x3ffd8a40 0x400dff0a:0x3ffd8a60 0x400ee063:0x3ffd8a80 0x400e3f40:0x3ffd8b20 0x400dfdd1:0x3ffd8b70 0x400dfdfa:0x3ffd8b90 0x40106468:0x3ffd8bb0 0x4010668a:0x3ffd8c40 0x400f7224:0x3ffd8c80 0x40093df9:0x3ffd8cb0

Rebooting...

According to
I (1519) spiram: Adding pool of 3968K of external SPI memory to heap allocator
SPIRAM should be added to heap, but when trying to allocate a buffer or dump or get info about heap with caps MALLOC_CAP_SPIRAM getting
Guru Meditation Error: Core 1 panic'ed (LoadStoreAlignment). Exception was unhandled.
and board restarts

CONFIG_ESP32_SPIRAM_SUPPORT=y
CONFIG_SPIRAM_BOOT_INIT=y

CONFIG_SPIRAM_USE_MEMMAP=
CONFIG_SPIRAM_USE_CAPS_ALLOC=
CONFIG_SPIRAM_USE_MALLOC=y

CONFIG_SPIRAM_TYPE_ESPPSRAM64=y
CONFIG_SPIRAM_SIZE=-1
CONFIG_SPIRAM_SPEED_40M=y
CONFIG_SPIRAM_MEMTEST=y
CONFIG_SPIRAM_CACHE_WORKAROUND=y
CONFIG_SPIRAM_BANKSWITCH_ENABLE=y
CONFIG_SPIRAM_BANKSWITCH_RESERVE=4
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=


CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y 
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
CONFIG_ESP32_XTAL_FREQ_AUTO=y 

# v3.3-only (renamed in 4.0)
CONFIG_SPIRAM_SUPPORT=y


# FreeRTOS
CONFIG_SUPPORT_STATIC_ALLOCATION=y
CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK=y

# UDP
CONFIG_PPP_SUPPORT=y
CONFIG_PPP_PAP_SUPPORT=y
CONFIG_PPP_CHAP_SUPPORT=y 

Tried in 2 same boards from different producer, Espressif and DM DIY More with same results.

I spent 5 days trying to debug the problem without any luck, please help!

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied