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
speed issues after upgrade to IDF5.1.2/ADF2.6
Re: speed issues after upgrade to IDF5.1.2/ADF2.6
Nobody having any idea why an upgrade to the new IDF/ADF slows down an ESP32?
-
- Posts: 52
- Joined: Thu Jun 22, 2023 12:50 pm
Re: speed issues after upgrade to IDF5.1.2/ADF2.6
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:
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!
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:
You can read more about this here:( ) Integrate RAM into memory map
( ) Make RAM allocatable using heap_caps_malloc(..., MALLOC_CAP_SPIRAM)
(X) Make RAM allocatable using malloc() as well
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!
Re: speed issues after upgrade to IDF5.1.2/ADF2.6
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. Regards
JR
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. Regards
JR
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot], Gaston1980 and 98 guests