summaryrefslogtreecommitdiff
path: root/gr-noaa/lib
diff options
context:
space:
mode:
authorJohnathan Corgan <jcorgan@corganenterprises.com>2009-10-31 09:28:44 -0700
committerJohnathan Corgan <jcorgan@corganenterprises.com>2009-11-01 19:45:34 -0800
commitae5b4ed2ce8c4a0903eea1b264da5393a179c9fe (patch)
tree73e40e054dbc3fd063b2ce2edcb01e937c333717 /gr-noaa/lib
parentedf412a8ef283d08135a1c5f9c1b4f51b771ec37 (diff)
gr-noaa: Switched to 'double rate BPSK' HRPT synchronization
Added hrpt_bit_sync block Using MM clock sync at double data rate Created file_rx_hrpt GRC app Updated demod_rx_hrpt GRC app Updated usrp_rx_hrpt GRC Updated usrp_rx_hrpt_nogui app Deleted usrp_rx_hrpt2 GRC app Deleted hrpt_sync_fb block
Diffstat (limited to 'gr-noaa/lib')
-rw-r--r--gr-noaa/lib/Makefile.am8
-rw-r--r--gr-noaa/lib/noaa_hrpt_bit_sync.cc72
-rw-r--r--gr-noaa/lib/noaa_hrpt_bit_sync.h49
-rw-r--r--gr-noaa/lib/noaa_hrpt_sync_fb.cc95
-rw-r--r--gr-noaa/lib/noaa_hrpt_sync_fb.h58
5 files changed, 125 insertions, 157 deletions
diff --git a/gr-noaa/lib/Makefile.am b/gr-noaa/lib/Makefile.am
index 6435d192e9..a4423167eb 100644
--- a/gr-noaa/lib/Makefile.am
+++ b/gr-noaa/lib/Makefile.am
@@ -29,10 +29,10 @@ lib_LTLIBRARIES = \
libgnuradio-noaa.la
libgnuradio_noaa_la_SOURCES = \
+ noaa_hrpt_bit_sync.cc \
noaa_hrpt_decoder.cc \
noaa_hrpt_deframer.cc \
- noaa_hrpt_pll_cf.cc \
- noaa_hrpt_sync_fb.cc
+ noaa_hrpt_pll_cf.cc
libgnuradio_noaa_la_LIBADD = \
$(GNURADIO_CORE_LA)
@@ -40,7 +40,7 @@ libgnuradio_noaa_la_LIBADD = \
libgnuradio_noaa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
grinclude_HEADERS = \
+ noaa_hrpt_bit_sync.h \
noaa_hrpt_decoder.h \
noaa_hrpt_deframer.h \
- noaa_hrpt_pll_cf.h \
- noaa_hrpt_sync_fb.h
+ noaa_hrpt_pll_cf.h \ No newline at end of file
diff --git a/gr-noaa/lib/noaa_hrpt_bit_sync.cc b/gr-noaa/lib/noaa_hrpt_bit_sync.cc
new file mode 100644
index 0000000000..53e47d91ec
--- /dev/null
+++ b/gr-noaa/lib/noaa_hrpt_bit_sync.cc
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <noaa_hrpt_bit_sync.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+noaa_hrpt_bit_sync_sptr
+noaa_make_hrpt_bit_sync()
+{
+ return gnuradio::get_initial_sptr(new noaa_hrpt_bit_sync());
+}
+
+noaa_hrpt_bit_sync::noaa_hrpt_bit_sync()
+ : gr_block("noaa_hrpt_bit_sync",
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature(1, 1, sizeof(char))),
+ d_mid_bit(true),
+ d_last_bit(0)
+{
+}
+
+int
+noaa_hrpt_bit_sync::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ int ninputs = ninput_items[0];
+ const char *in = (const char *)input_items[0];
+ char *out = (char *)output_items[0];
+
+ int i = 0, j = 0;
+ while (i < ninputs && j < noutput_items) {
+ char bit = in[i++];
+ char diff = bit^d_last_bit;
+ d_last_bit = bit;
+
+ if (d_mid_bit && diff) {
+ out[j++] = bit;
+ d_mid_bit = false;
+ }
+ else
+ d_mid_bit = true;
+ }
+
+ consume_each(i);
+ return j;
+}
diff --git a/gr-noaa/lib/noaa_hrpt_bit_sync.h b/gr-noaa/lib/noaa_hrpt_bit_sync.h
new file mode 100644
index 0000000000..8b8633cdcc
--- /dev/null
+++ b/gr-noaa/lib/noaa_hrpt_bit_sync.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_NOAA_HRPT_BIT_SYNC_H
+#define INCLUDED_NOAA_HRPT_BIT_SYNC_H
+
+#include <gr_block.h>
+
+class noaa_hrpt_bit_sync;
+typedef boost::shared_ptr<noaa_hrpt_bit_sync> noaa_hrpt_bit_sync_sptr;
+
+noaa_hrpt_bit_sync_sptr
+noaa_make_hrpt_bit_sync();
+
+class noaa_hrpt_bit_sync : public gr_block
+{
+ friend noaa_hrpt_bit_sync_sptr noaa_make_hrpt_bit_sync();
+ noaa_hrpt_bit_sync();
+
+ bool d_mid_bit;
+ unsigned char d_last_bit;
+
+ public:
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_NOAA_HRPT_BIT_SYNC_H */
diff --git a/gr-noaa/lib/noaa_hrpt_sync_fb.cc b/gr-noaa/lib/noaa_hrpt_sync_fb.cc
deleted file mode 100644
index 9c655b0d98..0000000000
--- a/gr-noaa/lib/noaa_hrpt_sync_fb.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <noaa_hrpt_sync_fb.h>
-#include <gr_io_signature.h>
-
-inline int signum(float f)
-{
- return f >= 0.0 ? 1 : -1;
-}
-
-noaa_hrpt_sync_fb_sptr
-noaa_make_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset)
-{
- return gnuradio::get_initial_sptr(new noaa_hrpt_sync_fb(alpha, beta, sps, max_offset));
-}
-
-noaa_hrpt_sync_fb::noaa_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset)
- : gr_block("noaa_hrpt_sync_fb",
- gr_make_io_signature(1, 1, sizeof(float)),
- gr_make_io_signature(1, 1, sizeof(char))),
- d_alpha(alpha), d_beta(beta),
- d_sps(sps), d_max_offset(max_offset),
- d_phase(0.0), d_freq(1.0/sps),
- d_last_sign(1)
-{
-}
-
-int
-noaa_hrpt_sync_fb::general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- int ninputs = ninput_items[0];
- const float *in = (const float *)input_items[0];
- char *out = (char *)output_items[0];
-
- int i = 0, j = 0;
- while (i < ninputs && j < noutput_items) {
- float sample = in[i++];
- int sign = signum(sample);
- d_phase += d_freq;
-
- // Train on zero crossings in center region of symbol
- if (sign != d_last_sign) {
- float phase_err = 0.0;
- if (d_phase > 0.25 && d_phase < 0.75)
- phase_err = d_phase-0.5;
- else if (d_phase >= 0.75)
- phase_err = d_phase - 1.0;
- else
- phase_err = d_phase;
-
- d_phase -= phase_err*d_alpha; // 1st order phase adjustment
- d_freq -= phase_err*d_beta; // 2nd order frequency adjustment
-
- d_last_sign = sign;
- }
-
- if (d_phase > 1.0) {
- if (sample < 0.0)
- out[j++] = 1;
- else
- out[j++] = 0;
- d_phase -= 1.0;
- }
- }
-
- consume_each(i);
- return j;
-}
diff --git a/gr-noaa/lib/noaa_hrpt_sync_fb.h b/gr-noaa/lib/noaa_hrpt_sync_fb.h
deleted file mode 100644
index a9416b9ead..0000000000
--- a/gr-noaa/lib/noaa_hrpt_sync_fb.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_NOAA_HRPT_SYNC_FB_H
-#define INCLUDED_NOAA_HRPT_SYNC_FB_H
-
-#include <gr_block.h>
-
-class noaa_hrpt_sync_fb;
-typedef boost::shared_ptr<noaa_hrpt_sync_fb> noaa_hrpt_sync_fb_sptr;
-
-noaa_hrpt_sync_fb_sptr
-noaa_make_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset);
-
-class noaa_hrpt_sync_fb : public gr_block
-{
- friend noaa_hrpt_sync_fb_sptr noaa_make_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset);
- noaa_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset);
-
- float d_alpha; // 1st order loop constant
- float d_beta; // 2nd order loop constant
- float d_sps; // samples per symbol
- float d_max_offset; // Maximum frequency offset for d_sps, samples/symbol
- float d_phase; // Instantaneous symbol phase
- float d_freq; // Instantaneous symbol frequency, samples/symbol
- int d_last_sign; // Tracks zero crossings
-
- public:
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- void set_alpha(float alpha) { d_alpha = alpha; }
- void set_beta(float beta) { d_beta = beta; }
- void set_max_offset(float max_offset) { d_max_offset = max_offset; }
-};
-
-#endif /* INCLUDED_NOAA_HRPT_SYNC_FB_H */