discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] DQPSK Modulation/Demodulation issue


From: marcin_w
Subject: [Discuss-gnuradio] DQPSK Modulation/Demodulation issue
Date: Wed, 21 Apr 2010 05:28:23 -0700 (PDT)

I've recently been working on transmitting data from a vector source via
DQPSK.

I've created a Simulation [non USRP] with the following flow graph:
   
   TX
   Vector Source [0x6c] ie 01 10 11 00  > Packed To Unpacked > Mapper
[Binary 2 Gray] > Differential Encoder >
   Chunks to Symbols

   RX
   Differential Phasor > Constellation Decoder > Mapper [Gray 2 Binary] >
Unpacked To Packed > Vector Sink
   
For differential encoding, i've also ammended the first input byte to be 0.
The Output for the simulation is as expected:

ie.  Input = 0 108 108 108 108 108 108 .......
     Output = 0 108 108 108 108 108 108 .......

When i try transmitting this data through the USRP however, i receive 4
possible outputs. These include:

  108 [which is correct]
  177 [wrong]
  108 [wrong]
  27   [wrong]

  These are funnily the 4 possible outputs which have all possible symbols
in 1 byte.  ie 00 01 10 11
  The output varies, one time i might get all 108s as expected , and other
times ill get one of the other 3 outputs.
  The signal constellation at the output of the differential phasor looks
correct.

  Does anyone have any idea what is going wrong here?
  I've included my python source code below:

  ##################################################
# Gnuradio Python Flow Graph
# Title: Qpsktest
# Generated: Thu Apr 22 02:01:45 2010
##################################################

from gnuradio import gr
from gnuradio.blks2impl import psk
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from grc_gnuradio import usrp as grc_usrp
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import wx

class QPSKtest(gr.top_block):

        def __init__(self):
                gr.top_block.__init__(self)

                ##################################################
                # Variables
                ##################################################
                self.arity = arity = pow(2,2)
                self.samp_rate = samp_rate = 256000
                self.rotated_const = rotated_const = map(lambda pt: pt * 1,
psk.constellation[arity])
                self.rot = rot = .707 + .707j
                self.data = 100000 * [0x6C,]

                ## Initial Block to Capture data from Vector Source and then
Add 0 at the beginning
       
                fg = gr.top_block()
               
                self.vectorSource = gr.vector_source_b(self.data, False, 1)
                self.VSINK = gr.vector_sink_b(1)
               
                fg.connect(self.vectorSource, self.VSINK)

                fg.run()

                actual_data = self.VSINK.data()
       
                ##make first data element 0 for the sake of the Diff Encoder
etc
                actual_data_copy = (0,) + actual_data[1:]
                print actual_data_copy

                ##################################################
                # Main Blocks
                ##################################################
                self.gr_chunks_to_symbols_xx_0 =
gr.chunks_to_symbols_bc((map(lambda pt: pt * rot,
psk.constellation[arity])), 1)
                self.gr_clock_recovery_mm_xx_0 = gr.clock_recovery_mm_cc(2,
0.25 * 0.03 * 0.03, 0.05, 0.03, 0.005)
                self.gr_constellation_decoder_cb_0 =
gr.constellation_decoder_cb((rotated_const), (range(arity)))
                self.gr_costas_loop_cc_0 = gr.costas_loop_cc(0.10, 0.25 *
0.1 * 0.1, 0.002, -0.002, 4)
                self.gr_diff_encoder_bb_0 = gr.diff_encoder_bb(arity)
                self.gr_diff_phasor_cc_0 = gr.diff_phasor_cc()
                self.gr_feedforward_agc_cc_0 = gr.feedforward_agc_cc(16,
1.0)
                self.gr_fir_filter_xxx_1 = gr.fir_filter_ccf(1,
(gr.firdes.root_raised_cosine(2,2,1.0,0.35,22)))
                self.gr_interp_fir_filter_xxx_0 =
gr.interp_fir_filter_ccf(2, (gr.firdes.root_raised_cosine(2, 2, 1.0, 0.35,
22)))
                self.gr_map_bb_0 = gr.map_bb((psk.binary_to_gray[arity]))
                self.gr_map_bb_0_0 = gr.map_bb((psk.gray_to_binary[arity]))
                self.gr_multiply_const_vxx_0 =
gr.multiply_const_vcc(((1.0/16384.0), ))
                self.gr_multiply_const_vxx_0_1 =
gr.multiply_const_vcc((16384.0, ))
                self.gr_packed_to_unpacked_xx_0 =
gr.packed_to_unpacked_bb(2, gr.GR_MSB_FIRST)
                self.gr_unpacked_to_packed_xx_0 =
gr.unpacked_to_packed_bb(2, gr.GR_MSB_FIRST)

                self.dataSource = gr.vector_source_b(actual_data_copy,
False, 1)

                self.usrp_simple_sink_x = grc_usrp.simple_sink_c(which=0,
side="B")
                self.usrp_simple_sink_x.set_interp_rate(500)
                self.usrp_simple_sink_x.set_frequency(2430000000,
verbose=True)
                self.usrp_simple_sink_x.set_gain(0)
                self.usrp_simple_sink_x.set_enable(True)
                self.usrp_simple_source_x_0_0 =
grc_usrp.simple_source_c(which=0, side="B", rx_ant="RX2")
                self.usrp_simple_source_x_0_0.set_decim_rate(250)
                self.usrp_simple_source_x_0_0.set_frequency(2430000000,
verbose=True)
                self.usrp_simple_source_x_0_0.set_gain(0)
                self.vOut = gr.vector_sink_b(1)

                ##################################################
                # Connections
                ##################################################
                self.connect((self.gr_feedforward_agc_cc_0, 0),
(self.gr_costas_loop_cc_0, 0))
                self.connect((self.gr_multiply_const_vxx_0, 0),
(self.gr_feedforward_agc_cc_0, 0))
                self.connect((self.gr_diff_encoder_bb_0, 0),
(self.gr_chunks_to_symbols_xx_0, 0))
                self.connect((self.gr_map_bb_0, 0),
(self.gr_diff_encoder_bb_0, 0))
                self.connect((self.gr_packed_to_unpacked_xx_0, 0),
(self.gr_map_bb_0, 0))
                self.connect(self.dataSource,
self.gr_packed_to_unpacked_xx_0)
                self.connect((self.gr_costas_loop_cc_0, 0),
(self.gr_fir_filter_xxx_1, 0))
                self.connect((self.gr_interp_fir_filter_xxx_0, 0),
(self.gr_multiply_const_vxx_0_1, 0))
                self.connect((self.usrp_simple_source_x_0_0, 0),
(self.gr_multiply_const_vxx_0, 0))
                self.connect((self.gr_constellation_decoder_cb_0, 0),
(self.gr_map_bb_0_0, 0))
                self.connect((self.gr_diff_phasor_cc_0, 0),
(self.gr_constellation_decoder_cb_0, 0))
                self.connect((self.gr_clock_recovery_mm_xx_0, 0),
(self.gr_diff_phasor_cc_0, 0))
                self.connect((self.gr_multiply_const_vxx_0_1, 0),
(self.usrp_simple_sink_x, 0))
                self.connect((self.gr_chunks_to_symbols_xx_0, 0),
(self.gr_interp_fir_filter_xxx_0, 0))
                self.connect((self.gr_fir_filter_xxx_1, 0),
(self.gr_clock_recovery_mm_xx_0, 0))
                self.connect((self.gr_map_bb_0_0, 0),
(self.gr_unpacked_to_packed_xx_0, 0))
                self.connect((self.gr_unpacked_to_packed_xx_0, 0),
(self.vOut, 0))

                self.run()

                output = self.vOut.data()
                print output[0:5000]

        def set_arity(self, arity):
                self.arity = arity
                self.set_rotated_const(map(lambda pt: pt * 1,
psk.constellation[self.arity]))

        def set_samp_rate(self, samp_rate):
                self.samp_rate = samp_rate

        def set_rotated_const(self, rotated_const):
                self.rotated_const = rotated_const

        def set_rot(self, rot):
                self.rot = rot

if __name__ == '__main__':
        QPSKtest()
       
Regards,

Marcin

-- 
View this message in context: 
http://old.nabble.com/DQPSK-Modulation-Demodulation-issue-tp28288015p28288015.html
Sent from the GnuRadio mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]