mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-05 05:34:32 +02:00
Merge branch 'bugfix/esp32h2_print_wrong_cpu_rate' into 'master'
clk: fix esp32h2 print wrong CPU frequency See merge request espressif/esp-idf!15942
This commit is contained in:
@@ -71,7 +71,7 @@ int IRAM_ATTR esp_clk_cpu_freq(void)
|
|||||||
|
|
||||||
int IRAM_ATTR esp_clk_apb_freq(void)
|
int IRAM_ATTR esp_clk_apb_freq(void)
|
||||||
{
|
{
|
||||||
return MIN(s_get_cpu_freq_mhz(), 80) * MHZ;
|
return MIN(s_get_cpu_freq_mhz() * MHZ, APB_CLK_FREQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
int IRAM_ATTR esp_clk_xtal_freq(void)
|
int IRAM_ATTR esp_clk_xtal_freq(void)
|
||||||
@@ -116,7 +116,7 @@ uint64_t esp_rtc_get_time_us(void)
|
|||||||
const uint64_t ticks_low = ticks & UINT32_MAX;
|
const uint64_t ticks_low = ticks & UINT32_MAX;
|
||||||
const uint64_t ticks_high = ticks >> 32;
|
const uint64_t ticks_high = ticks >> 32;
|
||||||
const uint64_t delta_time_us = ((ticks_low * cal) >> RTC_CLK_CAL_FRACT) +
|
const uint64_t delta_time_us = ((ticks_low * cal) >> RTC_CLK_CAL_FRACT) +
|
||||||
((ticks_high * cal) << (32 - RTC_CLK_CAL_FRACT));
|
((ticks_high * cal) << (32 - RTC_CLK_CAL_FRACT));
|
||||||
s_esp_rtc_time_us += delta_time_us;
|
s_esp_rtc_time_us += delta_time_us;
|
||||||
s_rtc_last_ticks = rtc_this_ticks;
|
s_rtc_last_ticks = rtc_this_ticks;
|
||||||
_lock_release(&s_esp_rtc_time_lock);
|
_lock_release(&s_esp_rtc_time_lock);
|
||||||
|
@@ -232,6 +232,7 @@ void rtc_clk_cpu_freq_set_config(const rtc_cpu_freq_config_t *config)
|
|||||||
uint32_t src_freq_mhz = root_clk_slt(config->source);
|
uint32_t src_freq_mhz = root_clk_slt(config->source);
|
||||||
uint32_t div = src_freq_mhz / (config->freq_mhz);
|
uint32_t div = src_freq_mhz / (config->freq_mhz);
|
||||||
rtc_clk_cpu_freq_set(config->source, div);
|
rtc_clk_cpu_freq_set(config->source, div);
|
||||||
|
ets_update_cpu_frequency(config->freq_mhz);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t *out_config)
|
void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t *out_config)
|
||||||
|
@@ -374,7 +374,7 @@ static void start_cpu0_default(void)
|
|||||||
|
|
||||||
ESP_EARLY_LOGI(TAG, "Pro cpu start user code");
|
ESP_EARLY_LOGI(TAG, "Pro cpu start user code");
|
||||||
int cpu_freq = esp_clk_cpu_freq();
|
int cpu_freq = esp_clk_cpu_freq();
|
||||||
ESP_EARLY_LOGI(TAG, "cpu freq: %d", cpu_freq);
|
ESP_EARLY_LOGI(TAG, "cpu freq: %d Hz", cpu_freq);
|
||||||
|
|
||||||
// Display information about the current running image.
|
// Display information about the current running image.
|
||||||
if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) {
|
if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) {
|
||||||
|
Reference in New Issue
Block a user