diff --git a/csdr.c b/csdr.c index 38bc915..9cdb81d 100755 --- a/csdr.c +++ b/csdr.c @@ -131,7 +131,7 @@ char usage[]= " differential_decoder_u8_u8\n" " dump_u8\n" " psk_modulator_u8_c \n" -" psk31_interpolate_sine_cc\n" +" psk31_interpolate_sine_cc \n" " duplicate_samples_ntimes_u8_u8 \n" " bpsk_costas_loop_cc \n" " ?\n" @@ -2455,7 +2455,7 @@ int main(int argc, char *argv[]) FEOF_CHECK; if(debug_n && ++debug_i%debug_n==0) timing_recovery_trigger_debug(&state, 3); timing_recovery_cc((complexf*)input_buffer, (complexf*)output_buffer, the_bufsize, &state); - //fprintf(stderr, "os %d\n",state.output_size); + //fprintf(stderr, "trcc is=%d, os=%d, ip=%d\n",the_bufsize, state.output_size, state.input_processed); fwrite(output_buffer, sizeof(complexf), state.output_size, stdout); fflush(stdout); TRY_YIELD; diff --git a/grc_tests/test_bpsk_costas_loop.grc b/grc_tests/test_bpsk_costas_loop.grc index 256f34f..360a9c2 100644 --- a/grc_tests/test_bpsk_costas_loop.grc +++ b/grc_tests/test_bpsk_costas_loop.grc @@ -69,65 +69,6 @@ - - variable_slider - - comment - - - - converver - float_converter - - - value - 1000 - - - _enabled - True - - - _coordinate - (296, 11) - - - _rotation - 0 - - - grid_pos - - - - id - freq - - - label - - - - max - samp_rate/2 - - - min - 0 - - - notebook - - - - num_steps - 100 - - - style - wx.SL_HORIZONTAL - - variable_slider @@ -148,7 +89,7 @@ _coordinate - (960, 171) + (288, 11) _rotation @@ -211,7 +152,7 @@ value - 1000000 + 2**18 @@ -250,7 +191,7 @@ max - 1 + 2 minoutbuf @@ -262,7 +203,7 @@ num_samps - 1 + 1000 type @@ -273,6 +214,104 @@ True + + blocks_complex_to_float + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + _coordinate + (960, 265) + + + _rotation + 0 + + + id + blocks_complex_to_float_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_interleave + + alias + + + + blocksize + 1 + + + comment + + + + affinity + + + + _enabled + 0 + + + _coordinate + (1168, 265) + + + _rotation + 0 + + + id + blocks_interleave_0 + + + type + float + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_streams + 2 + + + vlen + 1 + + blocks_throttle @@ -293,7 +332,7 @@ _coordinate - (176, 211) + (456, 211) _rotation @@ -321,7 +360,7 @@ type - byte + complex vlen @@ -356,7 +395,7 @@ _coordinate - (376, 179) + (208, 179) _rotation @@ -388,7 +427,7 @@ samples_per_symbol - 256 + 2 verbose @@ -403,7 +442,7 @@ center_freq - freq_add + -freq_add comment @@ -419,11 +458,11 @@ _enabled - True + 1 _coordinate - (672, 211) + (688, 251) _rotation @@ -455,14 +494,14 @@ - ha5kfu_execproc_xx + ha5kfu_execproc_sink_f alias commandline - csdr bpsk_costas_loop_cc 1 + zsh -c \"csdr timing_recovery_cc GARDNER 16 --add_q --octave 1 1>/dev/null 2> >(octave -i)\" comment @@ -474,7 +513,42 @@ _enabled - True + 0 + + + _coordinate + (824, 427) + + + _rotation + 0 + + + id + ha5kfu_execproc_sink_f_0 + + + + ha5kfu_execproc_xx + + alias + + + + commandline + csdr bpsk_costas_loop_cc 8 + + + comment + + + + affinity + + + + _enabled + 1 _coordinate @@ -509,7 +583,7 @@ commandline - csdr timing_recovery_cc GARDNER 256 + csdr timing_recovery_cc GARDNER 16 --add_q | csdr fir_interpolate_cc 8 comment @@ -521,11 +595,11 @@ _enabled - True + 1 _coordinate - (112, 395) + (112, 403) _rotation @@ -548,6 +622,109 @@ cc + + wxgui_fftsink2 + + avg_alpha + 0 + + + average + False + + + baseband_freq + 0 + + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + fft_size + 1024 + + + freqvar + None + + + _coordinate + (960, 59) + + + _rotation + 0 + + + grid_pos + + + + id + wxgui_fftsink2_0 + + + notebook + + + + peak_hold + False + + + ref_level + 0 + + + ref_scale + 2.0 + + + fft_rate + 15 + + + samp_rate + samp_rate + + + title + FFT Plot + + + type + complex + + + win_size + + + + win + None + + + y_divs + 10 + + + y_per_div + 10 + + wxgui_scopesink2 @@ -568,7 +745,7 @@ _enabled - True + 1 _coordinate @@ -596,7 +773,7 @@ samp_rate - samp_rate/256 + (samp_rate/256)*8 t_scale @@ -655,7 +832,7 @@ _enabled - True + 1 _coordinate @@ -683,7 +860,7 @@ samp_rate - samp_rate/256 + (samp_rate/256)*8 t_scale @@ -722,30 +899,153 @@ Counts + + wxgui_scopesink2 + + ac_couple + False + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (688, 11) + + + _rotation + 0 + + + grid_pos + + + + id + wxgui_scopesink2_0_1 + + + notebook + + + + num_inputs + 1 + + + samp_rate + samp_rate + + + t_scale + 0 + + + title + After BPSK modulator + + + trig_mode + wxgui.TRIG_MODE_AUTO + + + type + complex + + + v_offset + 0 + + + v_scale + 0 + + + win_size + + + + xy_mode + False + + + y_axis_label + Counts + + analog_random_source_x_0 - blocks_throttle_0 - 0 - 0 - - - blocks_throttle_0 digital_psk_mod_0 0 0 - digital_psk_mod_0 + blocks_complex_to_float_0 + blocks_interleave_0 + 1 + 1 + + + blocks_complex_to_float_0 + blocks_interleave_0 + 0 + 0 + + + blocks_interleave_0 + ha5kfu_execproc_sink_f_0 + 0 + 0 + + + blocks_throttle_0 freq_xlating_fir_filter_xxx_0 0 0 + + blocks_throttle_0 + wxgui_scopesink2_0_1 + 0 + 0 + + + digital_psk_mod_0 + blocks_throttle_0 + 0 + 0 + + + freq_xlating_fir_filter_xxx_0 + blocks_complex_to_float_0 + 0 + 0 + freq_xlating_fir_filter_xxx_0 ha5kfu_execproc_xx_0_0 0 0 + + freq_xlating_fir_filter_xxx_0 + wxgui_fftsink2_0 + 0 + 0 + ha5kfu_execproc_xx_0 wxgui_scopesink2_0_0 diff --git a/libcsdr.c b/libcsdr.c index 5af8826..15157c8 100644 --- a/libcsdr.c +++ b/libcsdr.c @@ -1837,11 +1837,11 @@ void timing_recovery_cc(complexf* input, complexf* output, int input_size, timin int debug_i = state->debug_count; float error; int el_point_left_index, el_point_right_index, el_point_mid_index; - int si; + int si = 0; if(state->debug_force) fprintf(stderr, "disp(\"begin timing_recovery_cc\");\n"); if(MTIMINGR_HDEBUG) fprintf(stderr, "timing_recovery_cc started, nsb = %d, nshb = %d, nsqb = %d\n", num_samples_bit, num_samples_halfbit, num_samples_quarterbit); { - for(si=0;;si++) + for(;;) { //the MathWorks style algorithm has correction_offset. //correction_offset = 0; @@ -1862,7 +1862,7 @@ void timing_recovery_cc(complexf* input, complexf* output, int input_size, timin el_point_right_index = current_bitstart_index + num_samples_earlylate_wing * 3; el_point_left_index = current_bitstart_index + num_samples_earlylate_wing * 1 - correction_offset; el_point_mid_index = current_bitstart_index + num_samples_halfbit; - output[si++] = input[current_bitstart_index + el_point_mid_index]; + output[si++] = input[el_point_mid_index]; } else if(state->algorithm == TIMING_RECOVERY_ALGORITHM_GARDNER) { @@ -1870,7 +1870,7 @@ void timing_recovery_cc(complexf* input, complexf* output, int input_size, timin el_point_right_index = current_bitstart_index + num_samples_halfbit * 3; el_point_left_index = current_bitstart_index + num_samples_halfbit * 1; el_point_mid_index = current_bitstart_index + num_samples_halfbit * 2; - output[si++] = input[current_bitstart_index + num_samples_halfbit * 1]; + output[si++] = input[el_point_left_index]; } else break;