Hello: I have a USRP2 + WBX running with GNU Radio 3.3.0 on openSUSE 11.2.
I created a simple flowgraph using GRC, a Signal Source connected into a USRP2 Sink, used to generate a tone. I'm trying to setup a timer in the flowgraph so that every 2 seconds, the tone flip-flops between 3 kHz and 6 kHz. When I run it, I get a tone at 1 kHz that never changes (the default tone freq from the parameter list). It seems that my signal handler is never getting called. I copied my code below. Could anyone tell me why is my signal handler never getting called? What am I doing wrong here? Thanks for your help. #!/usr/bin/env python ################################################## # Gnuradio Python Flow Graph # Title: Tst Generate Tone # Generated: Mon Dec 6 01:19:50 2010 ################################################## from gnuradio import eng_notation from gnuradio import gr from gnuradio import usrp2 from gnuradio.eng_option import eng_option from gnuradio.gr import firdes from grc_gnuradio import wxgui as grc_wxgui from optparse import OptionParser import wx import signal import time import datetime timer_tick_cnt = 0 timer_interval = 2.0 class tst_generate_tone(grc_wxgui.top_block_gui): def __init__(self, p_eth="eth1", p_freq_carrier=900.0e6, p_freq_tone=1.0e3, p_interp=500): grc_wxgui.top_block_gui.__init__(self, title="Tst Generate Tone") ################################################## # Parameters ################################################## self.p_eth = p_eth self.p_freq_carrier = p_freq_carrier self.p_freq_tone = p_freq_tone self.p_interp = p_interp ################################################## # Variables ################################################## self.samp_rate = samp_rate = 100000000/p_interp ################################################## # Blocks ################################################## self.gr_sig_source_x_0 = gr.sig_source_c(samp_rate, gr.GR_COS_WAVE, p_freq_tone, 0.4, 0) self.usrp2_sink_xxxx_0 = usrp2.sink_32fc(p_eth) self.usrp2_sink_xxxx_0.set_interp(p_interp) self.usrp2_sink_xxxx_0.set_center_freq(p_freq_carrier) self.usrp2_sink_xxxx_0.set_gain(0) self.usrp2_sink_xxxx_0.config_mimo(usrp2.MC_WE_LOCK_TO_SMA) ################################################## # Connections ################################################## self.connect((self.gr_sig_source_x_0, 0), (self.usrp2_sink_xxxx_0, 0)) def set_p_eth(self, p_eth): self.p_eth = p_eth def set_p_freq_carrier(self, p_freq_carrier): self.p_freq_carrier = p_freq_carrier self.usrp2_sink_xxxx_0.set_center_freq(self.p_freq_carrier) def set_p_freq_tone(self, p_freq_tone): self.p_freq_tone = p_freq_tone self.gr_sig_source_x_0.set_frequency(self.p_freq_tone) def set_p_interp(self, p_interp): self.p_interp = p_interp self.set_samp_rate(100000000/self.p_interp) self.usrp2_sink_xxxx_0.set_interp(self.p_interp) def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.gr_sig_source_x_0.set_sampling_freq(self.samp_rate) def alarm_handler(signo, frame): global timer_tick_cnt print "timer tick count is ", timer_tick_cnt timer_tick_cnt = timer_tick_cnt + 1 new_freq = ((timer_tick_cnt % 2) + 1) * 3000.0 tst_generate_tone.gr_sig_source_x_0.set_ffrequency(new_freq) if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") parser.add_option("", "--p-eth", dest="p_eth", type="string", default="eth1", help="Set p_eth [default=%default]") parser.add_option("", "--p-freq-carrier", dest="p_freq_carrier", type="eng_float", default=eng_notation.num_to_str(900.0e6), help="Set p_freq_carrier [default=%default]") parser.add_option("", "--p-freq-tone", dest="p_freq_tone", type="eng_float", default=eng_notation.num_to_str(1.0e3), help="Set p_freq_tone [default=%default]") parser.add_option("", "--p-interp", dest="p_interp", type="intx", default=500, help="Set p_interp [default=%default]") (options, args) = parser.parse_args() if gr.enable_realtime_scheduling() != gr.RT_OK: print "Error: failed to enable realtime scheduling." signal.signal(signal.SIGALRM, alarm_handler) signal.setitimer(signal.ITIMER_REAL, timer_interval, timer_interval) tb = tst_generate_tone(p_eth=options.p_eth, p_freq_carrier=options.p_freq_carrier, p_freq_tone=options.p_freq_tone, p_interp=options.p_interp) tb.Run(True) _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio