Thanks Wade and Marcus – I appreciate the insights and will make some tweaks on 
my end as a workaround.

Best,
David

From: Wade Fife <wade.f...@ettus.com>
Sent: Wednesday, April 27, 2022 1:21 PM
To: Marcus D. Leech <patchvonbr...@gmail.com>
Cc: usrp-users@lists.ettus.com
Subject: [USRP-users] Re: Programmatic determine rfnoc_chdr_clk from UHD?

Hi David,

I'm not super familiar with the software, but get_tick_rate() returning 0 might 
be because something's not implemented in the block controller software. You 
could look at some other blocks to see how that's handled (maybe the DDC/DUC). 
But I would expect get_tick_rate() to return the sample rate, which isn't the 
same as the rfnoc_chdr_clk rate.

The way we typically track time in an RFNoC block is by counting samples. Each 
sample corresponds to one master clock tick (or a ratio of that if there's a 
DDC/DUC). We aren't usually very concerned with the absolute time, we usually 
care about the time to which a sample corresponds, which you can get from the 
timestamp in the packet and the sample count.

If you need the absolute time, you can connect the radio time to your block. 
Just keep in mind that crossing the radio time to the rfnoc_chdr_clk requires a 
clock crossing, with special logic to handle that and a bit of added delay. The 
rfnoc_chdr_clk can drift relative to the master clock over time, so we don't 
usually use it for tracking time.

There is a BUS_CLK_RATE register on the FPGA that has this information, but I 
don't see it exposed anywhere in the API. So, as it is now, it might be easier 
to just do a lookup based on the type of USRP. I don't know if there's an easy 
way to get to that register.

Wade

On Wed, Apr 27, 2022 at 9:57 AM Marcus D. Leech 
<patchvonbr...@gmail.com<mailto:patchvonbr...@gmail.com>> wrote:
On 2022-04-27 09:53, David Raeman wrote:
Hi all,

Is it possible to programmatically determine the "rfnoc_chdr_clk" rate from a 
UHD application? More specifically, I have a custom RFNoC block clocked from 
rfnoc_chdr_clk, and I’d like to programmatically determine its clock rate from 
the associated custom software driver so I can convert tick rate to physical 
units of time. I know it varies by radio model [1], and I’d like the driver 
code to be portable across a few models.

I’ve poked around quite a bit in the docs and code, and I haven’t found an 
obvious solution in UHD 4. I guess I could dump it into a register within my 
RFNoC block, but I wanted to make sure I’m not missing something in the 
existing framework. Calling get_tick_rate() on the block control object just 
returns 0.

Thanks!
David

[1] 
https://kb.ettus.com/RFNoC_Frequently_Asked_Questions#What_are_the_clock_frequencies.3F



_______________________________________________

USRP-users mailing list -- 
usrp-users@lists.ettus.com<mailto:usrp-users@lists.ettus.com>

To unsubscribe send an email to 
usrp-users-le...@lists.ettus.com<mailto:usrp-users-le...@lists.ettus.com>
Hmmm.  The docs do suggest that "get_tick_rate()" on the *block* object should 
work, since it exists in the block base class.  I'm not an RFNOC programmer, so 
just
  guessing...

_______________________________________________
USRP-users mailing list -- 
usrp-users@lists.ettus.com<mailto:usrp-users@lists.ettus.com>
To unsubscribe send an email to 
usrp-users-le...@lists.ettus.com<mailto:usrp-users-le...@lists.ettus.com>
_______________________________________________
USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-le...@lists.ettus.com

Reply via email to