Detect PPS every second for synchronization

Dear all,

I ma using USRP N200 with LFTX & LFRX +UHD to build up a transmitter and
receiver. The transmitter and receiver are working well if continuously
running without changing the USRP configuration. I am trying to use a
GPS as the synchronization signal for signal reception, which is
detecting the GPS pulse every second and using this pulse to trigger the
signal reception.

I am using the ‘set_clock_config’ to set the PPS clock while the flow
graph for receiver is built. The negative edge of the GPS pulse could be
detected when the flow graph for receiver start running. I am wondering
how to continuously detect the GPS pulse every second and use it as PPS
signal to trigger the signal reception, so that the receiver could be
able to synchronized with other device using GPS pulse. I tried to
create a separate thread after the receiver flow graph start running:
(but this approach gives the USRP2 overrun result)

def pps_setting(tb)
while (1):

#pps clock configuration
tb.clk_cfg = uhd.clock_config_t()
tb.clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA
tb.clk_cfg.pps_polarity = uhd.clock_config.PPS_NEG
tb._u2source.set_clock_config(tb.clk_cfg, uhd.ALL_MBOARDS)

tb.set_freq(tb.freq_rx, tb.lo_offset)

  1. I am wondering what is the problem? or how to detect the GPS pulse
    every second and use it to trigger the signal reception every second for
    0.5 second signal receiving duration.

  2. The same question for RF frequency changing. if I would like to
    change the RF frequency every second, what could be the best approach?

Thank you so much!