External PSRAM 8MB TEST OK, but malloc failed.

vtomix
Posts: 6
Joined: Mon Sep 10, 2018 8:25 pm

External PSRAM 8MB TEST OK, but malloc failed.

Postby vtomix » Sat Jun 13, 2020 9:45 am

Hello!

I have a custom board with ESP32-WROOM-32D 16MB and externally routed ESP-PSRAM64H (3.3V) chip.
I routed it to the suggested PINS with one exception:
https://docs.espressif.com/projects/esp ... l-ram.html
PSRAM /CE (pin 1) - ESP32 GPIO 16
PSRAM SO (pin 2) - flash DO
PSRAM SIO[2] (pin 3) - flash WP
PSRAM SI (pin 5) - flash DI
PSRAM SIO[3] (pin 7) - flash HOLD
PSRAM Vcc (pin 8) - ESP32 VCC_SDIO

PSRAM SCLK (pin 6) - ESP32 GPIO 6 !!!! (it is common CLK line with the internal flash memory)
I have not found any restriction for this.

I have configured it to 80 Mhz and I selected the heap_caps_malloc(..., MALLOC_CAP_SPIRAM) type allocation in menuconfig.
I'm using ESP-IDF v4.0.1
When my application booting, It can initialize spiral successful and the test passed:
I (432) psram: This chip is ESP32-D0WD
I (434) spiram: Found 64MBit SPI RAM device
I (437) spiram: SPI RAM mode: flash 80m sram 80m
I (441) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (977) spiram: SPI SRAM memory test OK

I (1006) spiram: Adding pool of 4096K of external SPI memory to heap allocator

When I try to use

Code: Select all

heap_caps_malloc(size, MALLOC_CAP_SPIRAM)
it gives every time NULL.

Does anybody met this situation before?
Any idea how can I debug it more deeply?

I tired to debug it with JTAG but it seems to heap_caps_malloc is atomic for my debugger, I can't step into (ESP-PROG).

Any idea can help me!
Thanks!

Who is online

Users browsing this forum: Bing [Bot] and 61 guests