-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rtc_clk_init fix #2398
rtc_clk_init fix #2398
Conversation
components/soc/esp32/rtc_clk_init.c
Outdated
@@ -119,6 +119,7 @@ void rtc_clk_init(rtc_clk_config_t cfg) | |||
|
|||
bool res = rtc_clk_cpu_freq_mhz_to_config(cfg.cpu_freq_mhz, &new_config); | |||
assert(res && "invalid CPU frequency value"); | |||
rtc_clk_cpu_freq_set_config_fast(&new_config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This should probably be non-fast version, since _fast can't enable PLL, if needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought _fast has fallback to full version if required? You are saying it will always fall back in this situation so just call it directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does, but that relies on static variables which are not set at that point yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean s_cur_pll_freq will be zero so we won't be able to take shortcut anyway and if we happen to be setting a divided xtal freq we want to make sure pll is disabled? So no advantage in _fast.
Call non _fast version rtc_clk_cpu_freq_set_config
@igrr if we use _fast variant in esp_clk_init it can save ~10k cycles which at 80mhz is 130us do you think it is worthwhile? ugly test code:
save another ~1k cycles by giving the value of s_cur_pll_freq from bootloader to app |
@negativekelvin Good point on the possible optimization. To resolve the issue faster, I'll take the current version of the fix, and then confirm about using I2C_READREG_RTC. |
Add missing call to rtc_clk_cpu_freq_set_config Merges #2398
Squashed and cherry-picked as 8e2856b, thanks @negativekelvin! |
Add missing call to rtc_clk_cpu_freq_set_config Merges espressif/esp-idf#2398
Actually set cpu frequency