From c7137dc68e9d8c7255b753b346931fd285acc0db Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Sat, 1 Apr 2017 16:08:49 +0200 Subject: [PATCH] The costas loop seems to at least work --- grc_tests/test_bpsk_costas_loop.grc | 42 ++++++++++++++--------------- libcsdr.c | 4 +-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/grc_tests/test_bpsk_costas_loop.grc b/grc_tests/test_bpsk_costas_loop.grc index 360a9c2..7ce3934 100644 --- a/grc_tests/test_bpsk_costas_loop.grc +++ b/grc_tests/test_bpsk_costas_loop.grc @@ -517,7 +517,7 @@ _coordinate - (824, 427) + (976, 379) _rotation @@ -536,7 +536,7 @@ commandline - csdr bpsk_costas_loop_cc 8 + csdr bpsk_costas_loop_cc 16 comment @@ -552,7 +552,7 @@ _coordinate - (120, 523) + (128, 411) _rotation @@ -595,11 +595,11 @@ _enabled - 1 + 0 _coordinate - (112, 403) + (432, 411) _rotation @@ -745,11 +745,11 @@ _enabled - 1 + 0 _coordinate - (544, 371) + (824, 507) _rotation @@ -836,7 +836,7 @@ _coordinate - (536, 523) + (432, 507) _rotation @@ -1016,12 +1016,6 @@ 0 0 - - blocks_throttle_0 - wxgui_scopesink2_0_1 - 0 - 0 - digital_psk_mod_0 blocks_throttle_0 @@ -1036,7 +1030,7 @@ freq_xlating_fir_filter_xxx_0 - ha5kfu_execproc_xx_0_0 + ha5kfu_execproc_xx_0 0 0 @@ -1046,18 +1040,24 @@ 0 0 + + freq_xlating_fir_filter_xxx_0 + wxgui_scopesink2_0_1 + 0 + 0 + + + ha5kfu_execproc_xx_0 + ha5kfu_execproc_xx_0_0 + 0 + 0 + ha5kfu_execproc_xx_0 wxgui_scopesink2_0_0 0 0 - - ha5kfu_execproc_xx_0_0 - ha5kfu_execproc_xx_0 - 0 - 0 - ha5kfu_execproc_xx_0_0 wxgui_scopesink2_0 diff --git a/libcsdr.c b/libcsdr.c index 15157c8..4aeecf1 100644 --- a/libcsdr.c +++ b/libcsdr.c @@ -1874,7 +1874,7 @@ void timing_recovery_cc(complexf* input, complexf* output, int input_size, timin } else break; - error = ( iof(input, el_point_right_index) - iof(input, el_point_left_index)) * iof(input, el_point_mid_index); + error = ( iof(input, el_point_right_index) - iof(input, el_point_left_index) ) * iof(input, el_point_mid_index); if(state->use_q) { error += ( qof(input, el_point_right_index) - qof(input, el_point_left_index)) * qof(input, el_point_mid_index); @@ -1949,7 +1949,7 @@ bpsk_costas_loop_state_t init_bpsk_costas_loop_cc(float samples_per_bits) rc_filter_cutoff, rc_filter_rc, virtual_sampling_dt); state.rc_filter_alpha = virtual_sampling_dt/(rc_filter_rc+virtual_sampling_dt); //https://en.wikipedia.org/wiki/Low-pass_filter float rc_filter_omega_cutoff = 2*M_PI*rc_filter_cutoff; - state.vco_phase_addition_multiplier = 8*rc_filter_omega_cutoff; //as of Equation 25 in Feigin, assuming input signal amplitude of 1 (to 1V) and (state.vco_phase_addition_multiplier*), a value in radians, will be added to the vco_phase directly. + state.vco_phase_addition_multiplier = 8*rc_filter_omega_cutoff / (virtual_sampling_rate); //as of Equation 25 in Feigin, assuming input signal amplitude of 1 (to 1V) and (state.vco_phase_addition_multiplier*), a value in radians, will be added to the vco_phase directly. fprintf(stderr, "rc_filter_alpha = %g, rc_filter_omega_cutoff = %g, vco_phase_addition_multiplier = %g\n", state.rc_filter_alpha, rc_filter_omega_cutoff, state.vco_phase_addition_multiplier); return state;