Optimizing IRAM usage: How to allocate SRAM1 as IRAM

heydarov23
Posts: 4
Joined: Fri Dec 01, 2023 8:28 am

Optimizing IRAM usage: How to allocate SRAM1 as IRAM

Postby heydarov23 » Thu Feb 29, 2024 2:22 pm

Hi,

I am sorry if this is not correct forum to ask my question.

I have developed custom micropython firmware. I am using BLE, I2C, ADC, DAC, PWM, some GPIO pins as input and output in my custom firmware. When checking my IRAM and DRAM size (idf.py size), the output shows that my IRAM usage is 97.3% and DRAM usage is 43%. In this forum, I read that by allocating SRAM1 to IRAM using CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM bit, I can increase IRAM size. But I do not know how to change it (or where is this setting). I could not find this setting. I asked this question in micropython github also, but have not got any answer.

If possible, could you please help me with this issue. Thank you in advance.

heydarov23
Posts: 4
Joined: Fri Dec 01, 2023 8:28 am

Re: Optimizing IRAM usage: How to allocate SRAM1 as IRAM

Postby heydarov23 » Fri Mar 01, 2024 10:15 pm

Hi,

Micropython supports only ESP-IDF 5.0.4 and 5.1.2. I installed 5.1.2 and successfully allocated SRAM1 to IRAM in menuconfig and IRAM usage was reduced to 76 %. But due to micropython ESP-IDF compatibility (I guess so), my working codes, started not to work. Even if I changed SRAM1 setting back to its original state (IDF 5.1.2) again my codes not worked. Then I reinstalled IDF 5.0.4 ( IRAM size was around 97%), my codes worked successfully. However, this time I found that there is not any config setting for SRAM1 as IRAM in MENUCONFIG in IDF 5.0.4.

My question is, how can I allocate SRAM1 for IRAM manually in IDF 5.0.4 as there is not any setting in MENUCONFIG?

Thank you for the help

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

Re: Optimizing IRAM usage: How to allocate SRAM1 as IRAM

Postby MicroController » Sat Mar 02, 2024 12:26 pm

What are you planning to do with the extra IRAM?

heydarov23
Posts: 4
Joined: Fri Dec 01, 2023 8:28 am

Re: Optimizing IRAM usage: How to allocate SRAM1 as IRAM

Postby heydarov23 » Fri Mar 08, 2024 2:18 pm

Hi,

My project was not stable. I think it was due to IRAM space. For example, the thread does not work as expected or sometimes bluetooth disconnects and etc. I thought if I free up some IRAM space, it would be better.

In IDF 5.0.4, I made changes given in github to add SRAM1 for IRAM feature to menuconfig (https://github.com/espressif/esp-idf/co ... 67b30a135f) and was able to configure SRAM1 space for IRAM. I decreased IRAM usage to 75%. Right now, I am testing its stability, but again sometimes bluetooth gets disconnecting when receiving command from host. It gives Stack overflow in task ble error. I tried to increase stack size sdkconfig.ble file but same thing happens again. I am trying to solve it.

Who is online

Users browsing this forum: No registered users and 88 guests