I am working on a feature for a library I maintain, to use multiple RMT channels to control multiple digital RGB LED strands. The current feature work is here:
https://github.com/MartyMacGyver/ESP32- ... ultistrand
Note: Eventually that work will be merged and the branch removed - at that point, see the main driver at:
https://github.com/MartyMacGyver/ESP32- ... ED-Drivers
My Arduino-ESP32 and ESP-IDF versions are both recent and both from their respective master branches. Build tools are up-to-date for both.
There's an Arduino-ESP32 version of my library and demo as well as an ESP-IDF version - except for some glue and init code switched via #defines they are virtually identical. The odd thing is, even when empty delays are used (which just return in the ESP-IDF stub I use on that side), the Arduino-ESP32 demo always runs noticeably faster than the ESP-IDF one. This is very odd to me... it's as if the MCU clock speed of the ESP-IDF version was quite a bit faster than the Arduino version.
What might lead to this peculiar difference?
Program compiled with Arduino-ESP32 runs noticeably faster than the same thing on ESP-IDF - why?
-
- Posts: 56
- Joined: Sun Dec 18, 2016 9:17 pm
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: Program compiled with Arduino-ESP32 runs noticeably faster than the same thing on ESP-IDF - why?
Could it perhaps be because the clock frequency actually is different? Not sure how you set it in the arduino environment, but in esp-idf, you can set it using 'make menuconfig' and by default it is set to 160MHz.
-
- Posts: 56
- Joined: Sun Dec 18, 2016 9:17 pm
Re: Program compiled with Arduino-ESP32 runs noticeably faster than the same thing on ESP-IDF - why?
Doubly odd: I never got a notification for this subscribed thread, and the reply I posted a few minutes ago disappeared.ESP_Sprite wrote:Could it perhaps be because the clock frequency actually is different? Not sure how you set it in the arduino environment, but in esp-idf, you can set it using 'make menuconfig' and by default it is set to 160MHz.
I didn't know the default is 160MHz now (was it always?) I've changed that to 240MHz, re-built and re-flashed. It's a little faster not, but still not nearly as fast as the Arduino build.
I'll dig into the actual options being used during `make` to see if there's anything obvious there.
Edit: nothing obvious so far. The compiler options are pretty much the same.
Edit2: Ah, but the `sdkconfig` in `hardware\espressif\esp32\tools\sdk\sdkconfig` is rather different!
`CONFIG_FREERTOS_HZ=1000 # IDF = 100`
Changing that (and ensuring `CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y` is selected) make it work the same as the Arduino version.
Guess I'll need to start checking in the sdkconfig again... or being very specific about the configuration parameters. Too bad there's no way to add a default config with just the specific switches overriding whatever the defaults are (currently you have to manually answer every new option that appeared since the last SDK config... unless there's a shortcut I'm missing).
Re: Program compiled with Arduino-ESP32 runs noticeably faster than the same thing on ESP-IDF - why?
You can add the default settings to sdkconfig.defaults file in your project directory.MartyMacGyver wrote: Too bad there's no way to add a default config with just the specific switches overriding whatever the defaults are ...
Re: Program compiled with Arduino-ESP32 runs noticeably faster than the same thing on ESP-IDF - why?
Also enable release build in menuconfig, otherwise you'll flash code made for debugging and it is sometimes considerably slower than the optimized version.
-
- Posts: 56
- Joined: Sun Dec 18, 2016 9:17 pm
Re: Program compiled with Arduino-ESP32 runs noticeably faster than the same thing on ESP-IDF - why?
Perfect! Thanks for the tip!loboris wrote:You can add the default settings to sdkconfig.defaults file in your project directory.
-
- Posts: 56
- Joined: Sun Dec 18, 2016 9:17 pm
Re: Program compiled with Arduino-ESP32 runs noticeably faster than the same thing on ESP-IDF - why?
In this case it was all about the settings I noted, but yes, this was something I tried changing previously (to no noticeable effect).permal wrote:Also enable release build in menuconfig, otherwise you'll flash code made for debugging and it is sometimes considerably slower than the optimized version.
Who is online
Users browsing this forum: No registered users and 133 guests