usrp-users@lists.ettus.com

Discussion and technical support related to USRP, UHD, RFNoC

View all threads

Power calibration USRP B210 UHD Python API

DJ
dennis.joosens@uantwerpen.be
Wed, Jul 23, 2025 5:43 PM

Hi,

I am working on power calibration of the USRP B210 SDR specifically on the RX side.

The power calibration worked, I managed to generate four .cal files:

b2xx_pwr_rx_tx+rx_316E278#A.cal

b2xx_pwr_rx_tx+rx_316E278#B.cal

b2xx_pwr_rx_rx2_316E278#A.cal

b2xx_pwr_rx_rx2_316E278#B.cal

and I can find them in the default directory ~/.local/share/uhd/cal

Now I am trying to load these .cal files using the UHD Python API. I can check if these files exist and read their contents.

But I am wondering, can I assume that the UHD loads the .cal files when a USRP stream is opened by default from this default folder? I can not seem to find any function or output from API functions that can give me a definite answer on that or even gives the possibility to check this.

If this is not the case. How is this handled by default? This seems a big mystery in the documentation.

Thanks,

Dennis

Hi, I am working on power calibration of the USRP B210 SDR specifically on the RX side. The power calibration worked, I managed to generate four .cal files: b2xx_pwr_rx_tx+rx_316E278#A.cal b2xx_pwr_rx_tx+rx_316E278#B.cal b2xx_pwr_rx_rx2_316E278#A.cal b2xx_pwr_rx_rx2_316E278#B.cal and I can find them in the default directory \~/.local/share/uhd/cal Now I am trying to load these .cal files using the UHD Python API. I can check if these files exist and read their contents. But I am wondering, can I assume that the UHD loads the .cal files when a USRP stream is opened by default from this default folder? I can not seem to find any function or output from API functions that can give me a definite answer on that or even gives the possibility to check this. If this is not the case. How is this handled by default? This seems a big mystery in the documentation. Thanks, Dennis
MB
Martin Braun
Thu, Jul 24, 2025 9:57 AM

Hey Dennis,

we recently had an issue here (by another Belgian USRP user, nonetheless!)
where the files were not being loaded, and it was due to the environment
variable XDG_DATA_HOME being set.

To check, there's two things you can do:

  • Call uhd.get_cal_data_path(). If it matches the path you expect, then UHD
    will look for cal files in here.
  • Call has_tx_power_reference() on your multi_usrp object. It will return
    true if cal data was loaded.

If you like, you can go low-level and query
uhd.usrp.cal.database.read_cal_data() and see if it loads the right data...
but that's pretty advanced, and I'll let you read the manual for that if
you want to do that.

--M

On Wed, Jul 23, 2025 at 7:43 PM dennis.joosens@uantwerpen.be wrote:

Hi,

I am working on power calibration of the USRP B210 SDR specifically on the
RX side.

The power calibration worked, I managed to generate four .cal files:

b2xx_pwr_rx_tx+rx_316E278#A.cal

b2xx_pwr_rx_tx+rx_316E278#B.cal

b2xx_pwr_rx_rx2_316E278#A.cal

b2xx_pwr_rx_rx2_316E278#B.cal

and I can find them in the default directory ~/.local/share/uhd/cal

Now I am trying to load these .cal files using the UHD Python API. I can
check if these files exist and read their contents.

But I am wondering, can I assume that the UHD loads the .cal files when a
USRP stream is opened by default from this default folder? I can not seem
to find any function or output from API functions that can give me a
definite answer on that or even gives the possibility to check this.

If this is not the case. How is this handled by default? This seems a big
mystery in the documentation.

Thanks,

Dennis


USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.com

Hey Dennis, we recently had an issue here (by another Belgian USRP user, nonetheless!) where the files were not being loaded, and it was due to the environment variable XDG_DATA_HOME being set. To check, there's two things you can do: - Call uhd.get_cal_data_path(). If it matches the path you expect, then UHD will look for cal files in here. - Call has_tx_power_reference() on your multi_usrp object. It will return true if cal data was loaded. If you like, you can go low-level and query uhd.usrp.cal.database.read_cal_data() and see if it loads the right data... but that's pretty advanced, and I'll let you read the manual for that if you want to do that. --M On Wed, Jul 23, 2025 at 7:43 PM <dennis.joosens@uantwerpen.be> wrote: > Hi, > > I am working on power calibration of the USRP B210 SDR specifically on the > RX side. > > The power calibration worked, I managed to generate four .cal files: > > b2xx_pwr_rx_tx+rx_316E278#A.cal > > b2xx_pwr_rx_tx+rx_316E278#B.cal > > b2xx_pwr_rx_rx2_316E278#A.cal > > b2xx_pwr_rx_rx2_316E278#B.cal > > and I can find them in the default directory ~/.local/share/uhd/cal > > Now I am trying to load these .cal files using the UHD Python API. I can > check if these files exist and read their contents. > > But I am wondering, can I assume that the UHD loads the .cal files when a > USRP stream is opened by default from this default folder? I can not seem > to find any function or output from API functions that can give me a > definite answer on that or even gives the possibility to check this. > > If this is not the case. How is this handled by default? This seems a big > mystery in the documentation. > > Thanks, > > Dennis > _______________________________________________ > USRP-users mailing list -- usrp-users@lists.ettus.com > To unsubscribe send an email to usrp-users-leave@lists.ettus.com >
DJ
dennis.joosens@uantwerpen.be
Thu, Jul 24, 2025 11:57 AM

Hi Martin,

Thanks for your swift answer!

I managed to get it working now. I share these few lines of code here as they may be a help for someone else.

I have to note that I focus on calibration on the receiving side of the B210s (RX/RX2). But I believe for TX calibration, changing some things from RX to TX in the functions will work too.

For now, there is no check whether the cal files exist, but based on the True/False flag of the has_rx_power_reference(), it is easily implemented if needed.

print("> Searching for calibration files at: ",uhd.get_cal_data_path())

print("> has_rx_power_reference?: ",usrp1.has_rx_power_reference())

print("> get_usrp_rx_info: ",usrp1.get_usrp_rx_info(0)) 



serial = usrp1.get_usrp_rx_info()\["rx_ref_power_serial"\]

key = usrp1.get_usrp_rx_info()\["rx_ref_power_key"\]

print(f"Using B210 with serial: {serial}")

print(f"Using B210 with key: {key}")  

print(uhd.usrp.cal.database.read_cal_data(key, serial))
Hi Martin, Thanks for your swift answer! I managed to get it working now. I share these few lines of code here as they may be a help for someone else. I have to note that I focus on calibration on the receiving side of the B210s (RX/RX2). But I believe for TX calibration, changing some things from RX to TX in the functions will work too. For now, there is no check whether the cal files exist, but based on the True/False flag of the has_rx_power_reference(), it is easily implemented if needed. print("> Searching for calibration files at: ",uhd.get_cal_data_path()) print("> has_rx_power_reference?: ",usrp1.has_rx_power_reference()) print("> get_usrp_rx_info: ",usrp1.get_usrp_rx_info(0)) serial = usrp1.get_usrp_rx_info()\["rx_ref_power_serial"\] key = usrp1.get_usrp_rx_info()\["rx_ref_power_key"\] print(f"Using B210 with serial: {serial}") print(f"Using B210 with key: {key}") print(uhd.usrp.cal.database.read_cal_data(key, serial))