Skip to content

Commit

Permalink
fsk_demodulator: invert symbols in non-IQ if deviation is negative
Browse files Browse the repository at this point in the history
We use a negative deviation to indicate that the high tone encodes
the bit 0 and the low tone encodes the bit 1. With IQ input, this
is taken into account for quadrature demodulation. However, with
non-IQ input, which is already FM-demodulated, this wasn't taken
into account. In this case it is necessary to invert the stream
of symbols at some point.

See the discussion in
#307 (comment)
  • Loading branch information
daniestevez committed Oct 16, 2022
1 parent d057fb2 commit 730ad51
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/components/demodulators/fsk_demodulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,13 @@ def __init__(self, baudrate, samp_rate, iq, deviation=None,
self.connect(self.dcblock, self.clock_recovery)
if dump_path is not None:
self.connect(self.dcblock, self.waveform)
self.connect(self.clock_recovery, self)
if not iq and _deviation < 0:
# when working with FM-demodulated input, if the deviation is
# negative, the polarity of the signal needs to be inverted.
self.invert_polarity = blocks.multiply_const_ff(-1, 1)
self.connect(self.clock_recovery, self.invert_polarity, self)
else:
self.connect(self.clock_recovery, self)

_default_clk_rel_bw = 0.06
_default_clk_limit = 0.004
Expand Down

0 comments on commit 730ad51

Please sign in to comment.