|
From: | Skyvalakis Konstantinos |
Subject: | USRP N200 |
Date: | Mon, 31 May 2021 10:23:43 +0000 |
Hi,
I have 2 USRP N200 devices equipped with an SBX daughterboard each.
I want to build a 1 Tx, 2 Rx system, where everything is synchronized.
I have an external generator to provide 10MHz ref clock and PPS input for both USRP devices with equal length cables.
The 1st USRP, with the SBX daughterboard, is both Tx and Rx.
The 2nd
USRP, with
the SBX daughterboard, is just Rx.
Phase synchronization is crucial to my application and thus I really need to know if I am doing it right or not.
Therefore, I am attaching the following code in Python, that I use to synchronize the devices and I would like to know if it's correct or not.
def usrp_init(self):
self.source = [None, None]
self.source[0] = uhd.usrp_source(
device_addr=self.usrp_address_source[0],
stream_args=uhd.stream_args(
cpu_format="fc32",
channels=range(1),
),
)
self.source[1] = uhd.usrp_source(
device_addr=self.usrp_address_source[1],
stream_args=uhd.stream_args(
cpu_format="fc32",
channels=range(1),
),
)
self.sink = uhd.usrp_sink(
device_addr=self.usrp_address_sink,
stream_args=uhd.stream_args(
cpu_format="fc32",
channels=range(1),
),
)
self.source[0].set_clock_source('external', 0);
self.source[0].set_time_source('external', 0);
self.source[0].set_time_unknown_pps(uhd.time_spec())
self.source[0].set_samp_rate(self.adc_rate)
self.source[0].set_gain(self.rx_gain0, 0)
self.source[0].set_antenna("RX2", 0)
self.source[1].set_clock_source('external', 0)
self.source[1].set_time_source('external', 0)
self.source[1].set_time_unknown_pps(uhd.time_spec())
self.source[1].set_samp_rate(self.adc_rate)
self.source[1].set_gain(self.rx_gain1, 0)
self.source[1].set_antenna("RX2", 0)
self.sink.set_clock_source('external', 0);
self.sink.set_time_source('external', 0);
self.sink.set_time_unknown_pps(uhd.time_spec())
self.sink.set_samp_rate(self.dac_rate)
self.sink.set_gain(self.tx_gain, 0)
self.sink.set_antenna("TX/RX", 0)
time.sleep(1)
cmd_time0 = self.source[0].get_time_last_pps()
cmd_time1 = self.source[1].get_time_last_pps()
cmd_time2 = self.sink.get_time_last_pps()
real_seconds0 = uhd.time_spec_t.get_real_secs(cmd_time0)
real_seconds1 = uhd.time_spec_t.get_real_secs(cmd_time1)
real_seconds2 = uhd.time_spec_t.get_real_secs(cmd_time2)
future_real_seconds0 = real_seconds0 + 1
future_real_seconds1 = real_seconds1 + 1
future_real_seconds2 = real_seconds2 + 1
future_cmd_time0 = uhd.time_spec_t(future_real_seconds0)
future_cmd_time1 = uhd.time_spec_t(future_real_seconds1)
future_cmd_time2 = uhd.time_spec_t(future_real_seconds2)
self.source[0].set_command_time(future_cmd_time0)
self.source[1].set_command_time(future_cmd_time1)
self.sink.set_command_time(future_cmd_time2)
self.source[0].set_center_freq(uhd.tune_request(self.freq,0), 0)
self.source[1].set_center_freq(uhd.tune_request(self.freq,0), 0)
self.sink.set_center_freq(uhd.tune_request(self.freq,0), 0)
self.source[0].clear_command_time()
self.source[1].clear_command_time()
self.sink.clear_command_time()
Thanks in advance.
Konstantinos
|
[Prev in Thread] | Current Thread | [Next in Thread] |