mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 15:44:34 +02:00
enable external 32k osc for esp32c2
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
#include "soc/efuse_reg.h"
|
#include "soc/efuse_reg.h"
|
||||||
#include "soc/syscon_reg.h"
|
#include "soc/syscon_reg.h"
|
||||||
#include "soc/system_reg.h"
|
#include "soc/system_reg.h"
|
||||||
|
#include "soc/io_mux_reg.h"
|
||||||
|
#include "soc/soc.h"
|
||||||
#include "regi2c_ctrl.h"
|
#include "regi2c_ctrl.h"
|
||||||
#include "regi2c_bbpll.h"
|
#include "regi2c_bbpll.h"
|
||||||
#include "esp_hw_log.h"
|
#include "esp_hw_log.h"
|
||||||
@@ -35,6 +37,12 @@ static int s_cur_pll_freq;
|
|||||||
|
|
||||||
static void rtc_clk_cpu_freq_to_8m(void);
|
static void rtc_clk_cpu_freq_to_8m(void);
|
||||||
|
|
||||||
|
void rtc_clk_32k_enable_external(void)
|
||||||
|
{
|
||||||
|
REG_SET_BIT(PERIPHS_IO_MUX_XTAL_32K_P_U, FUN_IE);
|
||||||
|
REG_SET_BIT(RTC_CNTL_PAD_HOLD_REG, RTC_CNTL_GPIO_PIN0_HOLD);
|
||||||
|
}
|
||||||
|
|
||||||
void rtc_clk_8m_enable(bool clk_8m_en, bool d256_en)
|
void rtc_clk_8m_enable(bool clk_8m_en, bool d256_en)
|
||||||
{
|
{
|
||||||
if (clk_8m_en) {
|
if (clk_8m_en) {
|
||||||
|
@@ -147,6 +147,8 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk)
|
|||||||
* will time out, returning 0.
|
* will time out, returning 0.
|
||||||
*/
|
*/
|
||||||
ESP_EARLY_LOGD(TAG, "waiting for external clock by pin0 to start up");
|
ESP_EARLY_LOGD(TAG, "waiting for external clock by pin0 to start up");
|
||||||
|
rtc_clk_32k_enable_external();
|
||||||
|
|
||||||
// When SLOW_CLK_CAL_CYCLES is set to 0, clock calibration will not be performed at startup.
|
// When SLOW_CLK_CAL_CYCLES is set to 0, clock calibration will not be performed at startup.
|
||||||
if (SLOW_CLK_CAL_CYCLES > 0) {
|
if (SLOW_CLK_CAL_CYCLES > 0) {
|
||||||
cal_val = rtc_clk_cal(RTC_CAL_EXT_CLK, SLOW_CLK_CAL_CYCLES);
|
cal_val = rtc_clk_cal(RTC_CAL_EXT_CLK, SLOW_CLK_CAL_CYCLES);
|
||||||
|
@@ -240,6 +240,11 @@ rtc_xtal_freq_t rtc_clk_xtal_freq_get(void);
|
|||||||
*/
|
*/
|
||||||
void rtc_clk_xtal_freq_update(rtc_xtal_freq_t xtal_freq);
|
void rtc_clk_xtal_freq_update(rtc_xtal_freq_t xtal_freq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable 32KHz external oscillator
|
||||||
|
*/
|
||||||
|
void rtc_clk_32k_enable_external(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable or disable 8 MHz internal oscillator
|
* @brief Enable or disable 8 MHz internal oscillator
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user