fix: 修改跳频和afc相关逻辑

原跳频逻辑无法跳频到高频点;修改afc的时间,延长至25us;按照乒乓跳频手册,去除afc的锁定回读,否则影响程序运行时间,进而降低跳速
This commit is contained in:
2025-05-23 10:57:26 +08:00
parent 9fe7475014
commit bad5bbd18b
3 changed files with 17 additions and 9 deletions
@@ -896,13 +896,14 @@ bool afcPll1()
writeSpi(0x617, 0x03); writeSpi(0x617, 0x03);
pause(delay_afc); pause(delay_afc);
writeSpi(0x61D, saved); writeSpi(0x61D, saved);
pause(delay_afc); // pause(delay_afc);
const auto lock = readSpi(0x635); // const auto lock = readSpi(0x635);
// const auto lock1 = readSpi(0x635); // const auto lock1 = readSpi(0x635);
// const auto lock2 = readSpi(0x635); // const auto lock2 = readSpi(0x635);
// const auto lock3 = readSpi(0x635); // const auto lock3 = readSpi(0x635);
// return 0x10 & lock & lock1 & lock2 & lock3 ; // return 0x10 & lock & lock1 & lock2 & lock3 ;
return 0x10 & lock ; // return 0x10 & lock ;
return true ;
} }
bool afcPll2() bool afcPll2()
@@ -915,13 +916,15 @@ bool afcPll2()
writeSpi(0x639, 0x03); writeSpi(0x639, 0x03);
pause(delay_afc); pause(delay_afc);
writeSpi(0x63F, saved); writeSpi(0x63F, saved);
pause(delay_afc); // pause(delay_afc);
const auto lock = readSpi(0x657); // const auto lock = readSpi(0x657);
// const auto lock1 = readSpi(0x657); // const auto lock1 = readSpi(0x657);
// const auto lock2 = readSpi(0x657); // const auto lock2 = readSpi(0x657);
// const auto lock3 = readSpi(0x657); // const auto lock3 = readSpi(0x657);
// return 0x10 & lock & lock1 & lock2 & lock3 ; // return 0x10 & lock & lock1 & lock2 & lock3 ;
return 0x10 & lock ; // return 0x10 & lock ;
return true ;
} }
bool afcPll3() bool afcPll3()
@@ -55,7 +55,7 @@ enum class NCOMode { Bypass = 0, Up, Down, BIST, Master, Slaver };
* @brief AFC等待延时,单位ms * @brief AFC等待延时,单位ms
*/ */
constexpr double delay = 100; constexpr double delay = 100;
constexpr double delay_afc = 0.020; constexpr double delay_afc = 0.025;
/** /**
* @brief QEC等待延时,单位ms * @brief QEC等待延时,单位ms
*/ */
@@ -29,6 +29,7 @@ void frqhop_config(int hop_flag){
static int hop_cnt = 0; static int hop_cnt = 0;
static int next_pll_index = 2; static int next_pll_index = 2;
static double curr_freq; static double curr_freq;
static double hop_freq = MIN_FREQ + FREQ_SEP;
static double next_freq = MIN_FREQ; static double next_freq = MIN_FREQ;
static int unlock_pll1_cnt = 0, unlock_pll2_cnt = 0; static int unlock_pll1_cnt = 0, unlock_pll2_cnt = 0;
@@ -36,13 +37,17 @@ void frqhop_config(int hop_flag){
{ {
curr_freq = next_freq; curr_freq = next_freq;
hop_cnt++; hop_cnt++;
if (hop_cnt % 3 == 2) if (hop_cnt % 3 == 0)
{ {
next_freq = MIN_FREQ; next_freq = MIN_FREQ;
} }
else else
{ {
next_freq = (curr_freq + FREQ_SEP > MAX_FREQ) ? MIN_FREQ : curr_freq + FREQ_SEP; hop_freq += FREQ_SEP;
if( hop_freq > MAX_FREQ){
hop_freq = MIN_FREQ + FREQ_SEP;
}
next_freq = hop_freq;
} }
if (next_pll_index == 2) if (next_pll_index == 2)