Page 1 of 2
Is rtc_clk_cpu_freq_set to 10Mhz or 20Mhz possible?
Posted: Wed Aug 08, 2018 9:03 am
by Laetterman
Hi,
using
we can change the frequency from 240Mhz to 160Mhz, 80Mhz or 2Mhz.
Is it possible to change the frequency to 10Mhz or 20Mhz too?
Reason why I'm asking is trying to bring the power consumption down in active mode.
Thanks!
Re: Is rtc_clk_cpu_freq_set to 10Mhz or 20Mhz possible?
Posted: Wed Aug 08, 2018 11:42 am
by ESP_igrr
No, rtc_clk_cpu_freq_set can't be used to set 10 or 20MHz frequencies. In fact, `rtc_clk_cpu_freq_set` should not be called from applications at all, since it does not adjust RTOS and esp_timer dividers for correct frequency.
There is a change to IDF, currently in review, which allows using frequencies such as 10MHz and 20MHz in combination with DFS.
Re: Is rtc_clk_cpu_freq_set to 10Mhz or 20Mhz possible?
Posted: Wed Aug 15, 2018 6:58 pm
by Laetterman
Thank you, thats great!
Please, could you give a rough estimation on when DFS @20Mhz will be available?
Will it support to boot with the reduced speed too, or will the first about 200ms booting sequence still run with 240Mhz (thus consuming about 60mA)?
Re: Is rtc_clk_cpu_freq_set to 10Mhz or 20Mhz possible?
Posted: Wed Aug 15, 2018 9:52 pm
by ESP_igrr
This feature should be in master branch within the next week.
After startup, the chip runs at XTAL (usually 40MHz) frequency, until it is switched to 80MHz by the 2nd stage bootloader to load the main app. I don't have numbers at hand, but from memory, booting at 80MHz (with 80MHz flash frequency) uses less energy than booting at 40MHz.
The bootloader will use 240MHz only if the main app was configured to use that, and the chip is rev. 0.
Re: Is rtc_clk_cpu_freq_set to 10Mhz or 20Mhz possible?
Posted: Wed Aug 29, 2018 12:13 pm
by Laetterman
Thats great. Is there any chance to activate DFS via Arduino IDE or do I need to install IDF first and use menuconfig as described here
https://github.com/espressif/esp-iot-so ... nual_en.md?
Code: Select all
esp_pm_config_esp32_t pm_config = {
.max_cpu_freq =RTC_CPU_FREQ_80M,
.min_cpu_freq = RTC_CPU_FREQ_XTAL,
.light_sleep_enable = true
};
esp_err_t ret;
if((ret = esp_pm_configure(&pm_config)) != ESP_OK) {
printf("pm config error %s\n", \
ret == ESP_ERR_INVALID_ARG ? \
"ESP_ERR_INVALID_ARG":"ESP_ERR_NOT_SUPPORTED");
}
Re: Is rtc_clk_cpu_freq_set to 10Mhz or 20Mhz possible?
Posted: Wed Aug 29, 2018 3:29 pm
by ESP_igrr
Not via Arduino IDE, but if you use Arduino as esp-idf component, then you can enable power management in menuconfig.
Re: Is rtc_clk_cpu_freq_set to 10Mhz or 20Mhz possible?
Posted: Sun Sep 02, 2018 4:32 pm
by Laetterman
I installed the master branch of esp-idf, and could enable the power management in menuconfig. However the concept of using Arduino es ESP component is beyond my (limited) abilities... following these instructions
https://github.com/espressif/arduino-es ... mponent.md there are now several compiler errors and I have problems to understand the general concept behind this approach.
Is there a chance that the power management options will be at some day available in the arduino-esp32 branch, so that I can continue using my existing sketches + libraries via arduino or platformio IDE (with DFS enabled)?
Re: Is rtc_clk_cpu_freq_set to 10Mhz or 20Mhz possible?
Posted: Mon Sep 03, 2018 1:40 am
by ESP_igrr
It is unlikely that this functionality will be enabled by default in Arduino, as power management hooks increase interrupt latency.
The other thing is that existing Arduino libraries might need to be modified to take different clock configuration into account (e.g. UART should use REF_TICK), and acquire/release power management locks when needed.
I would suggest posting the compilation errors you are getting with Arduino-as-component approach.
Re: Is rtc_clk_cpu_freq_set to 10Mhz or 20Mhz possible?
Posted: Tue Sep 04, 2018 3:25 pm
by Laetterman
OK, after enabling "C++ exception handling" in menuconfig the following error appears when compiling the hello_world_main.c example:
Code: Select all
Python requirements from /Users/Laetterman/esp/esp-idf/requirements.txt are satisfied.
CXX build/arduino/libraries/SD_MMC/src//SD_MMC.o
/Users/Laetterman/esp/hello_world4/components/arduino/libraries/SD_MMC/src/SD_MMC.cpp: In member function 'bool fs::SDMMCFS::begin(const char*, bool)':
/Users/Laetterman/esp/hello_world4/components/arduino/libraries/SD_MMC/src/SD_MMC.cpp:59:5: sorry, unimplemented: non-trivial designated initializers not supported
};
^
/Users/Laetterman/esp/hello_world4/components/arduino/libraries/SD_MMC/src/SD_MMC.cpp:59:5: sorry, unimplemented: non-trivial designated initializers not supported
/Users/Laetterman/esp/hello_world4/components/arduino/libraries/SD_MMC/src/SD_MMC.cpp:59:5: sorry, unimplemented: non-trivial designated initializers not supported
/Users/Laetterman/esp/hello_world4/components/arduino/libraries/SD_MMC/src/SD_MMC.cpp:59:5: sorry, unimplemented: non-trivial designated initializers not supported
/Users/Laetterman/esp/hello_world4/components/arduino/libraries/SD_MMC/src/SD_MMC.cpp:59:5: sorry, unimplemented: non-trivial designated initializers not supported
/Users/Laetterman/esp/hello_world4/components/arduino/libraries/SD_MMC/src/SD_MMC.cpp:59:5: sorry, unimplemented: non-trivial designated initializers not supported
/Users/Laetterman/esp/hello_world4/components/arduino/libraries/SD_MMC/src/SD_MMC.cpp:59:5: warning: missing initializer for member 'sdmmc_host_t::command_timeout_ms' [-Wmissing-field-initializers]
make[1]: *** [libraries/SD_MMC/src//SD_MMC.o] Error 1
make: *** [component-arduino-build] Error 2
Re: Is rtc_clk_cpu_freq_set to 10Mhz or 20Mhz possible?
Posted: Wed Sep 05, 2018 1:10 am
by ESP_igrr
That's a legitimate error, thanks for reporting. Which version of arduino-esp32 and which version of ESP-IDF do you have installed? This seems to be an issue very similar to the one fixed in IDF a while ago, hence the question.