Gain control for RTL-SDR

1,299 views
Skip to first unread message

w6sz

unread,
Jun 15, 2015, 4:45:56 PM6/15/15
to lin...@googlegroups.com
HI Leif,

Still working here with the rtl-sdr 820T Dongle and using your "max  waterfall sensitivity  video."

In that video at one point, you set the max gain to "99"  and the software defaults then to 66.( max gain )
and you can then change the gain of the device.

Using the latest software, that setting is often at 15 dB when I start Linrad. As soon as I try to adjust it, the setting reading to 0 dB
and will not follow any adjustment I try to make. No changes in Gain of the dongle ever.occur.

I suppose I do not have this this gain control activated?  Where is this done?  The dongle LO setting is working OK

Is it part of the input device setup? From the video it appears that the dongle gain is changed with that control.

73 Rein W6SZ


Leif Asbrink

unread,
Jun 15, 2015, 6:09:07 PM6/15/15
to lin...@googlegroups.com
Hello Rein,

> Using the latest software, that setting is often at 15 dB when I start
> Linrad. As soon as I try to adjust it, the setting reading to 0 dB
> and will not follow any adjustment I try to make. No changes in Gain of the
> dongle ever.occur.
In the setup procedure 'U' on the main menu, then 'A' for input
and finally 'H' for rtlsdr you should find the selection for gain mode:

0 = Auto
1 = Original Osmocom
2 = Linearity
3 = Sensitivity

Probably you have selected Auto. That would disable manual gain
control.

In case you do not get all four modes it would be a good
idea to install the library from here:
git clone https://github.com/dl8aau/librtlsdr.git

73

Leif

w6sz

unread,
Jun 15, 2015, 9:37:16 PM6/15/15
to lin...@googlegroups.com

   Hello Leif,


 Thanks, very well. Probably should have done a F1 before selecting "auto" Keep on doing that!

 73 Rein W6SZ


 
 

w6sz

unread,
Jun 17, 2015, 6:50:18 PM6/17/15
to lin...@googlegroups.com

     Hello Leif,


Still not quite getting the RTLSDR lib   use / installation understood.

There are I think, now 2 so-called libraries, one OSMO one and one you have updated or perhaps update more frequently than the OSMO one.

I am using the OSMO one now , I think but in your video you are using another one, more gain mode selections and your max indicated gain is I believe 64 dB
here, it is 50 dB.

some time ago you introduced Dongles that could be used as Linrad hardware. and became the rtlsdr lib in use

Then, later you suggested that before installing Linrad to remove rtlsdr libs to remove from the computer and install the library via .the ./configure help instructions.

Later I think, you included the library with the svn package  ( I guess the OSMO version? ) to be selected by selecting under "gain" hardware selection.

I have always been using the svn versions her and still have that version ( most recent ) instead of the just released 4.06 version.

So my real question is what should I do to get your RTLSDR lib version ( with  the 4 mode selections for the RTL-SDR selection )

to install that version ( suppose not OSMO )

is this the correct action? below.

================================
 
 rm -r /usr/src/rtl-sdr*
    cd /usr/src
    git clone 

    cd rtl-sdr/src
    mv librtlsdr.c librtlsdr.c.old
    wget http://sm5bsz.com/linuxdsp/archive/rtlsdr/librtlsdr.c    
    mv tuner_e4k.c tuner.e4k.c.old
    wget http://sm5bsz.com/linuxdsp/archive/rtlsdr/tuner_e4k.c
    cd ..
    mkdir build
    cd build
    cmake ../
    make
    make install

================================

0r this one?

===================================================================
 cd /usr/src
  rm -f rtl-sdr-linrad4.tbz
  wget http://sm5bsz.com/linuxdsp/hware/rtlsdr/rtl-sdr-linrad4.tbz
  tar xvfj rtl-sdr-linrad4.tbz
  cd rtl-sdr-linrad4                                 <--------  this is old?
  autoconf
  autoreconf -i
  ./configure
  make
  make install
  ldconfig
  Note that you need root privileges and that the packages
  pkg-config, libtool, autoconf, libusb-1.0 and wget have to
  be installed. There may be later versions available:
  http://sm5bsz.com/linuxdsp/hware/rtlsdr/rtl-sdr-linradxx.tbz."

   Also should I remove an "other version"  before configuring the svn version or not?

Hoping not  upsetting you too much,.. I might be mixing up the time line of developments.

It looks like I am getting to use Linrad on the Raspberry Pi after all and my thanks for helping out a
non Linux person.

Main interets are weak carrier detection in a low signal environment ( space craft ) and power/loss and noise figure issues besides that
WSPR and WSJT ( JT4 ,. JT9 ) probbly with second Raspberry Pi

73 Rein W6SZ





 
 

Leif Asbrink

unread,
Jun 18, 2015, 2:00:58 PM6/18/15
to lin...@googlegroups.com
Hello Rein,

> Still not quite getting the RTLSDR lib use / installation understood.
>
> There are I think, now 2 so-called libraries, one OSMO one and one you have
> updated or perhaps update more frequently than the OSMO one.
There are several versions of librtlsdr around. The main problem
is that the developers at Osmocom do not want to include different
gain modes.

The recommended procedure to install librtlsdr is to first
delete /usr/local/lib/librtlsdr.so and then run ./configure --with-help

Linrad would give you the currently recommended library which
at the moment is https://github.com/dl8aau/librtlsdr.git

Just copy the installation commands and paste into your
command window.

For R820T or R820T2 users I introduced a bandwidth setting which
gives a dramatic performance improvement in some situations.
That mod is included in the dl8aau library and I think it
has been accepted in the Osmocom library - but probably implemented
a bit differently. I have not yet tested it. One of my projects
is an updated version of rtlsdr intended to allow different functions
for the R820T and R820T2.

There is already a version here:
http://www.sm5bsz.com/linuxdsp/hware/rtlsdr/rtl-sdr-linrad5.tbz
it only differs from the dl8aau version in that it contains a bug
correction that is needed on very slow computers only. It prevents
Linrad to crash on exit without it, the crash makes it impossible
to change parameters.

> I am using the OSMO one now , I think but in your video you are using
> another one, more gain mode selections and your max indicated gain is I
> believe 64 dB here, it is 50 dB.
Do not worry about the number. The dB scales have different zero points.

> some time ago you introduced Dongles that could be used as Linrad hardware.
> and became the rtlsdr lib in use
???????????????????
I do not understand what you mean here.

> Then, later you suggested that before installing Linrad to remove rtlsdr
> libs to remove from the computer and install the library via .the
> ./configure help instructions.
Yes. This is the way to install everything you might want in Linrad.

> Later I think, you included the library with the svn package ( I guess the
> OSMO version? ) to be selected by selecting under "gain" hardware selection.
???????????????????
No. You may find that different Linrad versions may suggest different
installation procedures. Older Linrad versions might suggest
wget http://www.sm5bsz.com/linuxdsp/hware/rtlsdr/rtl-sdr-linrad4.tbz
or earlier and 04-07 might want rtl-sdr-linrad6.tbz

> I have always been using the svn versions her and still have that version (
> most recent ) instead of the just released 4.06 version.
>
> So my real question is what should I do to get your RTLSDR lib version (
> with the 4 mode selections for the RTL-SDR selection )
>
> to install that version ( suppose not OSMO )
>
> is this the correct action? below.
>
> ================================
>
>
> rm -r /usr/src/rtl-sdr*
> cd /usr/src
> git clone
>
> cd rtl-sdr/src
> mv librtlsdr.c librtlsdr.c.old
> wget http://sm5bsz.com/linuxdsp/archive/rtlsdr/librtlsdr.c
> mv tuner_e4k.c tuner.e4k.c.old
> wget http://sm5bsz.com/linuxdsp/archive/rtlsdr/tuner_e4k.c
> cd ..
> mkdir build
> cd build
> cmake ../
> make
> make install
>
>
> ================================
No, the above is VERY old. It only works for the E4000 tuner - and
it needs an old version from Osmocom.


> ===================================================================
>
> cd /usr/src
> rm -f rtl-sdr-linrad4.tbz
> wget http://sm5bsz.com/linuxdsp/hware/rtlsdr/rtl-sdr-linrad4.tbz
> tar xvfj rtl-sdr-linrad4.tbz
> cd rtl-sdr-linrad4 <-------- this is old?
> autoconf
> autoreconf -i
> ./configure
> make
> make install
> ldconfig
> Note that you need root privileges and that the packages
> pkg-config, libtool, autoconf, libusb-1.0 and wget have to
> be installed. There may be later versions available:
> http://sm5bsz.com/linuxdsp/hware/rtlsdr/rtl-sdr-linradxx.tbz."

This is old, I do not remember if it has gain modes for the R820T.
Probably it has, but probably there is no bandwidth setting
available. It will definitely be equivalent to the latest
if you have an E4000 tuner.

> Also should I remove an "other version" before configuring the svn
> version or not?
?????????????????????
Do you refer to Linrad versions here? That would be a misconception.

When you install a linrad version. New or old, it is a good idea
to leave all old Linrad installations unchanged. The Linrad directory
contains all the configuration files for Linrad and another Linrad
directory will not be affected. A complete Linrad backup is something
like cp /home/bsz/linrad-04.06/* /home/bsz/test4711

Then cd /home/bsz/test4711 start Linrad and change parameters.
The original will not be affected.

***************************************************************************
Setting up your Linux environment to support the hardware that you want
to use with Linrad is quite another thing. Once you have done it, the
relevant files are in place. You can then install or delete any version
of Linrad within the limitations set by the gcc compiler and X11. If you
try to install Linrad-03.00 on a modern system you would get this:
error: ‘XKeycodeToKeysym’ is deprecated

It is fairly easy to look at the corresponding lines of a recent linrad
package and make the necessary mod in case you really want to experiment
with old Linrad versions.

The configure script of old Linrad versions might require some more
packages than those needed today, installing them will not make your system
different as seen by the latest Linrad version.

The configure script of old versions may point to Internet sites that
no longer exist - but recent versions will point to working libraries.

A typical case:
--------- snip ----------
Project Hosting on Google Code will close on January 25th, 2016.
(http://google-opensource.blogspot.it/2015/03/farewell-to-google-code.html).

So, together with Nico, we decided to move all the code to a github
repository found here:

https://github.com/amontefusco/libperseus-sdr
--------- snip ----------

All linrad users that already have the perseus library installed will
notice nothing and will need to do nothing. Installing libperseus-sdr
by use of linrad-04.06 and earlier will not be possible in the
future but linrad-04.07 and later will give the instructions how to
download and compile from github.com


The rtlsdr library is a special case since Osmocom up to now (as far
as I know) does not want to include gain modes. There are other forks
of rtlsdr that allow a wider frequency coverage and it is not a Linrad
thing which driver you prefer to use with your dongle. Since there are
different forks there is no safe way to investigate the library.
The number of supported tuners is likely to increase and I do not want
to build wisdom about all the tuners into Linrad. You know what tuner
you have. If you do not see the functions that it should have you need
another librtlsdr.so - you might even find that an USB dongle that
is said to work in other SDR software does not work with the Library
suggested by the Linrad configure script. Osmocom continously updates
for new tuners but the forks may not be updated. I actually do not
want to maintain my own version of librtlsdr but since the gain modes
provide an essential performance improvement I feel I have to until
Osmocom reconsiders.

> Main interets are weak carrier detection in a low signal environment (
> space craft ) and power/loss and noise figure issues besides that
> WSPR and WSJT ( JT4 ,. JT9 ) probbly with second Raspberry Pi
Then you would probably be quite happy with the Osmocom compromise
for setting gain:-)

73

Leif

rei...@ix.netcom.com

unread,
Jun 18, 2015, 3:04:42 PM6/18/15
to lin...@googlegroups.com
Hello Leif,

Thanks again very much for the extensive info on the RTLSDR lib issue.

Quite some work to put it all together.

73 Rein W6SZ
>--
>You received this message because you are subscribed to the Google Groups "Linrad" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to linrad+un...@googlegroups.com.
>To post to this group, send email to lin...@googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

Nick

unread,
Jul 15, 2015, 9:12:46 AM7/15/15
to lin...@googlegroups.com
Hi Leif

I finally got around to finishing an HF upconverter for the
RTL2832U/E4000 dongle.

I installed the latest version of the rtl-sdr library on this Mint 17.1
x64 machine. I then installed linrad build 502.

I get 2 gain modes AGC and Original Osmocom.

I cannot get the 4 gain modes to work.

./configure --with-help says

Not present: librtlsdr.so (32bit)
This package is needed for the Realtek RTL2832 based DVB dongle
Copy from a 32 bit installation.

I do not have a 32 bit installation I can copy from.

/usr/local/lib/librtlsdr.so links to /usr/local/lib/librtlsdr.so.0.0.5.

I got all four gain modes back in June on this machine. I do not
understand what has changed.

Please can you tell me what I am doing wrong?

73

Nick G3VNC




Leif Asbrink

unread,
Jul 16, 2015, 9:30:29 AM7/16/15
to lin...@googlegroups.com
Hello Nick,

> I finally got around to finishing an HF upconverter for the
> RTL2832U/E4000 dongle.
>
> I installed the latest version of the rtl-sdr library on this Mint 17.1
> x64 machine. I then installed linrad build 502.
The Osmocom people did not like my proposal with gain modes so they
declined it. Easiest would be to uninstall the rtl-sdr library
and then run the command ./configure --with-help in the Linrad
directory. You will get instructions how to install.


> I get 2 gain modes AGC and Original Osmocom.
> I cannot get the 4 gain modes to work.
> ./configure --with-help says
> Not present: librtlsdr.so (32bit)
> This package is needed for the Realtek RTL2832 based DVB dongle
> Copy from a 32 bit installation.
>
> I do not have a 32 bit installation I can copy from.
So you can not generate a 32 bit version of linrad, no worry,
you can generate a 64 bit version:-)
The 32 bit version may be a bit faster in special cases but these days
CPU speed is not often a problem. Extremists may install both a 32 bit
and a 64 bit version on separate partitions....

> /usr/local/lib/librtlsdr.so links to /usr/local/lib/librtlsdr.so.0.0.5.
>
> I got all four gain modes back in June on this machine. I do not
> understand what has changed.
>
> Please can you tell me what I am doing wrong?
Yes, you updated librtlsdr .....

73

Leif

Nick

unread,
Jul 17, 2015, 5:49:21 AM7/17/15
to lin...@googlegroups.com
Hi Leif

On 16/07/15 15:28, Leif Asbrink wrote:
> Hello Nick,
>
> Easiest would be to uninstall the rtl-sdr library
> and then run the command ./configure --with-help in the Linrad
> directory. You will get instructions how to install.

I removed all traces of rtl-sdr and now I get the instructions to install.

Instructions work.

>> I cannot get the 4 gain modes to work.

Now I get all four gain modes but when I select CW xlinrad64 closes with...

./xlinrad64: symbol lookup error: /usr/local/lib/librtlsdr.so: undefined
symbol: libusb_handle_events_timeout_completed

/usr/local/lib/librtlsdr.so links to /usr/local/lib/librtlsdr.so.0 links
to /usr/local/lib/librtlsdr.so.0.5git, which I assume is the modified
version of the rtl-library with 4 gain modes?

73

Nick G3VNC

Leif Asbrink

unread,
Jul 17, 2015, 7:48:28 PM7/17/15
to lin...@googlegroups.com
Hello Nick,

> I removed all traces of rtl-sdr and now I get the instructions to install.
> Now I get all four gain modes but when I select CW xlinrad64 closes with...
>
> ./xlinrad64: symbol lookup error: /usr/local/lib/librtlsdr.so: undefined
> symbol: libusb_handle_events_timeout_completed
Very odd.

Lines 42 to 46 of librtlsdr.c should be like this:
/* libusb < 1.0.9 doesn't have libusb_handle_events_timeout_completed */
#ifndef HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED
#define libusb_handle_events_timeout_completed(ctx, tv, c) \
libusb_handle_events_timeout(ctx, tv)
#endif

The cmake script should set HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED
properly.

Sourceforge is not available today. The latest linrad uses cmake, old versions
use autoconf and configure.

> /usr/local/lib/librtlsdr.so links to /usr/local/lib/librtlsdr.so.0 links
> to /usr/local/lib/librtlsdr.so.0.5git, which I assume is the modified
> version of the rtl-library with 4 gain modes?
Yes. I have tried this on Ubuntu 10.10 which has an old version of libusb-1.0.
It does work correctly with libusb_handle_events_timeout(ctx, tv) rteplacing
libusb_handle_events_timeout_completed(ctx, tv, c)


73

Leif

Nick

unread,
Jul 19, 2015, 3:32:52 PM7/19/15
to lin...@googlegroups.com
On 18/07/15 01:46, Leif Asbrink wrote:
> Hello Nick,
>
> The cmake script should set HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED
> properly.

> I have tried this on Ubuntu 10.10 which has an old version of libusb-1.0.
> It does work correctly with libusb_handle_events_timeout(ctx, tv) rteplacing
> libusb_handle_events_timeout_completed(ctx, tv, c)

I do not think this is a linrad problem. I tried it on another machine
running Mint 17.1 x64 and it worked correctly.

rtl_test shows the same error...

symbol lookup error: /usr/local/lib/librtlsdr.so: undefined
symbol: libusb_handle_events_timeout_completed

Could this indicate that librtlsdr cannot find a symbol in libusb-1.0?

I do not think it is relevant, but this was in the output from
./configure --with-help...

Not present: libusb-1.0.so (32bit)
Needed for most USB hardware.
Debian, Ubuntu: Copy from a 32 bit installation.
...
A symbolic link may be missing. Something like this:
ln -s /usr/lib/libusb-1.0.so.0.0.0 /usr/lib/libusb-1.0.so
Then run ./configure --with-help again.

This message did not appear on the other machine where everything works.

Anyway I found

/usr/local/lib/libusb-1.0.so.0 => /usr/local/libmchpusb-1.0.so =>
/opt/microchip/mplabcomm1.0/lib-1.0.so.0.0.0

This is a hangover from an installation of MPLABX I did on the machine.

Synaptic showed that libusb-1.0 and libusb-1.0-0-dev were installed. I
reinstalled them and ran sudo ldconfig.

I then removed the two libusb links in /usr/local/lib.

I ran ./configure --with-help again; it still showed that libusb-1.0.so
(32 bit) was missing.

I reinstalled your improved version of librtlsdr, ran ./configure, make
xlinrad64 and it all works now.

I am not certain what the problem was, but it appears that the Microchip
version of libusb-1.0 may not have the same API as the Mint 17.1 version.

This does not explain why the improved librtlsdr worked before on this
machine!

Many thanks for your help Leif.

73

Nick G3VNC
Reply all
Reply to author
Forward
0 new messages