Add differential part to coarse frequency control
This commit is contained in:
parent
2f2834026e
commit
26a2558535
|
@ -31,6 +31,9 @@
|
||||||
#define PLL_BW_HEADER 0.03f
|
#define PLL_BW_HEADER 0.03f
|
||||||
#define PLL_BW_DATA 0.01f
|
#define PLL_BW_DATA 0.01f
|
||||||
|
|
||||||
|
#define COARSE_FREQ_EST_P 0.05f
|
||||||
|
#define COARSE_FREQ_EST_D 0.01f
|
||||||
|
|
||||||
static void update_nco_pll(nco_crcf nco, float phase_error, float bw)
|
static void update_nco_pll(nco_crcf nco, float phase_error, float bw)
|
||||||
{
|
{
|
||||||
const float pll_alpha = bw; // phase adjustment factor
|
const float pll_alpha = bw; // phase adjustment factor
|
||||||
|
@ -136,7 +139,9 @@ static bool acquire_preamble(layer1_rx_t *rx, const float complex sample, bool d
|
||||||
// this case.
|
// this case.
|
||||||
if(freq_est != 0.0f) {
|
if(freq_est != 0.0f) {
|
||||||
// apply the frequency adjustment
|
// apply the frequency adjustment
|
||||||
float freq_adjustment = freq_est / RRC_SPS / FREQ_EST_L;
|
float x = freq_est / RRC_SPS;
|
||||||
|
float freq_adjustment = COARSE_FREQ_EST_P * x + COARSE_FREQ_EST_D * (x - rx->freq_est_last);
|
||||||
|
rx->freq_est_last = x;
|
||||||
nco_crcf_adjust_frequency(rx->carrier_coarse_nco, freq_adjustment);
|
nco_crcf_adjust_frequency(rx->carrier_coarse_nco, freq_adjustment);
|
||||||
|
|
||||||
// limit the absolute frequency offset value
|
// limit the absolute frequency offset value
|
||||||
|
@ -543,6 +548,9 @@ result_t layer1_rx_init(layer1_rx_t *rx, rx_callback_t callback)
|
||||||
// Correlator for preamble search
|
// Correlator for preamble search
|
||||||
correlator_init(&rx->preamble_correlator, preamble_get_symbols(), preamble_get_symbol_count());
|
correlator_init(&rx->preamble_correlator, preamble_get_symbols(), preamble_get_symbol_count());
|
||||||
|
|
||||||
|
// initialize coarse frequency control
|
||||||
|
rx->freq_est_last = 0.0f;
|
||||||
|
|
||||||
// precalculate encoded header length in symbols
|
// precalculate encoded header length in symbols
|
||||||
unsigned int hdr_bps = modem_get_bps(rx->hdr_demod);
|
unsigned int hdr_bps = modem_get_bps(rx->hdr_demod);
|
||||||
rx->hdr_len_enc_bytes = fec_get_enc_msg_length(HEADER_CHANNEL_CODE, HEADER_SIZE_BYTES);
|
rx->hdr_len_enc_bytes = fec_get_enc_msg_length(HEADER_CHANNEL_CODE, HEADER_SIZE_BYTES);
|
||||||
|
|
|
@ -62,6 +62,9 @@ typedef struct layer1_rx_s
|
||||||
// Callback function to notify user of certain events
|
// Callback function to notify user of certain events
|
||||||
rx_callback_t callback;
|
rx_callback_t callback;
|
||||||
|
|
||||||
|
// Frequency estimation PD control
|
||||||
|
float freq_est_last;
|
||||||
|
|
||||||
// Precalcuated header lengths
|
// Precalcuated header lengths
|
||||||
unsigned int hdr_len_symbols;
|
unsigned int hdr_len_symbols;
|
||||||
unsigned int hdr_len_enc_bytes;
|
unsigned int hdr_len_enc_bytes;
|
||||||
|
|
Loading…
Reference in a new issue