[USRP-users] R: Sampling Rate vs Master Clock Rate

Marcus Müller marcus.mueller at ettus.com
Sat Jul 25 06:19:06 EDT 2015


Hi Maurizio,

I've never asked myself that, because the sampling rate is just as 
important as let's say frequency of the signal you want to observe, so I 
can't think of a case where you wouldn't set a sampling rate prior to 
getting the RX stream or TX stream.

Hence, I think that question is more of a "theoretical nature", 
especially since modern versions of UHD do make it easy for you: If you 
set a sampling rate that's not possible with the current clock rate, and 
you're using a master-clock-rate-flexible device (currently, only E310, 
B2x0), then UHD will adjust the master clock rate so it's the highest 
possible multiple of your sampling rate, unless you ask it to *not* do that.

However, if this is really relevant for you: after everything has been 
set up, the sampling rates for RX and TX are set to 250kS/s [1a] [1b], 
by default, on the B2x0, and to 1MS/s [2a][2b]on the E310, if I'm not 
mistaken.

Note that I really think you should explicitely set the rate you want. 
Though we really try to take the best care we can not to break existing 
applications when improving UHD, I don't think anyone working on the 
code would expect things to break upon changing the default sampling 
rates, just because there's simply no reason not to expect users to 
specify which sampling rate they want. It'll be easier to understand 
your code if it explicitely states which sampling rate you want, and 
also, it has nearly no overhead at all to set the sampling rate to the 
same value it had before.

Best regards,
Marcus


[1a] 
https://github.com/EttusResearch/uhd/blob/master/host/lib/usrp/b200/b200_impl.cpp#L601
[1b] 
https://github.com/EttusResearch/uhd/blob/master/host/lib/usrp/b200/b200_impl.hpp#L54

[2a] 
https://github.com/EttusResearch/uhd/blob/master/host/lib/usrp/e300/e300_impl.cpp#L1003
[2b] 
https://github.com/EttusResearch/uhd/blame/master/host/lib/usrp/e300/e300_defaults.hpp
On 25.07.2015 11:52, Crozzoli Maurizio via USRP-users wrote:
>
> Thank you Ian for your explanation!
>
> One more question: according to the manual the master clock rate has a 
> default value which is used if it is not explicitly set, but what does 
> it happen if only the master clock rate is set but no value is 
> assigned to the RX sampling rate? Is it automatically set equal to the 
> master clock rate?
>
> Once again, TIA!
>
> Maurizio.
>
> *Da:*Ian Buckley [mailto:ianb at ionconcepts.com]
> *Inviato:* giovedì 23 luglio 2015 19:07
> *A:* Crozzoli Maurizio
> *Cc:* USRP-users at lists.ettus.com; Disco Daniele
> *Oggetto:* Re: [USRP-users] Sampling Rate vs Master Clock Rate
>
> Maurizio
>
> The "sampling rate" is the rate at which samples are passed between 
> the host commuter and the USRP (over USB for B210, and via and 
> internal FPGA interface for E310).
>
> The "master_clock_rate" is the rate at which samples are passed 
> between FPGA and the RF front end (In the case of B210 and E310 that 
> RF fronted is an RFIC that contains analog RF circuits, converters and 
> DSP).
>
> The reason that they can be different is that the FPGA contains 
> substantial digital filtering thats allows integer ratio 
> decimation/interpolation and digital tuning.
>
> Historically older USRP's had a fixed master_clock_rate (It was simply 
> the clock that drove the DAC's and ADC's) and so most user API 
> interaction was via programming the "sample rate", newer USRP's have 
> the additional flexibility of configurable "master clock rates" also.
>
> In the case of your example, yes, a suitable configuration for working 
> with LTE signals would be to program both sample_rate and 
> master_clock_rate to 30.72MHz.
>
> -Ian
>
> On Jul 23, 2015, at 8:13 AM, Crozzoli Maurizio via USRP-users 
> <usrp-users at lists.ettus.com <mailto:usrp-users at lists.ettus.com>> wrote:
>
>
>
> The question is: could anyone explain the relationship between the two 
> ratesd in the subject?
>
> To be more specific, working with LTE signal in the RX side I might 
> need to set e.g. a sampling rate of 30.72 Msps. For doing that, I 
> would think to use the set_rx_rate command. But then I happen to read 
> in the archives of our mailing list (on February 2015, “Question on 
> set_rx_bandwidth”) a comment by Marcus Leech who says that “Whatever 
> sample-rate you pick *MUST* be an integer fraction of the master-clock 
> rate, which by default if you don't set it, is 32MHz.  There is no 
> fractional resampling done in the hardware.”.
>
> So I would say that, according to what is needed in my example given 
> above, I’d set also the master clock rate of the board before setting 
> the rx (sampling) rate:
>
> set_master_clock_rate = 30.72e6
>
> set_rx_rate = 30.72e6
>
> Is it correct?
>
> Any further comments on the subject I’d better be informed of (e.g. 
> about setting also the RX bandwidth)?
>
> Please, if you can answer my question, specifically refer to B210 and 
> E310 boards if needed, which the ones we have.
>
> TIA!
>
> BR,
>
> Maurizio Crozzoli.
>
> Questo messaggio e i suoi allegati sono indirizzati esclusivamente 
> alle persone indicate. La diffusione, copia o qualsiasi altra azione 
> derivante dalla conoscenza di queste informazioni sono rigorosamente 
> vietate. Qualora abbiate ricevuto questo documento per errore siete 
> cortesemente pregati di darne immediata comunicazione al mittente e di 
> provvedere alla sua distruzione, Grazie.
>
> /This e-mail and any attachments //is// confidential and may contain 
> privileged information intended for the addressee(s) only. 
> Dissemination, copying, printing or use by anybody else is 
> unauthorised. If you are not the intended recipient, please delete 
> this message and any attachments and advise the sender by return 
> e-mail, Thanks./
>
> *<logo Ambiente_foglia2.jpg>Rispetta l'ambiente. Non stampare questa 
> mail se non è necessario.*
>
> <logo Ambiente_foglia2.jpg>_______________________________________________
> USRP-users mailing list
> USRP-users at lists.ettus.com <mailto:USRP-users at lists.ettus.com>
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>
>
>
> _______________________________________________
> USRP-users mailing list
> USRP-users at lists.ettus.com
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20150725/48ef3d1a/attachment-0002.html>


More information about the USRP-users mailing list