mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp32h2: fix apb freq bug
This commit is contained in:
parent
df1f9ec26e
commit
cd10bb7fa2
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -356,7 +356,7 @@ uint32_t rtc_clk_ahb_freq_get()
|
|||||||
rtc_cpu_freq_config_t cpu_config;
|
rtc_cpu_freq_config_t cpu_config;
|
||||||
uint32_t ahb_div = REG_GET_FIELD(SYSTEM_BUSCLK_CONF_REG, SYSTEM_AHB_DIV_NUM) + 1;
|
uint32_t ahb_div = REG_GET_FIELD(SYSTEM_BUSCLK_CONF_REG, SYSTEM_AHB_DIV_NUM) + 1;
|
||||||
rtc_clk_cpu_freq_get_config(&cpu_config) ;
|
rtc_clk_cpu_freq_get_config(&cpu_config) ;
|
||||||
return cpu_config.freq_mhz / ahb_div;
|
return cpu_config.freq_mhz * MHZ / ahb_div;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t rtc_clk_ahb_freq_set(uint32_t div)
|
uint32_t rtc_clk_ahb_freq_set(uint32_t div)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -62,7 +62,7 @@ void rtc_clk_init(rtc_clk_config_t cfg)
|
|||||||
rtc_xtal_freq_t xtal_freq = cfg.xtal_freq;
|
rtc_xtal_freq_t xtal_freq = cfg.xtal_freq;
|
||||||
esp_rom_uart_tx_wait_idle(0);
|
esp_rom_uart_tx_wait_idle(0);
|
||||||
rtc_clk_xtal_freq_update(xtal_freq);
|
rtc_clk_xtal_freq_update(xtal_freq);
|
||||||
rtc_clk_apb_freq_update(rtc_clk_apb_freq_get() * MHZ);
|
rtc_clk_apb_freq_update(rtc_clk_apb_freq_get());
|
||||||
|
|
||||||
/* Set CPU frequency */
|
/* Set CPU frequency */
|
||||||
rtc_clk_cpu_freq_get_config(&old_config);
|
rtc_clk_cpu_freq_get_config(&old_config);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -487,6 +487,11 @@ void rtc_clk_apb_freq_update(uint32_t apb_freq);
|
|||||||
uint32_t rtc_clk_apb_freq_get(void);
|
uint32_t rtc_clk_apb_freq_get(void);
|
||||||
|
|
||||||
void rtc_clk_cpu_freq_set(uint32_t source, uint32_t div);
|
void rtc_clk_cpu_freq_set(uint32_t source, uint32_t div);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the current stored AHB frequency.
|
||||||
|
* @return The AHB frequency value as last set via rtc_clk_ahb_freq_set(), in Hz.
|
||||||
|
*/
|
||||||
uint32_t rtc_clk_ahb_freq_get(void);
|
uint32_t rtc_clk_ahb_freq_get(void);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user