Hi Marcus,

> Von: "Marcus D. Leech" <[email protected]>
> [...]
> You're using the MANUAL policy for BOTH DSP and RF. Let the automatic
> "stuff" do its thing, with the only difference being integer-N tuning.

Pretty incredible, I think I found the(?) issue.
https://kb.ettus.com/UBX#Phase_Synchronization:

"If you are operating the UBX at frequencies below 1 GHz and need phase 
synchronization, then it is necessary to select a 20 MHz daughterboard clock 
rate, instead of using the default 50 MHz rate [...] If you're using GNU Radio, 
then you can add "dboard_clock_rate=20e6" to the "Device Arguments" field of 
the properties for the UHD Sink and UHD Source blocks."


I did this and lo and behold, the phase stays constant across tunes!
It even works without mode_n=integer most of the time ... I think sometimes I 
get the frequency shift I was mentioning in a previous message.
With mode_n=integer it works for all frequencies I have tried. I really hope I 
did not miss anything.

Code:

self.uhd_usrp_source_0 = uhd.usrp_source(
    ",".join(("", "dboard_clock_rate=20e6")),
    uhd.stream_args(
        cpu_format="fc32",
        channels=range(2),
    ),
)
self.uhd_usrp_source_0.set_clock_rate(200e6, uhd.ALL_MBOARDS)
self.uhd_usrp_sink_0 = uhd.usrp_sink(
    ",".join(("", "dboard_clock_rate=20e6")),
    uhd.stream_args(
        cpu_format="fc32",
        channels=range(1),
    ),
)
self.uhd_usrp_sink_0.set_clock_rate(200e6, uhd.ALL_MBOARDS)
...

def set_fcenter(self, fcenter):
        self.fcenter = fcenter

        tune_req_tx = uhd.tune_request(target_freq=fcenter, lo_offset=1e6)
        tune_req_rx = uhd.tune_request(target_freq=2*fcenter, lo_offset=1e6)
        tune_req_rx.args=uhd.device_addr(','.join(["mode_n=integer", 
"int_n_step=1000e3",]))
        tune_req_tx.args=uhd.device_addr(','.join(["mode_n=integer", 
"int_n_step=1000e3",]))

        now = self.uhd_usrp_sink_0.get_time_now()
        self.uhd_usrp_sink_0.set_command_time(now + uhd.time_spec(1))
        self.uhd_usrp_source_0.set_command_time(now + uhd.time_spec(1))

        res1 = self.uhd_usrp_sink_0.set_center_freq(tune_req_tx, 0)
        res2 = self.uhd_usrp_source_0.set_center_freq(tune_req_rx, 0)
        res3 = self.uhd_usrp_source_0.set_center_freq(tune_req_rx, 1)

        self.uhd_usrp_source_0.clear_command_time()
        self.uhd_usrp_sink_0.clear_command_time()


Luke




_______________________________________________
USRP-users mailing list
[email protected]
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

Reply via email to