rx: use different PLL BW for header and data
This commit is contained in:
parent
bbf7bcf2f0
commit
79d7f74dfc
|
@ -31,17 +31,20 @@
|
|||
# define DEBUG_LOG(...) {}
|
||||
#endif
|
||||
|
||||
static void update_nco_pll(nco_crcf nco, float phase_error)
|
||||
#define PLL_BW_HEADER 0.03f
|
||||
#define PLL_BW_DATA 0.01f
|
||||
|
||||
static void update_nco_pll(nco_crcf nco, float phase_error, float bw)
|
||||
{
|
||||
static const float pll_alpha = 0.03f; // phase adjustment factor
|
||||
static const float pll_beta = (pll_alpha * pll_alpha) / 2.0f; // frequency adjustment factor
|
||||
const float pll_alpha = bw; // phase adjustment factor
|
||||
const float pll_beta = (pll_alpha * pll_alpha) * 1.0f; // frequency adjustment factor
|
||||
|
||||
nco_crcf_adjust_phase(nco, pll_alpha * phase_error);
|
||||
nco_crcf_adjust_frequency(nco, pll_beta * phase_error);
|
||||
|
||||
DEBUG_LOG("NCO adjusted: f=%.6f, φ=%.6f\n",
|
||||
/*DEBUG_LOG("NCO adjusted: f=%.6f, φ=%.6f\n",
|
||||
nco_crcf_get_frequency(nco),
|
||||
nco_crcf_get_phase(nco));
|
||||
nco_crcf_get_phase(nco));*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -217,7 +220,7 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
|||
//DEBUG_LOG("Sym: %d; Phase error: %f\n", sym_demod, phase_error);
|
||||
|
||||
|
||||
update_nco_pll(rx->carrier_fine_nco, phase_error);
|
||||
update_nco_pll(rx->carrier_fine_nco, phase_error, PLL_BW_HEADER);
|
||||
|
||||
symbols_int[symbol_counter] = sym_demod;
|
||||
symbol_counter++;
|
||||
|
@ -306,7 +309,7 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
|||
float phase_error = modem_get_demodulator_phase_error(rx->payload_demod);
|
||||
//DEBUG_LOG("Sym: %d; Phase error: %f\n", sym_demod, phase_error);
|
||||
|
||||
update_nco_pll(rx->carrier_fine_nco, phase_error);
|
||||
update_nco_pll(rx->carrier_fine_nco, phase_error, PLL_BW_DATA);
|
||||
|
||||
symbols_int[symbol_counter] = sym_demod;
|
||||
symbol_counter++;
|
||||
|
|
Loading…
Reference in a new issue