mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(mspi): fixed bbpll calibration issue
This commit is contained in:
parent
9e756359cc
commit
cd193469f2
@ -180,14 +180,21 @@ static bool get_working_pll_freq(const uint8_t *reference_data, bool is_flash, u
|
|||||||
uint32_t min_freq = big_num;
|
uint32_t min_freq = big_num;
|
||||||
rtc_xtal_freq_t xtal_freq = rtc_clk_xtal_freq_get();
|
rtc_xtal_freq_t xtal_freq = rtc_clk_xtal_freq_get();
|
||||||
|
|
||||||
//BBPLL CALIBRATION START
|
|
||||||
regi2c_ctrl_ll_bbpll_calibration_start();
|
|
||||||
for (int pll_mhz_tuning = MSPI_TIMING_PLL_FREQ_SCAN_RANGE_MHZ_MIN; pll_mhz_tuning <= MSPI_TIMING_PLL_FREQ_SCAN_RANGE_MHZ_MAX; pll_mhz_tuning += 8) {
|
for (int pll_mhz_tuning = MSPI_TIMING_PLL_FREQ_SCAN_RANGE_MHZ_MIN; pll_mhz_tuning <= MSPI_TIMING_PLL_FREQ_SCAN_RANGE_MHZ_MAX; pll_mhz_tuning += 8) {
|
||||||
|
//bbpll calibration start
|
||||||
|
regi2c_ctrl_ll_bbpll_calibration_start();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pll_mhz = xtal_mhz * (oc_div + 4) / (oc_ref_div + 1)
|
* pll_mhz = xtal_mhz * (oc_div + 4) / (oc_ref_div + 1)
|
||||||
*/
|
*/
|
||||||
clk_ll_bbpll_set_frequency_for_mspi_tuning(xtal_freq, pll_mhz_tuning, ((pll_mhz_tuning / 4) - 4), 9);
|
clk_ll_bbpll_set_frequency_for_mspi_tuning(xtal_freq, pll_mhz_tuning, ((pll_mhz_tuning / 4) - 4), 9);
|
||||||
|
|
||||||
|
//wait calibration done
|
||||||
|
while(!regi2c_ctrl_ll_bbpll_calibration_is_done());
|
||||||
|
|
||||||
|
//bbpll calibration stop
|
||||||
|
regi2c_ctrl_ll_bbpll_calibration_stop();
|
||||||
|
|
||||||
memset(read_data, 0, MSPI_TIMING_TEST_DATA_LEN);
|
memset(read_data, 0, MSPI_TIMING_TEST_DATA_LEN);
|
||||||
if (is_flash) {
|
if (is_flash) {
|
||||||
mspi_timing_config_flash_read_data(read_data, MSPI_TIMING_FLASH_TEST_DATA_ADDR, MSPI_TIMING_TEST_DATA_LEN);
|
mspi_timing_config_flash_read_data(read_data, MSPI_TIMING_FLASH_TEST_DATA_ADDR, MSPI_TIMING_TEST_DATA_LEN);
|
||||||
@ -213,12 +220,13 @@ static bool get_working_pll_freq(const uint8_t *reference_data, bool is_flash, u
|
|||||||
|
|
||||||
//restore PLL config
|
//restore PLL config
|
||||||
clk_ll_bbpll_set_freq_mhz(previous_config.source_freq_mhz);
|
clk_ll_bbpll_set_freq_mhz(previous_config.source_freq_mhz);
|
||||||
|
//bbpll calibration start
|
||||||
|
regi2c_ctrl_ll_bbpll_calibration_start();
|
||||||
|
//set pll
|
||||||
clk_ll_bbpll_set_config(previous_config.source_freq_mhz, xtal_freq);
|
clk_ll_bbpll_set_config(previous_config.source_freq_mhz, xtal_freq);
|
||||||
|
//wait calibration done
|
||||||
//WAIT CALIBRATION DONE
|
|
||||||
while(!regi2c_ctrl_ll_bbpll_calibration_is_done());
|
while(!regi2c_ctrl_ll_bbpll_calibration_is_done());
|
||||||
|
//bbpll calibration stop
|
||||||
//BBPLL CALIBRATION STOP
|
|
||||||
regi2c_ctrl_ll_bbpll_calibration_stop();
|
regi2c_ctrl_ll_bbpll_calibration_stop();
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user