I set my menuconfig.
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL = 4096
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768
CONFIG_SPIRAM_USE_MALLOC=y
Once internal ram free is less than 50768 than all allocation using new/alloc will start happening from external ram.
As I understood. I need to keep 50-60 k internal ram always free to be used by Wifi module.
Option #1
I am using standard alloc and new.
As I understood. Any ram buffer allocation more than 4k will be allocated from external ram always. less than on internal ram.
I reserve my internal ram minimum free space= 50768 to be used Wifi and other system libraries. I guess used by mongoose networking libraries for tcp/udp connections.
My free internal ram stats shows that free internal ram still 80k. which is good for WIFI
Option # 2
I am trying to avoid explicit malloc calls heap_caps_malloc(size, MALLOC_CAP_SPIRAM) or internal.
I did try it. I found that after my firmware/application starts. It do ram free stats. It is showing that internal ram left is about 50k.
not much. If I starts web server and open my website with some files gets read from sd card which is about 2.3 Mb. It consume internal ram during reading SD card. My internal ram goes down to 40k and Wifi stop working.
I am looking to use Option #1
Is this good settings and options to be used. i have wifi with its own access point and STA.
I am using mongoose web server as well be some TCP, UDP sockets.
CAN driver also used to send and receive messages. SD card also used to read/write with Mongoose Http Web server
Do suggest any tuning for optimal performance.
All my Tasks /Threads are running on CPU1. CPU0 is assigned for Wifi.
Thanks,
Naeem.
External RAM enabled and performance tuning
Re: External RAM enabled and performance tuning
Can anyone reply to me on this thread about usage of external ram. Does option 1 and option 2 effects remaining internal/external ram used by ESP32 system libraries ( WIFI, drivers).
Can anyone explain to me. what are these options means
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=8192
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL means any buffer allocation more than 8k will go external ram.
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL ???
Can anyone explain to me. what are these options means
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=8192
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL means any buffer allocation more than 8k will go external ram.
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL ???
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: External RAM enabled and performance tuning
RESERVE_INTERNAL means that there is a pool reserved for allocations that *need* to be in internal memory, for example because they're used in DMA transfers. 'Normal' allocations will not touch this pool, the memory in here is only given out if an allocation specifically requests internal memory.
Re: External RAM enabled and performance tuning
I know you said you don't want to do this, but I use heap_caps_malloc(size, MALLOC_CAP_SPIRAM) and it works great. Gives you full control over using ext ram.
Also I found out you can free up a ton of memory (~90K) by disabling Bluetooth. I only use Bt when provisioning the device. So I reboot after it's provisioned.
John A
Also I found out you can free up a ton of memory (~90K) by disabling Bluetooth. I only use Bt when provisioning the device. So I reboot after it's provisioned.
John A
Re: External RAM enabled and performance tuning
Hi John,
Thanks for reply. i appreciate it.
for now any allocation more than CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=8192 gets allocated on external ram.
and less than goes to internal ram.
Good enough for now.
Thanks,
Naeem
Thanks for reply. i appreciate it.
for now any allocation more than CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=8192 gets allocated on external ram.
and less than goes to internal ram.
Good enough for now.
Thanks,
Naeem
Who is online
Users browsing this forum: No registered users and 94 guests