discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: Two more questions: Re: [Discuss-gnuradio] Two GMSK decoders with tw


From: Dawei Shen
Subject: Re: Two more questions: Re: [Discuss-gnuradio] Two GMSK decoders with two msg queues
Date: Tue, 17 Oct 2006 11:22:58 -0400

Hi, Eric

Thanks~ setting the msq_limit to 0 solved my problem.

But actually if you take a look my code, I am inserting the packets to the queue after calling fg.start()

    fg.start()
    while n < nbytes:
        send_pkt_A( struct.pack('!H', pktnoA) + 'A' + (pkt_sizeA - 3) * chr(pktnoA & 0xff))
        send_pkt_B(struct.pack('!H', pktnoB) + 'B' + (pkt_sizeB - 3) * chr(pktnoB & 0xff))
        n += pkt_size
        print "n now is %d" % n
        pktnoA += 1
        pktnoB += 1
So I suspect that's a multi-theading problem? One of the threads never returns, maybe.

BTW: I am pretty up to date, my GNU Radio is the newest version and I am keeping track of what's new in the GNU Radio community. The reason why I chose the old GMSK2 code is because the gmsk_test thing is quite neat and can be easily extended, so that I could prototype my project easily without having to worry about other modules.


Dawei



On 10/17/06, Eric Blossom <address@hidden> wrote:
On Tue, Oct 17, 2006 at 12:00:11AM -0400, Dawei Shen wrote:
> Sorry, my previous email is sent by mistake, let me restate my questions:
>
> Hey Eric, Michael and other friends:
>
> My code is working well now. But I met two new problems, which are not so
> crucial, but really important to me.
>
> 2. Another problem is more difficult to describe, the following is part of
> my main code:
>
> class my_graph(gr.flow_graph):
>
>    def __init__(self, rx_callbackA, rx_callbackB, spb, bt, SNR,
> freq_error):
>        gr.flow_graph.__init__(self)
>
>        fg = self
>
>        # Tuning Parameters
>        gain_mu = 0.002*spb
>        omega = spb*(1+freq_error)
>
>        # transmitter
>        self.packet_transmitterA = gmsk2_mod_pkts(fg, spb=spb, bt=bt)
>        self.packet_transmitterB = gmsk2_mod_pkts(fg, spb=spb, bt=bt)
>
>        adder = gr.add_cc ()
>        const = gr.multiply_const_cc (0.5)
>
>        fg.connect (self.packet_transmitterA , (adder, 0))
>        fg.connect (self.packet_transmitterB, const, (adder, 1))
>
>         self.packet_receiver = Separator_demod_pkts(fg,
> callbackA=rx_callbackA, callbackB=rx_callbackB,
>                                                  spb=spb, gain_mu=gain_mu,
>                                                  freq_error=freq_error,
> omega=omega)
>
>        fg.connect (adder, self.packet_receiver)
> Then in the main function, i do
>    while n < nbytes:
>        send_pkt_A(struct.pack('!H', pktnoA) + 'A' + (pkt_sizeA - 3) *
> chr(pktnoA & 0xff))
>        send_pkt_B(struct.pack('!H', pktnoB) + 'B' + (pkt_sizeB - 3) *
> chr(pktnoB & 0xff))
>        n += pkt_size
>        print "n now is %d" % n
>        pktnoA += 1
>        pktnoB += 1
>
> Here pkt_size is 1500, nbytes is 1M as default. I omit other parts of my
> code because they are not so important here. I print the value of n in the
> loop because I want to see when it stops. So the output is sth like this:
> I am stream A's callback function
> ok =  True  from 'A', pktno =   46  len(payload) = 1500  118/118
> n now is 108000
> I am stream B's callback function
> ok =  True  from 'B', pktno =  247  len(payload) = 1000  119/119
> n now is 109500
> I am stream B's callback function
> ok =  True  from 'B', pktno =  248  len(payload) = 1000  120/120
> I am stream A's callback function
> ok =  True  from 'A', pktno =   47  len(payload) = 1500  121/121
> I am stream B's callback function
> ok =  True  from 'B', pktno =  249  len(payload) = 1000  122/122
> I am stream A's callback function
> ok =  True  from 'A', pktno =   48  len(payload) = 1500  123/123
>
>
> Then it stops!!! Nothing happens after that. It appears to me that the
> process goes somewhere and never comes back. The current value of n is still
> far from nbytes, but it just stops there. One possible solution I found out
> was that I could change the "msgq_limit" parameter of the gr_message_source
> in gmsk2_pkt. If I increase "msgq_limit", the program could go further and
> further, with larger n and processed packets, but still stops some timeand
> never continues.
>
> So could anyone help me address these two things? Thank you very much in
> advance!
>
> Dawei

I suspect you've got some kind of deadlock.  Without seeing all the
code, it's hard to know what's going on.  Are you trying to jam the
1MB worth of packets into the queue before fg.start() or fg.run() is
called?  If so, it's no wonder that it dead locks ;) Neither the
receiver nor the transmitter are running yet and send_pkt_* is just
queueing the packets to be modulated.  If you set msgq_limit to 0,
there will be no limit enforced and all the packets to be modulated
will be enqueued (this of course allocates memory to hold everything).

Eric


reply via email to

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