Using PPS signal to trigger the received data storage in Pyton

Dear all,

I am using USRP N200 with LFRX +UHD to design a receiver, which works
fine to continuously receive data. I need to use PPS signal to trigger
the received data storing only for 1ms every second after detecting the
edge of PPS signal every second.

I tried the approach introduced in the gnuradio example,
rx_timed_samples, detecting the PPS signal, then setup streaming, then
fill out rx-meta-data by recv(). Eventually, I got to know the
stream_cmd and recv are not swigged, which means I could use this method
in Python.

From previous email reply, the USRP source already tags the samples with
a timestamp, I do not need to control when streaming begins, because the
downstream block can determine the time of any samples using metadata.

  1. I am wondering how can I fill out meta-data by the received data if
    recv() cannot be used in Python,as I wish to set the time of samples as
    the time when PPS signal is detected every second and use the
    total_num_samps to control the number of data USRP received every second
    after triggering be PPS signal.

I am using the following method to detect PPS signal:

self.clk_cfg = uhd.clock_config()
self.clk_cfg.pps_source = uhd.clock_config.PPS_SMA
self.clk_cfg.pps_polarity = uhd.clock_config.PPS_NEG
self._usrp2.set_clock_config(self.clk_cfg, uhd.ALL_MBOARDS)
self._usrp2.set_time_unknown_pps(uhd.time_spec(0.0))

  1. The PPS setting is done right after the USRP device is created, hence
    the PPS signal could be detected when USRP device is setup. I am also
    wondering this PPS setting could let the USRP detect PPS signal every
    second, or only once when this setting is called?

Any suggestion or idea will be really appreciated!

Thanks,
Yan

I am really sorry for the last uncompleted email, as I got some problems
with our server here. Sorry.

On 11/23/2011 01:52 PM, Yan N. wrote:

stream_cmd and recv are not swigged, which means I could use this
method in Python.

You may be interested, on my uhd_work branch, I added a set_start_time
call: http://gnuradio.org/cgit/jblum.git/log/?h=uhd_work

You can use this call to control when streaming will begin. So you
should use PPS to synchronize the usrp time registers, then set the
start time to be one second later, then start the flow graph.

-Josh