speed issues after upgrade to IDF5.1.2/ADF2.6

bs-eng
Posts: 30
Joined: Wed Oct 28, 2020 8:19 pm

speed issues after upgrade to IDF5.1.2/ADF2.6

Postby bs-eng » Tue Apr 23, 2024 2:55 pm

Hi all!

In the past I developed a system based on IDFv4.1 and ADFv2.2. The application works fine.

Recently I updated my workspace to IDF5.1.2/ADF2.6 and suddenly I am getting speed issues. These are primarily noticeable in the audio output of the device. It sounds choppy and has even little breaks/pauses in the audio. From the log I see no difference.

One item I noticed is log output. The baudrate for console has changed itself from the project-predefined 921600 to 115200 baud.
So I checked the sdkconfig and am noticing quite a few changes compared to the previous IDF version I used.

Question:
1. Is there a recommended way of fixing certain settings? sdkconfig.defaults is being used, but seems to have not been detailed enough
2. What are typical reasons why my application would suddenly become more slow? What can I change/reconfigure to make it run at original speed?

Edit: so far I could track down significant speed improvement by disabling SPI-RAM (PSRAM) support. This immediately solves the observed speed issue. However I need the PSRAM for other tasks down the road. So what is slowing down the ESP soooo much when using PSRAM?

Thanks a lot!
Cheers
JR

bs-eng
Posts: 30
Joined: Wed Oct 28, 2020 8:19 pm

Re: speed issues after upgrade to IDF5.1.2/ADF2.6

Postby bs-eng » Thu May 09, 2024 10:29 am

Nobody having any idea why an upgrade to the new IDF/ADF slows down an ESP32?

ESP_adokitkat
Posts: 50
Joined: Thu Jun 22, 2023 12:50 pm

Re: speed issues after upgrade to IDF5.1.2/ADF2.6

Postby ESP_adokitkat » Thu May 09, 2024 12:23 pm

Hello.

At first glance it seem like the problem is a change in the memory resource allocation. You mentioned disabling PSRAM helping you resolve this issue. This could mean some of your allocations (mallocs, etc.) are allocated into PSRAM when it's enabled, which is slower than on-board RAM, albeit is much larger.

You probably want to don't want to allocate specific highly utilized buffers into PSRAM. There is `heap_caps_malloc` function available there which will help you with that, e.g. like `heap_caps_malloc(<SIZE_OF_YOUR_BUFFER>, MALLOC_CAP_INTERNAL)`. You can also use `MALLOC_CAP_32BIT` or `MALLOC_CAP_8BIT` flags to specify if the memory has to follow 32-bit / 8-bit data access or `MALLOC_CAP_DMA` flag to allocate memory which is suitable for use with hardware DMA engines (for example SPI and I2S). This capability flag excludes any external PSRAM. These flags can be added by using bit-wise OR, i.e. `heap_caps_malloc(<SIZE_OF_YOUR_BUFFER>, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)`.

Or you can try to modify the allocator behavior in `idf.py menuconfig` in `(Top) → Component config → ESP PSRAM → Support for external PSRAM → PSRAM config → SPI RAM access method` where you can find these options:
( ) Integrate RAM into memory map
( ) Make RAM allocatable using heap_caps_malloc(..., MALLOC_CAP_SPIRAM)
(X) Make RAM allocatable using malloc() as well
You can read more about this here:
https://docs.espressif.com/projects/esp ... alloc.html
https://docs.espressif.com/projects/esp ... l-ram.html

Also if you could please share more details about your setup (like which ESP32 model are you using or share some sample code/project which reproduces the issue, sdkconfig file as well) it would be appreciated. Thank you!

bs-eng
Posts: 30
Joined: Wed Oct 28, 2020 8:19 pm

Re: speed issues after upgrade to IDF5.1.2/ADF2.6

Postby bs-eng » Thu Jun 06, 2024 12:45 pm

Hi ESP_adokitkat!

Yes, I did try to change to allocator by menas of sdkconfig. With no effect on the issue.

Meanwhile I narrowed the issue down to the touch peripheral. See my specific post here:
https://esp32.com/viewtopic.php?f=13&t=39795

Also the ADF tasks cannot be pinned to a specific core. They always end up on core 0. So the option in sdkconfig at ADF Features > Delegation task core seems to be ignored. Only tasks that my own code specifically pins to a certain core is actually being pinned there. (see my other post for an example log output) So I am wondering if there any configurations options that are mutually exclusive or can generate unwanted behaviour?

My current sdkconfig is attached.
sdkconfig.txt
(77.51 KiB) Downloaded 57 times
Regards
JR

Who is online

Users browsing this forum: MicroController and 232 guests