Startup crashes with PSRAM enabled on ESP32-WROVER-E-N8R8 (Cache disabled but cached memory region accessed)
Posted: Thu Apr 18, 2024 10:31 am
Enabling PSRAM (CONFIG_PSRAM=y) causes startup code to crash consistently. Board works fine without PSRAM enabled.
Minimum PlatformIO project demonstrating the issue (enable/disable CONFIG_PSRAM in sdkconfig.defaults)
- Hardware: custom board using ESP32-WROVER-E-N8R8
- Toolchain: PlatformIO latest (platform=espressif32, framework=espidf), uses IDF 5.2.1
- OS: Linux Mint
Code: Select all
ets Jul 29 2019 12:21:46
rst:0x3 (SW_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:7172
load:0x40078000,len:15736
load:0x40080400,len:4
load:0x40080404,len:3944
entry 0x40080654
I (28) boot: ESP-IDF 5.2.1 2nd stage bootloader
I (29) boot: compile time Apr 18 2024 11:40:38
I (29) boot: Multicore bootloader
I (33) boot: chip revision: v3.0
I (37) boot.esp32: SPI Speed : 40MHz
I (42) boot.esp32: SPI Mode : DIO
I (46) boot.esp32: SPI Flash Size : 8MB
I (51) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (60) boot: ## Label Usage Type ST Offset Length
I (67) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (74) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (82) boot: 2 factory factory app 00 00 00010000 00100000
I (89) boot: End of partition table
I (93) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0dda0h ( 56736) map
I (122) esp_image: segment 1: paddr=0001ddc8 vaddr=3ffb0000 size=021bch ( 8636) load
I (126) esp_image: segment 2: paddr=0001ff8c vaddr=40080000 size=0008ch ( 140) load
I (128) esp_image: segment 3: paddr=00020020 vaddr=400d0020 size=18e58h (101976) map
I (174) esp_image: segment 4: paddr=00038e80 vaddr=4008008c size=0f370h ( 62320) load
I (207) boot: Loaded app from partition at offset 0x10000
I (207) boot: Disabling RNG early entropy source...
I (219) cpu_start: Multicore app
I (219) quad_psram: This chip is ESP32-D0WD
I (221) esp_psram: Found 8MB PSRAM device
I (221) esp_psram: Speed: 40MHz
I (225) esp_psram: PSRAM initialized, cache is in low/high (2-core) mode.
W (232) esp_psram: Virtual address not enough for PSRAM, map as much as we can. 4MB is mapped
D (242) cpu_start: Pro cpu up
D (245) cpu_start: Starting app cpu, entry point is 0x4008121c
D (0) cpu_start: App cpu up
I (1156) esp_psram: SPI SRAM memory test OK
D (1164) clk: RTC_SLOW_CLK calibration value: 3248832
I (1169) cpu_start: Pro cpu start user code
I (1169) cpu_start: cpu freq: 160000000 Hz
I (1169) cpu_start: Application information:
I (1174) cpu_start: Project name: test
I (1179) cpu_start: App version: 2e095ee-dirty
I (1185) cpu_start: Compile time: Apr 18 2024 11:40:27
I (1191) cpu_start: ELF file SHA256: 58613fd35...
I (1196) cpu_start: ESP-IDF: 5.2.1
I (1201) cpu_start: Min chip rev: v0.0
I (1206) cpu_start: Max chip rev: v3.99
I (1211) cpu_start: Chip rev: v3.0
D (1216) memory_layout: Checking 10 reserved memory ranges:
D (1221) memory_layout: Reserved memory range 0x3f800000 - 0x3fc00000
D (1228) memory_layout: Reserved memory range 0x3ff82000 - 0x3ff82000
D (1234) memory_layout: Reserved memory range 0x3ffae000 - 0x3ffae6e0
D (1241) memory_layout: Reserved memory range 0x3ffb0000 - 0x3ffb2a98
D (1247) memory_layout: Reserved memory range 0x3ffe0000 - 0x3ffe0440
D (1254) memory_layout: Reserved memory range 0x3ffe3f20 - 0x3ffe4350
D (1260) memory_layout: Reserved memory range 0x40070000 - 0x40078000
D (1267) memory_layout: Reserved memory range 0x40078000 - 0x40080000
D (1273) memory_layout: Reserved memory range 0x40080000 - 0x4008f3fc
D (1280) memory_layout: Reserved memory range 0x50001fe8 - 0x50002000
D (1286) memory_layout: Building list of available memory regions:
D (1293) memory_layout: Available memory region 0x3ffae6e0 - 0x3ffb0000
D (1299) memory_layout: Available memory region 0x3ffb2a98 - 0x3ffb8000
D (1306) memory_layout: Available memory region 0x3ffb8000 - 0x3ffc0000
D (1313) memory_layout: Available memory region 0x3ffc0000 - 0x3ffc2000
D (1319) memory_layout: Available memory region 0x3ffc2000 - 0x3ffc4000
D (1326) memory_layout: Available memory region 0x3ffc4000 - 0x3ffc6000
D (1333) memory_layout: Available memory region 0x3ffc6000 - 0x3ffc8000
D (1339) memory_layout: Available memory region 0x3ffc8000 - 0x3ffca000
D (1346) memory_layout: Available memory region 0x3ffca000 - 0x3ffcc000
D (1353) memory_layout: Available memory region 0x3ffcc000 - 0x3ffce000
D (1359) memory_layout: Available memory region 0x3ffce000 - 0x3ffd0000
D (1366) memory_layout: Available memory region 0x3ffd0000 - 0x3ffd2000
D (1373) memory_layout: Available memory region 0x3ffd2000 - 0x3ffd4000
D (1379) memory_layout: Available memory region 0x3ffd4000 - 0x3ffd6000
D (1386) memory_layout: Available memory region 0x3ffd6000 - 0x3ffd8000
D (1393) memory_layout: Available memory region 0x3ffd8000 - 0x3ffda000
D (1399) memory_layout: Available memory region 0x3ffda000 - 0x3ffdc000
D (1406) memory_layout: Available memory region 0x3ffdc000 - 0x3ffde000
D (1413) memory_layout: Available memory region 0x3ffde000 - 0x3ffe0000
D (1420) memory_layout: Available memory region 0x3ffe0440 - 0x3ffe3f20
D (1426) memory_layout: Available memory region 0x3ffe4350 - 0x3ffe8000
D (1433) memory_layout: Available memory region 0x3ffe8000 - 0x3fff0000
D (1440) memory_layout: Available memory region 0x3fff0000 - 0x3fff8000
D (1446) memory_layout: Available memory region 0x3fff8000 - 0x3fffc000
D (1453) memory_layout: Available memory region 0x3fffc000 - 0x40000000
D (1460) memory_layout: Available memory region 0x4008f3fc - 0x40090000
D (1466) memory_layout: Available memory region 0x40090000 - 0x40092000
D (1473) memory_layout: Available memory region 0x40092000 - 0x40094000
D (1480) memory_layout: Available memory region 0x40094000 - 0x40096000
D (1486) memory_layout: Available memory region 0x40096000 - 0x40098000
D (1493) memory_layout: Available memory region 0x40098000 - 0x4009a000
D (1500) memory_layout: Available memory region 0x4009a000 - 0x4009c000
D (1506) memory_layout: Available memory region 0x4009c000 - 0x4009e000
D (1513) memory_layout: Available memory region 0x4009e000 - 0x400a0000
I (1520) heap_init: Initializing. RAM available for dynamic allocation:
D (1527) heap_init: New heap initialised at 0x3ffae6e0
I (1532) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (1538) heap_init: New heap initialised at 0x3ffb2a98
I (1544) heap_init: At 3FFB2A98 len 0002D568 (181 KiB): DRAM
I (1550) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1556) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (1563) heap_init: New heap initialised at 0x4008f3fc
I (1568) heap_init: At 4008F3FC len 00010C04 (67 KiB): IRAM
I (1575) esp_psram: Adding pool of 4096K of PSRAM memory to heap allocator
D (1582) intr_alloc: Connected src 46 to int 2 (cpu 0)
Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed).
Core 0 register dump:
PC : 0x400e74ac PS : 0x00060734 A0 : 0x8008c218 A1 : 0x3ffe3a50
A2 : 0x3ff42000 A3 : 0x3ffe3ab0 A4 : 0x00000003 A5 : 0x00000003
A6 : 0x00000000 A7 : 0x00000003 A8 : 0x8008bef1 A9 : 0x3ffe3a20
A10 : 0x3ffe3ab0 A11 : 0x3ffe3a50 A12 : 0x00000003 A13 : 0xffffffff
A14 : 0x00000000 A15 : 0xfffffffe SAR : 0x00000020 EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000 LBEG : 0x400e7666 LEND : 0x400e7671 LCOUNT : 0x00000000
Backtrace: 0x400e74a9:0x3ffe3a50 0x4008c215:0x3ffe3a80 0x4008df0d:0x3ffe3ab0 0x4008325f:0x3ffe3af0 0x400d3709:0x3ffe3b20 0x4008333a:0x3ffe3b40 0x400d353b:0x3ffe3b70 0x400d194c:0x3ffe3bd0 0x400d1be5:0x3ffe3bf0 0x400815b6:0x3ffe3c30 0x400796d1:0x3ffe3c80 |<-CORRUPTED
#0 0x400e74a9:0x3ffe3a50 in __memcpy_aux at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/memcpy.S:130
#1 0x4008c215:0x3ffe3a80 in spi_flash_hal_common_command at /home/user/.platformio/packages/framework-espidf/components/hal/spi_flash_hal_common.inc:180
#2 0x4008df0d:0x3ffe3ab0 in memspi_host_read_id_hs at /home/user/.platformio/packages/framework-espidf/components/spi_flash/memspi_host_driver.c:99
#3 0x4008325f:0x3ffe3af0 in read_id_core at /home/user/.platformio/packages/framework-espidf/components/spi_flash/esp_flash_api.c:424
#4 0x400d3709:0x3ffe3b20 in esp_flash_read_chip_id at /home/user/.platformio/packages/framework-espidf/components/spi_flash/esp_flash_api.c:442
#5 0x4008333a:0x3ffe3b40 in esp_flash_init_main at /home/user/.platformio/packages/framework-espidf/components/spi_flash/esp_flash_api.c:351 (discriminator 2)
#6 0x400d353b:0x3ffe3b70 in esp_flash_init_default_chip at /home/user/.platformio/packages/framework-espidf/components/spi_flash/esp_flash_spi_init.c:367
#7 0x400d194c:0x3ffe3bd0 in do_core_init at /home/user/.platformio/packages/framework-espidf/components/esp_system/startup.c:333
#8 0x400d1be5:0x3ffe3bf0 in start_cpu0_default at /home/user/.platformio/packages/framework-espidf/components/esp_system/startup.c:467 (discriminator 3)
#9 0x400815b6:0x3ffe3c30 in call_start_cpu0 at /home/user/.platformio/packages/framework-espidf/components/esp_system/port/cpu_start.c:784
#10 0x400796d1:0x3ffe3c80 in ?? ??:0