discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Here's how to get the N321's LO sharing to work in GNURadio 3.9 with UHD


From: Paul Atreides
Subject: Here's how to get the N321's LO sharing to work in GNURadio 3.9 with UHD4.1.0.5
Date: Fri, 28 Jan 2022 17:55:12 -0500

Currently there's no way to use LO sharing with the N321 in gr-uhd.
The N321 uses an RF Distribution board which has port terminations that need to be switched to active outputs when the LO is exported. This isn't accessible in gr-uhd.

In order to access the LO distribution enable commands shown here:
https://kb.ettus.com/USRP_N320/N321_LO_Distribution#UHD_LO_Distribution_Commands
a function needs to be added to gr-uhd
All this code below is taken from here:
https://github.com/daniestevez/uhd/commit/0a6da1a3fd5839b862cac740ed702923ed21b096
https://github.com/daniestevez/gnuradio/commit/f9909bade86045f379f83001de27317cc261807f
with the rx switched for tx and source switched for sink
i also did not modify any UHD code making this a fix that requires ONLY modifying gr-uhd

usrp_sink_impl.cc
void usrp_sink_impl::set_tx_lo_dist(bool enabled,
const std::string& name,
size_t chan)

{
#ifdef UHD_USRP_MULTI_USRP_TX_LO_CONFIG_API
_dev->get_tree()->access<bool>("/blocks/0/Radio#0/dboard/tx_frontends/0/los/lo1/lo_distribution"/ ::uhd::fs_path(name) / "export").set(enabled);

#else
throw std::runtime_error("not implemented in this version");
#endif
}
usrp_sink_impl.h
void set_tx_lo_dist(bool enabled,
const std::string &name, size_t chan = 0) override;
usrp_sink.h
virtual void set_tx_lo_dist(bool enabled, const std::string &name, size_t chan =0) = 0;

usrp_sink_python.cc
.def("set_tx_lo_dist",
&usrp_sink::set_tx_lo_dist,
py::arg("enabled"),
py::arg("name"),
py::arg("chan") = 0,
D(usrp_sink, set_tx_lo_dist))
usrp_sink_pydoc_template.h
static const char* __doc_gr_uhd_usrp_sink_set_tx_lo_dist = R"doc()doc";



Assuming the sink block is "usrp_sink_0"

snippet_0 code
'Main-After Init'
# Turn on the ports
self.usrp_sink_0.set_tx_lo_dist(True,"LO_OUT_0",0)
# repeat the above for all ports needed "LO_OUT_<N>"

snippet_1
'Main-After Stop'
# Turn off the ports
self.usrp_sink_0.set_tx_lo_dist(False,"LO_OUT_0",0)
# repeat for all ports you enabled "LO_OUT_<N>"

The other settings i found were needed in the gr-uhd block included:
Setting the start time to 1
Setting the Master Clock rate to 200MHz
CH0:
  LO Source = external
  LO Export = True
CH1:
  LO Source = external
  LO Export = False


I'd like to thank the community of users for doing all of this work, especially Marcus Leech, Rob Kossler and Daniel Estevez




reply via email to

[Prev in Thread] Current Thread [Next in Thread]