error allocating memory in PSRAM

aygh4266
Posts: 36
Joined: Mon Mar 04, 2024 10:33 am

error allocating memory in PSRAM

Postby aygh4266 » Wed Mar 05, 2025 12:37 pm

Hello,

I have tried to allocate memory in PSRAM. I have activated the PSRAM and I have 8MB. Now calling the function

Code: Select all

	void* psramBuffer = heap_caps_malloc(65536*2, MALLOC_CAP_SPIRAM);
	if (psramBuffer == NULL) {
	    ESP_LOGE(TAG, "Error allocating memory in PSRAM.");
	}
returned NULL and the error. What is the problem ?

MicroController
Posts: 2661
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: error allocating memory in PSRAM

Postby MicroController » Wed Mar 05, 2025 7:04 pm

In menuconfig, under "SPI RAM config", set "SPI RAM access method" to "Make RAM allocatable using heap_caps_malloc(..., MALLOC_CAP_SPIRAM)".

Who is online

Users browsing this forum: PetalBot and 3 guests