clk: fix esp32h2 print wrong CPU frequency

This commit is contained in:
morris
2021-11-15 11:03:23 +08:00
parent c5b904745f
commit 207891ef6c
3 changed files with 4 additions and 3 deletions

View File

@@ -71,7 +71,7 @@ int IRAM_ATTR esp_clk_cpu_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)

View File

@@ -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 div = src_freq_mhz / (config->freq_mhz);
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)

View File

@@ -374,7 +374,7 @@ static void start_cpu0_default(void)
ESP_EARLY_LOGI(TAG, "Pro cpu start user code");
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.
if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) {