usrp-users@lists.ettus.com

Discussion and technical support related to USRP, UHD, RFNoC

View all threads

Set the gain settings in C++ API for B210

SS
swapnil srivastava
Thu, Sep 7, 2023 4:18 AM

Hello, I'm having some trouble with the UHD API. I'm trying to build a
simple receiver code by following the examples in the 'rx_samples_to_file'
and 'rx_timed_samples'. When I'm using the rx_samples_to_file example and
try to set the gain settings through the command line, (/rx_samples_to_file
--freq 98e6 --rate 5e6 --gain 20 --channels 0,1 --duration 10
usrp_samples.dat).

I get an error saying " RX channel 18446744073709551615 out of range for
configured RX frontends".
Basically I want to be able to use both received channels simultaneously
and set the gain for both, like you can in GNU Radio Companion. If I don't
set the gain then it runs as expected. I've tried adding more parameters
such as 'ant' and 'subdev' but it doesn't seem to work.
Thank you

Hello, I'm having some trouble with the UHD API. I'm trying to build a simple receiver code by following the examples in the 'rx_samples_to_file' and 'rx_timed_samples'. When I'm using the rx_samples_to_file example and try to set the gain settings through the command line, (/rx_samples_to_file --freq 98e6 --rate 5e6 --gain 20 --channels 0,1 --duration 10 usrp_samples.dat). I get an error saying " RX channel 18446744073709551615 out of range for configured RX frontends". Basically I want to be able to use both received channels simultaneously and set the gain for both, like you can in GNU Radio Companion. If I don't set the gain then it runs as expected. I've tried adding more parameters such as 'ant' and 'subdev' but it doesn't seem to work. Thank you
MD
Marcus D. Leech
Thu, Sep 7, 2023 10:51 PM

On 07/09/2023 00:18, swapnil srivastava wrote:

Hello, I'm having some trouble with the UHD API. I'm trying to build a
simple receiver code by following the examples in the
'rx_samples_to_file' and 'rx_timed_samples'. When I'm using the
rx_samples_to_file example and try to set the gain settings through
the command line, (/rx_samples_to_file --freq 98e6 --rate 5e6 --gain
20 --channels 0,1 --duration 10 usrp_samples.dat).

I get an error saying " RX channel 18446744073709551615 out of range
for configured RX frontends".
Basically I want to be able to use both received channels
simultaneously and set the gain for both, like you can in GNU Radio
Companion. If I don't set the gain then it runs as expected. I've
tried adding more parameters such as 'ant' and 'subdev' but it doesn't
seem to work.
Thank you


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

When I've seen this behavior in the past it has been because the UHD
example apps were linked against one version of the UHD
  library, and then another version of that library was installed onto
the system underneath them--you have a library version
  mis-match.

Possibly when you installed Gnu Radio from the packaged repositories
AFTER doing a manual build of UHD, or some other
  incompatible UHD install.

On 07/09/2023 00:18, swapnil srivastava wrote: > Hello, I'm having some trouble with the UHD API. I'm trying to build a > simple receiver code by following the examples in the > 'rx_samples_to_file' and 'rx_timed_samples'. When I'm using the > rx_samples_to_file example and try to set the gain settings through > the command line, (/rx_samples_to_file --freq 98e6 --rate 5e6 --gain > 20 --channels 0,1 --duration 10 usrp_samples.dat). > > I get an error saying " RX channel 18446744073709551615 out of range > for configured RX frontends". > Basically I want to be able to use both received channels > simultaneously and set the gain for both, like you can in GNU Radio > Companion. If I don't set the gain then it runs as expected. I've > tried adding more parameters such as 'ant' and 'subdev' but it doesn't > seem to work. > Thank you > > > _______________________________________________ > USRP-users mailing list -- usrp-users@lists.ettus.com > To unsubscribe send an email to usrp-users-leave@lists.ettus.com When I've seen this behavior in the past it has been because the UHD example apps were linked against one version of the UHD   library, and then another version of that library was installed onto the system underneath them--you have a library version   mis-match. Possibly when you installed Gnu Radio from the packaged repositories AFTER doing a manual build of UHD, or some other   incompatible UHD install.
1
1920swapnil@gmail.com
Fri, Sep 8, 2023 12:01 AM

Well would you say that's still the case if I can run the example if I just exclude certain parameters? For example if I just give a sample rate, freq, duration it runs fine. It's just that when I pass the gain parameter the error shows up. Furthermore, other examples such as rx_samples_to_udp also run fine, even when I add a gain parameter. The issue comes when I try to modify the udp example to include 2 channels, then it fails with the same error stated above.

Well would you say that's still the case if I can run the example if I just exclude certain parameters? For example if I just give a sample rate, freq, duration it runs fine. It's just that when I pass the gain parameter the error shows up. Furthermore, other examples such as rx_samples_to_udp also run fine, even when I add a gain parameter. The issue comes when I try to modify the udp example to include 2 channels, then it fails with the same error stated above.
MD
Marcus D. Leech
Fri, Sep 8, 2023 12:09 AM

On 07/09/2023 20:01, 1920swapnil@gmail.com wrote:

Well would you say that's still the case if I can run the example if I
just exclude certain parameters? For example if I just give a sample
rate, freq, duration it runs fine. It's just that when I pass the gain
parameter the error shows up. Furthermore, other examples such as
rx_samples_to_udp also run fine, even when I add a gain parameter. The
issue comes when I try to modify the udp example to include 2
channels, then it fails with the same error stated above.

Well, if the standard examples work, and yours doesn't, I would say that
you need to review your modifications to make sure they're
  "sane".

It's unlikely that UHD has a bug that causes the "set_gain()" method to
not work in some cases, and two streams vs a single
  stream isn't a particularly "weird" case.

When stuff like this happens--where you modify an example, the onus is
on you to do basic debugging, as you would
  with any compiled language like C++ or C.  Put in some debugging
print statements before and after the call, for example.
  Make sure you're providing adequate-sized buffers, so that sample
data isn't over-writing other things in your modified
  code.  Remember, C++ has NO run-time bounds checking.   Everything is
done at compile time, and if a bound cannot
  be checked at compile time, there isn't a runtime there to tell you
exactly what you did wrong.  That's true of pretty-much
  ALL C/C++ programs.

On 07/09/2023 20:01, 1920swapnil@gmail.com wrote: > > Well would you say that's still the case if I can run the example if I > just exclude certain parameters? For example if I just give a sample > rate, freq, duration it runs fine. It's just that when I pass the gain > parameter the error shows up. Furthermore, other examples such as > rx_samples_to_udp also run fine, even when I add a gain parameter. The > issue comes when I try to modify the udp example to include 2 > channels, then it fails with the same error stated above. > > Well, if the standard examples work, and yours doesn't, I would say that you need to review your modifications to make sure they're   "sane". It's unlikely that UHD has a bug that causes the "set_gain()" method to not work in some cases, and two streams vs a single   stream isn't a particularly "weird" case. When stuff like this happens--where you modify an example, the onus is on you to do basic debugging, as you would   with any compiled language like C++ or C.  Put in some debugging print statements before and after the call, for example.   Make sure you're providing adequate-sized buffers, so that sample data isn't over-writing other things in your modified   code.  Remember, C++ has NO run-time bounds checking.   Everything is done at compile time, and if a bound cannot   be checked at compile time, there isn't a runtime there to tell you exactly what you did wrong.  That's true of pretty-much   ALL C/C++ programs.
1
1920swapnil@gmail.com
Fri, Sep 8, 2023 1:26 AM

Maybe I didn’t clarify properly, the standard example ‘rx_samples_to_file’ example works correctly if I don’t provide any gain argument, but fails when I do. I understand my own examples would require me to debug, but I would like to understand why the standard examples don’t work for my specific set of arguments, whether that’s because my arguments are incomplete/incorrect or if that’s because that’s the expected result for a b210.

Maybe I didn’t clarify properly, the standard example ‘rx_samples_to_file’ example works correctly if I don’t provide any gain argument, but fails when I do. I understand my own examples would require me to debug, but I would like to understand why the standard examples don’t work for my specific set of arguments, whether that’s because my arguments are incomplete/incorrect or if that’s because that’s the expected result for a b210.
MD
Marcus D. Leech
Fri, Sep 8, 2023 1:42 AM

On 07/09/2023 21:26, 1920swapnil@gmail.com wrote:

Maybe I didn’t clarify properly, the standard example
‘rx_samples_to_file’ example works correctly if I don’t provide any
gain argument, but fails when I do. I understand my own examples would
require me to debug, but I would like to understand why the standard
examples don’t work for my specific set of arguments, whether that’s
because my arguments are incomplete/incorrect or if that’s because
that’s the expected result for a b210.


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

Then we're back to mis-matched libraries almost certainly.

What version of UHD libraries do you have installed--how did you
install them?   Did you then install Gnu Radio, which may
  have pulled in a different version of UHD.

I just tried that example on my Ubuntu 22.04 system, with UHD 4.1.0.5,
and it worked just fine.

On 07/09/2023 21:26, 1920swapnil@gmail.com wrote: > > Maybe I didn’t clarify properly, the standard example > ‘rx_samples_to_file’ example works correctly if I don’t provide any > gain argument, but fails when I do. I understand my own examples would > require me to debug, but I would like to understand why the standard > examples don’t work for my specific set of arguments, whether that’s > because my arguments are incomplete/incorrect or if that’s because > that’s the expected result for a b210. > > > _______________________________________________ > USRP-users mailing list -- usrp-users@lists.ettus.com > To unsubscribe send an email to usrp-users-leave@lists.ettus.com Then we're back to mis-matched libraries almost certainly. What version of UHD *libraries* do you have installed--how did you install them?   Did you then install Gnu Radio, which may   have pulled in a different version of UHD. I just tried that example on my Ubuntu 22.04 system, with UHD 4.1.0.5, and it worked just fine.
1
1920swapnil@gmail.com
Fri, Sep 8, 2023 1:56 AM

I have the version 4.4.0.0 on ubuntu 22.04. I followed the ‘ Building and Installing the USRP Open-Source Toolchain (UHD and GNU Radio) on Linux’ guide, and yes I did install GNU Radio afterwards. I’ll try to uninstall GNU Radio to see if that fixes the issue.

I have the version 4.4.0.0 on ubuntu 22.04. I followed the ‘ Building and Installing the USRP Open-Source Toolchain (UHD and GNU Radio) on Linux’ guide, and yes I did install GNU Radio afterwards. I’ll try to uninstall GNU Radio to see if that fixes the issue.
MD
Marcus D. Leech
Fri, Sep 8, 2023 1:58 AM

On 07/09/2023 21:56, 1920swapnil@gmail.com wrote:

I have the version 4.4.0.0 on ubuntu 22.04. I followed the ‘ Building
and Installing the USRP Open-Source Toolchain (UHD and GNU Radio) on
Linux’ guide, and yes I did install GNU Radio afterwards. I’ll try to
uninstall GNU Radio to see if that fixes the issue.


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

Given that the B210 hasn't had any updates in quite some time, there's
no reason to have the "very latest" UHD, and the
 version that is packaged with Ubuntu should be just fine.

It's likely that you have a conflict between the "installed from the
distro repo" versions of UHD and Gnu Radio, and the
  bits and pieces that you compiled and installed from source.  The
"mixed system" syndrome.

On 07/09/2023 21:56, 1920swapnil@gmail.com wrote: > > I have the version 4.4.0.0 on ubuntu 22.04. I followed the ‘ Building > and Installing the USRP Open-Source Toolchain (UHD and GNU Radio) on > Linux’ guide, and yes I did install GNU Radio afterwards. I’ll try to > uninstall GNU Radio to see if that fixes the issue. > > > _______________________________________________ > USRP-users mailing list -- usrp-users@lists.ettus.com > To unsubscribe send an email to usrp-users-leave@lists.ettus.com Given that the B210 hasn't had any updates in quite some time, there's no reason to have the "very latest" UHD, and the  version that is packaged with Ubuntu should be just fine. It's likely that you have a conflict between the "installed from the distro repo" versions of UHD and Gnu Radio, and the   bits and pieces that you compiled and installed from source.  The "mixed system" syndrome.