Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TW#26714] ESP32 WROVER Porting crash #2546

Closed
my-abousamra opened this issue Oct 11, 2018 · 4 comments
Closed

[TW#26714] ESP32 WROVER Porting crash #2546

my-abousamra opened this issue Oct 11, 2018 · 4 comments

Comments

@my-abousamra
Copy link

my-abousamra commented Oct 11, 2018

Environment

  • Development Kit: [ESP32-Wrover-Kit]
  • Kit version (for WroverKit): [v1]
  • Core (if using chip or module): [ESP32-Wrover]
  • IDF version (221eced.):
  • Development Env: [Eclipse]
  • Operating System: [Ubuntu]
  • Power Supply: [USB]

Problem Description

I'm porting my application from ESP32_WROOM module to ESP32_Wrover to get use of external PSRAM
I enabled support for external RAM from menuconfig and ran the application then it crashed at freertos queue creation as following

`Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x4009701a PS : 0x00060433 A0 : 0x80099141 A1 : 0x3ffbb310
0x4009701a: uxPortCompareSet at /media/data/esp-srcs/esp-idf/components/freertos/tasks.c:3564
(inlined by) vPortCPUAcquireMutexIntsDisabledInternal at /media/data/esp-srcs/esp-idf/components/freertos/portmux_impl.inc.h:86
(inlined by) vPortCPUAcquireMutexIntsDisabled at /media/data/esp-srcs/esp-idf/components/freertos/portmux_impl.h:98
(inlined by) vTaskEnterCritical at /media/data/esp-srcs/esp-idf/components/freertos/tasks.c:4258

A2 : 0xcccccccc A3 : 0x0000cdcd A4 : 0xb33fffff A5 : 0x00000001
A6 : 0x00060820 A7 : 0x0000abab A8 : 0x0000cdcd A9 : 0x3ffbb400
A10 : 0x3ffd15a4 A11 : 0x00000001 A12 : 0x00000003 A13 : 0x00000008
A14 : 0x00000002 A15 : 0x00000005 SAR : 0x00000004 EXCCAUSE: 0x0000001d
EXCVADDR: 0xcccccccc LBEG : 0x4009de64 LEND : 0x4009de92 LCOUNT : 0xffffffff
0x4009de64: memcpy at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/machine/xtensa/../../../../.././newlib/libc/machine/xtensa/memcpy.S:168

0x4009de92: memcpy at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/machine/xtensa/../../../../.././newlib/libc/machine/xtensa/memcpy.S:201

Backtrace: 0x4009701a:0x3ffbb310 0x4009913e:0x3ffbb340 0x4008506d:0x3ffbb360 0x400850b5:0x3ffbb380 0x400855fd:0x3ffbb3a0 0x4000beaf:0x3ffbb3c0 0x40095b26:0x3ffbb3e0 0x400ef29b:0x3ffbb400 0x400d7424:0x3ffbb420 0x400d29f0:0x3ffbb440 0x40096305:0x3ffbb460
0x4009701a: uxPortCompareSet at /media/data/esp-srcs/esp-idf/components/freertos/tasks.c:3564
(inlined by) vPortCPUAcquireMutexIntsDisabledInternal at /media/data/esp-srcs/esp-idf/components/freertos/portmux_impl.inc.h:86
(inlined by) vPortCPUAcquireMutexIntsDisabled at /media/data/esp-srcs/esp-idf/components/freertos/portmux_impl.h:98
(inlined by) vTaskEnterCritical at /media/data/esp-srcs/esp-idf/components/freertos/tasks.c:4258

0x4009913e: multi_heap_internal_lock at /media/data/esp-srcs/esp-idf/components/heap/multi_heap.c:377
(inlined by) multi_heap_malloc_impl at /media/data/esp-srcs/esp-idf/components/heap/multi_heap.c:413

0x4008506d: heap_caps_malloc at /media/data/esp-srcs/esp-idf/components/heap/heap_caps.c:351

0x400850b5: heap_caps_malloc_default at /media/data/esp-srcs/esp-idf/components/heap/heap_caps.c:351

0x400855fd: _malloc_r at /media/data/esp-srcs/esp-idf/components/newlib/syscalls.c:37

0x40095b26: xQueueGenericCreate at /media/data/esp-srcs/esp-idf/components/freertos/queue.c:2037

0x400ef29b: WiFi_vInit at /media/data/eclipse-workspace/ESP32_Adapter/components/WiFi/WiFi.c:1375

0x400d7424: app_main at /media/data/eclipse-workspace/ESP32_Adapter/main/main.c:75 (discriminator 9)

0x400d29f0: main_task at /media/data/esp-srcs/esp-idf/components/esp32/cpu_start.c:482

0x40096305: vPortTaskWrapper at /media/data/esp-srcs/esp-idf/components/freertos/port.c:435`

when I ran backtrace I got

`Remote debugging using /dev/ttyUSB1
0x4009701a in uxPortCompareSet (set=, compare=3007315967, addr=0xcccccccc)
at /media/data/esp-srcs/esp-idf/components/freertos/include/freertos/portmacro.h:285
285 asm volatile (
(gdb) bt
#0 0x4009701a in uxPortCompareSet (set=, compare=3007315967, addr=0xcccccccc)
at /media/data/esp-srcs/esp-idf/components/freertos/include/freertos/portmacro.h:285

#1 vPortCPUAcquireMutexIntsDisabledInternal (timeout_cycles=-1, mux=0xcccccccc)
at /media/data/esp-srcs/esp-idf/components/freertos/portmux_impl.inc.h:86

#2 vPortCPUAcquireMutexIntsDisabled (timeout_cycles=-1, mux=0xcccccccc)
at /media/data/esp-srcs/esp-idf/components/freertos/portmux_impl.h:98

#3 vTaskEnterCritical (mux=0xcccccccc) at /media/data/esp-srcs/esp-idf/components/freertos/tasks.c:4258

#4 0x40099141 in multi_heap_internal_lock (heap=0x3f800000) at /media/data/esp-srcs/esp-idf/components/heap/multi_heap.c:372

#5 multi_heap_malloc_impl (heap=0x3f800000, size=19224) at /media/data/esp-srcs/esp-idf/components/heap/multi_heap.c:413

#6 0x40085070 in heap_caps_malloc (size=19224, caps=5120) at /media/data/esp-srcs/esp-idf/components/heap/heap_caps.c:110

#7 0x400850b8 in heap_caps_malloc_default (size=19224) at /media/data/esp-srcs/esp-idf/components/heap/heap_caps.c:145

#8 0x40085600 in _malloc_r (r=0x3ffbb560, size=19224) at /media/data/esp-srcs/esp-idf/components/newlib/syscalls.c:37

#9 0x4000beb2 in ?? ()

#10 0x40095b29 in xQueueGenericCreate (uxQueueLength=110, uxItemSize=174, ucQueueType=0 '\000')
at /media/data/esp-srcs/esp-idf/components/freertos/queue.c:391

#11 0x400ef29e in WiFi_vInit () at /media/data/eclipse-workspace/ESP32_Adapter/components/WiFi/WiFi.c:1375

#12 0x400d7427 in app_main () at /media/data/eclipse-workspace/ESP32_Adapter/main/main.c:75

#13 0x400d29f3 in main_task (args=) at /media/data/esp-srcs/esp-idf/components/esp32/cpu_start.c:482

#14 0x40096308 in vPortTaskWrapper (pxCode=0x400d296c <main_task>, pvParameters=0x0)
at /media/data/esp-srcs/esp-idf/components/freertos/port.c:143`

When I disable PSRAM from menuconfig, it works properly

Expected Behavior

The code was running properly in ESP32 WROOM

Actual Behavior

It crashes in ESP32 WROVER

@chegewara
Copy link
Contributor

Besides that option in menuconfig you have also few others related to psram. Please check those 2:
Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, allocate internal memory
and SPI RAM access method (Make RAM allocatable using malloc() as well)

@my-abousamra
Copy link
Author

I checked Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, allocate internal memory
and SPI RAM access method (Make RAM allocatable using malloc() as well) is already checked by default and problem still exist

@my-abousamra
Copy link
Author

When I increase the value of this option Maximum malloc() size, in bytes, to always put in internal memory from 16384 to 116384 the problem doesn't occur and the application works properly but if I increased the size of the freertos queue to get use of the external PSRAM the problem occurs so I tried to increase the option value again but the menuconfig refused as it stated it is invalid value!

@Alvin1Zhang Alvin1Zhang changed the title ESP32 WROVER Porting crash [TW#26714] ESP32 WROVER Porting crash Oct 12, 2018
@my-abousamra
Copy link
Author

Works as GPIOs 8 & 9 was used!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants