Skip to content

Commit

Permalink
Merge branch 'bugfix/enable_i2c_master_clock_in_bbpll_configure_v5.1'…
Browse files Browse the repository at this point in the history
… into 'release/v5.1'

fix(rtc_clk): fix i2c master clock missing in bbpll configure (backport v5.1)

See merge request espressif/esp-idf!24852
  • Loading branch information
jack0c committed Jul 31, 2023
2 parents 4cf31c3 + 9df77e0 commit 9fa9621
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/esp_hw_support/port/esp32c6/rtc_clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "esp_rom_sys.h"
#include "hal/clk_tree_ll.h"
#include "hal/regi2c_ctrl_ll.h"
#include "hal/modem_lpcon_ll.h"
#include "soc/io_mux_reg.h"
#include "soc/lp_aon_reg.h"

Expand Down Expand Up @@ -142,13 +143,15 @@ static void rtc_clk_bbpll_configure(rtc_xtal_freq_t xtal_freq, int pll_freq)
/* Digital part */
clk_ll_bbpll_set_freq_mhz(pll_freq);
/* Analog part */
modem_lpcon_ll_enable_i2c_master_clock(&MODEM_LPCON, true);
/* BBPLL CALIBRATION START */
regi2c_ctrl_ll_bbpll_calibration_start();
clk_ll_bbpll_set_config(pll_freq, xtal_freq);
/* WAIT CALIBRATION DONE */
while(!regi2c_ctrl_ll_bbpll_calibration_is_done());
/* BBPLL CALIBRATION STOP */
regi2c_ctrl_ll_bbpll_calibration_stop();
modem_lpcon_ll_enable_i2c_master_clock(&MODEM_LPCON, false);

s_cur_pll_freq = pll_freq;
}
Expand Down
3 changes: 3 additions & 0 deletions components/esp_hw_support/port/esp32h2/rtc_clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "esp_rom_sys.h"
#include "hal/clk_tree_ll.h"
#include "hal/regi2c_ctrl_ll.h"
#include "hal/modem_lpcon_ll.h"
#include "soc/io_mux_reg.h"
#include "soc/lp_aon_reg.h"
#include "soc/lp_clkrst_reg.h"
Expand Down Expand Up @@ -159,13 +160,15 @@ static void rtc_clk_bbpll_configure(rtc_xtal_freq_t xtal_freq, int pll_freq)
/* Digital part */
clk_ll_bbpll_set_freq_mhz(pll_freq);
/* Analog part */
modem_lpcon_ll_enable_i2c_master_clock(&MODEM_LPCON, true);
/* BBPLL CALIBRATION START */
regi2c_ctrl_ll_bbpll_calibration_start();
clk_ll_bbpll_set_config(pll_freq, xtal_freq);
/* WAIT CALIBRATION DONE */
while(!regi2c_ctrl_ll_bbpll_calibration_is_done());
/* BBPLL CALIBRATION STOP */
regi2c_ctrl_ll_bbpll_calibration_stop();
modem_lpcon_ll_enable_i2c_master_clock(&MODEM_LPCON, false);

s_cur_pll_freq = pll_freq;
}
Expand Down

0 comments on commit 9fa9621

Please sign in to comment.