Page 1 of 1

error allocating memory in PSRAM

Posted: Wed Mar 05, 2025 12:37 pm
by aygh4266
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 ?

Re: error allocating memory in PSRAM

Posted: Wed Mar 05, 2025 7:04 pm
by MicroController
In menuconfig, under "SPI RAM config", set "SPI RAM access method" to "Make RAM allocatable using heap_caps_malloc(..., MALLOC_CAP_SPIRAM)".