EttusResearch / uhd

The USRP™ Hardware Driver Repository
http://uhd.ettus.com
Other
946 stars 646 forks source link

Step values for bandwidth and master clock ranges when querying a B series board are zero. #656

Closed AlexandreRouma closed 1 year ago

AlexandreRouma commented 1 year ago

Issue Description

The step values for bandwidth and master clock ranges when querying a B series board are zero. This happens both with uhd_usrp_probe and by calling UHD from C++, indicating that this is not a bug on the application side.

Setup Details

Expected Behavior

The step value describes the actual allowed steps for the parameter.

Actual Behaviour

Steps to reproduce the problem

Additional Information

mbr0wn commented 1 year ago

Hi @AlexandreRouma, thanks for this report! In fact, we almost never provide step sizes for our frequencies in UHD. For frequencies and clock rates, we usually use a coercion paradigm, where the setters won't throw, but will return the coerced value (or you need to call a getter).

The frequency accuracy on B2xx devices is much better than 100 kHz, usually, it's in the sub-Hz range. Let's say we had exactly 1 Hz accuracy, then for B2xx, you'd have to store a list of approx. 6 billion floats (70000000 Hz, 70000001 Hz, 70000002 Hz, all the way up to 6000000000 Hz). Even for the master clock rates, you'd be storing around 60 million values.

This is pretty inefficient, which is why you need a more efficient data structure. In UHD that is, you've guessed it, it's the uhd::freq_range_t, which stores (for contiguous ranges) start/stop/step, and for non-contiguous ranges multiple start and stop values (potentially with different step values for different sections).

Another reason we don't provide a step size here is b/c the steps to program BBPLL and all the various dividers is not straightforward and it's more complicated than stating a fixed step size over a bunch of ranges. It's not impossible to figure out the precise available rates, but given our coerce-and-query paradigm, it's of limited value. And again, it might have negative value if it would mean dragging around a massive data structure.