Closed dwd-pete closed 6 years ago
That should be a fallback value, are you providing gain steps for getGainRange() and similar method overloads?
getGainRange()
is overloaded for the TX channels to return SoapySDR::Range(-41.95, 0.0, 0.05)
.
When I run SoapySDRUtil --probe
, I get:
Digital gain range: [-41.95, 0, 0.05] dB
However, when I run uhd_usrp_probe
, I get:
Gain range Digital: -42.0 to 0.0 step 0.1 dB
After looking through some more code, this is NOT a problem with SoapyUHD. This is how UHD formats the gains when it prints them in uhd_usrp_probe
.
Here is the offending code (source: https://github.com/EttusResearch/uhd/blob/master/host/utils/uhd_usrp_probe.cpp):
static std::string get_frontend_pp_string(const std::string &type, property_tree::sptr tree, const fs_path &path){
// snip...
std::vector<std::string> gain_names = tree->list(path / "gains");
if (gain_names.size() == 0) ss << "Gain Elements: None" << std::endl;
for(const std::string &name: gain_names){
meta_range_t gain_range = tree->access<meta_range_t>(path / "gains" / name / "range").get();
ss << boost::format("Gain range %s: %.1f to %.1f step %.1f dB") % name % gain_range.start() % gain_range.stop() % gain_range.step() << std::endl;
}
// snip...
return ss.str();
}
The
MIN_GAIN_STEP
defined in UHDSoapyDevice.cpp is set to 0.1, which causes rounding errors when reporting the gain range and step size for my particular device. My device is based on the AD9371, which has an attenuation (defined as negative gain) that runs from -41.95 dB to 0.0 dB in 0.05 dB increments.I would set it to 0.05 myself, but I am afraid of unforeseen issues and breaking things in other modules.