Skip to content

External PSRAM not supported? #5751

Closed
Closed
@jgamble-simple

Description

@jgamble-simple

Hardware:

Board: Custom board based on ESP32-WROVER-E
Core Installation version: 1.0.6
IDE name: Platform.io
PSRAM enabled: yes
Upload Speed: 230400
Computer OS: Windows 10 (Using wsl for uploading/platform.io)

Description:

Calling heap_caps_malloc_extmem_enable(0) causes a crash about 20% of the time when trying to connect to wifi, I have trimmed back my application to the bare min required to crash it. If I remove the heap_caps_malloc_extmem_enable call then it works properly........

Is this supposed to work? Or this crash expected?

Compiler Flags defined in platformio.ini:

build_unflags = -Os
build_flags = 
   -DCORE_DEBUG_LEVEL=5
   -DBOARD_HAS_PSRAM=1
   -DCONFIG_SPIRAM_CACHE_WORKAROUND=1
   -mfix-esp32-psram-cache-issue
   -O3 -ffast-math
   -Wl,-Map,output.map

    -DCONFIG_ARDUINO_ISR_IRAM=1

Sketch:

#include <WiFi.h>
#include "esp_wifi.h"
#include "esp_heap_caps.h"

void setup() {
  heap_caps_malloc_extmem_enable(0);

  WiFi.begin("", ""); // Credentials removed
}

void loop() {
}

Debug Messages:

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_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:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8
[D][esp32-hal-psram.c:47] psramInit(): PSRAM enabled
[D][WiFiGeneric.cpp:374] [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 2 - STA_START
_eventCallback(): Event: 0 - WIFI_READY
Guru Meditation Error: Core  0 panic'ed (Cache disabled but cached memory region accessed)
Core 0 register dump:
PC      : 0x4008d508  PS      : 0x00060034  A0      : 0x8008e14c  A1      : 0x3ffbf790
A2      : 0x3f800de4  A3      : 0xb33fffff  A4      : 0x3ffbf7cc  A5      : 0xbad00bad
A6      : 0x00000001  A7      : 0x00000001  A8      : 0x00000000  A9      : 0x00000000
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x40062229  A13     : 0x3ffbf8b0
A14     : 0x00e0a000  A15     : 0x3ffbfec8  SAR     : 0x00000018  EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000  LBEG    : 0x4008b190  LEND    : 0x4008b1ac  LCOUNT  : 0x00000000
Core 0 was running in ISR context:
EPC1    : 0x40062229  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x4008d508

ELF file SHA256: 0000000000000000

Backtrace: 0x4008d508:0x3ffbf790 0x4008e149:0x3ffbf7c0 0x4008cd95:0x3ffbf7f0 0x40083bd6:0x3ffbf810 0x40081522:0x3ffbf830 0x4008143f:0x3ffbf860 0x40081917:0x3ffbf880 0x400891c5:0x3ffbf8b0 0x40062226:0x3ffb3f80 0x4009243f:0x3ffb3fa0 0x4009247a:0x3ffb3fd0 0x40092506:0x3ffb4000 0x40092975:0x3ffb4020 0x40089c78:0x3ffb4040 0x40089d0a:0x3ffb4060 0x401353f7:0x3ffb4080 0x4013577d:0x3ffb40a0 0x401335ea:0x3ffb40c0 0x40133b02:0x3ffb4140 0x40132f07:0x3ffb41b0 0x400df10a:0x3ffb41f0 0x400dd158:0x3ffb4210 0x400eb689:0x3ffb4230 0x400de76b:0x3ffb42b0 0x4010a497:0x3ffb42d0 0x401086aa:0x3ffb42f0 0x401097cc:0x3ffb4310 0x400fe3e7:0x3ffb43a0 0x40100666:0x3ffb43d0 0x4008d1ca:0x3ffb4400
  #0  0x4008d508:0x3ffbf790 in uxPortCompareSetExtram at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:452
  #1  0x4008e149:0x3ffbf7c0 in vPortCPUAcquireMutexIntsDisabledExtram at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:3507
      (inlined by) vPortCPUAcquireMutexIntsDisabled at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/portmux_impl.h:95
      (inlined by) vTaskEnterCritical at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:4201
  #2  0x4008cd95:0x3ffbf7f0 in xQueueGenericSendFromISR at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:2038
  #3  0x40083bd6:0x3ffbf810 in queue_send_from_isr_wrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/esp_adapter.c:324
  #4  0x40081522:0x3ffbf830 in pp_post at ??:?
  #5  0x4008143f:0x3ffbf860 in lmacProcessRxSucData at ??:?
  #6  0x40081917:0x3ffbf880 in wDev_ProcessFiq at ??:?
  #7  0x400891c5:0x3ffbf8b0 in _xt_lowint1 at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/xtensa_vectors.S:1154
  #8  0x40062226:0x3ffb3f80 in ?? ??:0
  #9  0x4009243f:0x3ffb3fa0 in esp_rom_spiflash_read_status at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/spi_flash/spi_flash_rom_patch.c:662
  #10 0x4009247a:0x3ffb3fd0 in esp_rom_spiflash_wait_idle at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/spi_flash/spi_flash_rom_patch.c:662
  #11 0x40092506:0x3ffb4000 in esp_rom_spiflash_erase_sector_internal at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/spi_flash/spi_flash_rom_patch.c:662
  #12 0x40092975:0x3ffb4020 in esp_rom_spiflash_erase_sector at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/spi_flash/spi_flash_rom_patch.c:662
  #13 0x40089c78:0x3ffb4040 in spi_flash_erase_range at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/spi_flash/flash_ops.c:247
  #14 0x40089d0a:0x3ffb4060 in spi_flash_erase_sector at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/spi_flash/flash_ops.c:215
  #15 0x401353f7:0x3ffb4080 in nvs::Page::erase() at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_page.cpp:876
  #16 0x4013577d:0x3ffb40a0 in nvs::PageManager::requestNewPage() at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_pagemanager.cpp:184
  #17 0x401335ea:0x3ffb40c0 in nvs::Storage::writeMultiPageBlob(unsigned char, char const*, void const*, unsigned int, nvs::VerOffset) at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_storage.cpp:579
  #18 0x40133b02:0x3ffb4140 in nvs::Storage::writeItem(unsigned char, nvs::ItemType, char const*, void const*, unsigned int) at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_storage.cpp:579
  #19 0x40132f07:0x3ffb41b0 in nvs_set_blob at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_api.cpp:547
  #20 0x400df10a:0x3ffb41f0 in wifi_nvs_set at ??:?
  #21 0x400dd158:0x3ffb4210 in wifi_station_save_ap_channel at ??:?
  #22 0x400eb689:0x3ffb4230 in cnx_auth_done at ??:?
  #23 0x400de76b:0x3ffb42b0 in ieee80211_auth_done at ??:?
  #24 0x4010a497:0x3ffb42d0 in wpa_neg_complete at ??:?
  #25 0x401086aa:0x3ffb42f0 in wpa_parse_kde_ies at ??:?
  #26 0x401097cc:0x3ffb4310 in eapol_txcb at ??:?
  #27 0x400fe3e7:0x3ffb43a0 in ppProcTxDone at ??:?
  #28 0x40100666:0x3ffb43d0 in ppTask at ??:?
  #29 0x4008d1ca:0x3ffb4400 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)

Rebooting...
ets Jul 29 2019 12:21:46

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions