Problems using dbpsk modulation

Hello,

I’ve been trying to create a program to estimate the Bit Error Rate of
some
modulations, but found some bugs on it.
After trying to exactly where the bug was, I could set it apart from the
rest of the code, here is a simple program where the bugs appear:

CODE

from gnuradio import gr, blks2
import time

class graph(gr.top_block):
def init(self):
gr.top_block.init(self)

    self.src = gr.glfsr_source_b(20, True, 0, 42) #bit generator
    self.mod = blks2.dbpsk_mod(5)
    self.demod = blks2.dbpsk_demod(5)
    self.xor = gr.xor_bb()
    self.probe = gr.probe_density_b(0.01) #1's density in xored 

input
and output is ber

    self.connect(self.src,self.mod,self.demod,(self.xor,0))
    self.connect(self.src,(self.xor,1))
    self.connect(self.xor,self.probe)


def ber(self):
    return self.probe.density()

if name == ‘main’:
try:
tb = graph()
tb.start()
while True:
print tb.ber()
time.sleep(0.2)

    tb.wait()

except KeyboardInterrupt:
    pass

END OF CODE

The three problems I’ve got are:

1- The demodulator outputs more bits than it was sent, if we put a
gr.head(100) in the source, the demod generates more than 100 bits.
2- src bit sequence and the demodulated bit sequence are very different,
even after the lock of the demod. That’s strange because there’s no
noise in
this channel.
3- Some seconds after the execution of the code, the probe density stops
changing, like if the program was not running anymore.

Thanks for helping,
Dinart

1- The demodulator outputs more bits than it was sent, if we put a
gr.head(100) in the source, the demod generates more than 100 bits.
2- src bit sequence and the demodulated bit sequence are very different,
even after the lock of the demod. That’s strange because there’s no noise in
this channel.

Thanks for helping,
Dinart

Are you sending the modulator packed bits or unpacked bits? I believe
the
modulator takes packed bits, so if you’re sending unpacked 1’s and 0’s,
you’ll be getting a bunch of extra 0’s.
Also, keep in mind that the bits go through a root-raised cosine filter,
so
you’ll get extra bits at the start and end of your data (I think).

Jordan