discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] underrun occurs when frequency changing


From: Yan Nie
Subject: [Discuss-gnuradio] underrun occurs when frequency changing
Date: Fri, 09 Dec 2011 15:42:36 -0500

Dear all,

I am trying to transmit a sequence at various frequencies on USRP N200 with 
LFTX. 

When I use the uhd.single_usrp_source.set_center_freq() to change the frequency 
then insert the the sequence as a message in the msgq buffer in another thread 
other than top_block, underrun occurs. The amplitude of the transmitting signal 
on oscilloscope varies some, some of the signal have the full amplitude that I 
set, some of them only reach half amplitude. The following is the thread that I 
open for the sequence transmitting. 

The mgq are created by: 
data=gr.message_source(gr.sizeof_char, msg_limit)  #where msg_limit is defined 
as 2; 
msgq = data.msgq()  

transmit_loop(tb)

    repeat = 40
    payload_13barker = repeat * '\x01'
    payload_13barker += repeat * '\x01'
    payload_13barker += repeat * '\x01'
    payload_13barker += repeat * '\x00'
    payload_13barker += repeat * '\x00'

    stop_sign = 5*repeat*'\x02'
    i = 0
    while(i<5):
          payload_13barker += stop_sign
      i += 1
    
    msg_13bit = gr.message_from_string(payload_13barker)
    tb._ls.msgq.insert_tail(msg_13bit)
    time.sleep(1.0)
    print "info inserted"
    while 1:
          freq_cnt = 4
          while (freq_cnt < 7):
                    i += 1
                    if i==40:     #this counter is used to slow down the rate 
the transmission frequency changes
                        i = 0
                        tx_freq = freq_cnt * 10e6
                        tb.set_freq_tx(tx_freq,0.0)
                        tb._ls.msgq.insert_tail(msg_13bit)
                        time.sleep(1.0)            # suspend to wait for the 
payload insert into buffer
                        freq_cnt += 1 

I am curious 
1. what causes the underrun and how to avoid the underrun?
2. How to defined the msgq_limit? Is the underrun cause by the wrongly set of 
the msgq_limit, as I already set to let the program to wait for buffering?

Really appreciate any of your suggestion!

Thanks,
Yan



reply via email to

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