Page 1 of 1

esp_http_client PSRAM use

Posted: Tue Mar 29, 2022 1:12 am
by milkolik
Hi,

I am planning of using the

Code: Select all

esp_http_client 
component for a project.
I started by checking out the

Code: Select all

esp_http_client 
example code but I noticed that all 4MB PSRAM of my ESP are used by

Code: Select all

example_connect()
. Is this a quirk with this particular example code? Or does

Code: Select all

esp_http_client 
actually use all external RAM?

I plan on using some external RAM for storing some images from a camera so ideally I'd like to have some external RAM left.

Thank you!

Re: esp_http_client PSRAM use

Posted: Tue Mar 29, 2022 4:44 am
by ESP_Sprite
No, those examples are supposed to run even on a board without psram, so them using up a full 4MiB sounds odd. How did you measure this?

Re: esp_http_client PSRAM use

Posted: Tue Mar 29, 2022 5:07 am
by milkolik
I am doing heap_caps_get_free_size(MALLOC_CAP_SPIRAM) to get the available external RAM.

I dug a bit deeper and the problem seems to be when initializing the MAC part of the w5500 ethernet module I am using.

But still not sure what is going on. I think it's a bit suspicious that after initializing I get exactly 0 bytes remaining in the external RAM. I suppose if it was going overboard it would fail while trying to allocate, right? Almost seems like it is explicitly allocating all the available external RAM but I still haven't found if this is the case.

Re: esp_http_client PSRAM use

Posted: Tue Mar 29, 2022 5:37 am
by milkolik
Hmm interesting, I disabled PSRAM and it is indeed working without it!

However I do need the PSRAM for storing some images in it and currently I am unable to due to this issue. For some reason the moment I do the w5500 init the PSRAM goes to 0.

Is there a possible explanation aside of a hardware/power problem? Maybe a PIN configuration clash?

Re: esp_http_client PSRAM use

Posted: Tue Mar 29, 2022 7:36 am
by ESP_Sprite
Can you take a look at the startup messages; can you see the PSRAM being detected in there?

Re: esp_http_client PSRAM use

Posted: Tue Mar 29, 2022 3:08 pm
by milkolik
Yes. It is detected at the beginning but nevermind, I already found the issue. The problem is that I am using pin 16 for the w5500 module and it turns out that the ESP32-CAM also uses that for PSRAM chip select!

Thank you!