Linrad with rtlsdr with and the e4000 tuner.

Leif Asbrink leif at
Fri Jun 22 19:55:51 UTC 2012


This mail is sent to all the E-mail addresses I have
found in the source code of tuner_e4k.c and librtlsdr.c

I have made a couple of modifications to the software and
I now want to ask whether you can make changes to the 
standard package that you supply so Linrad users will
not have to download modified files from my site to
get proper operation of Linrad in the future.

The most important modification is the gain setting.
The tuner code requires knowledge of the gain table
or searcing for legal gain values by use of the returned
error code. I think that this is impractical and I changed it
so the routine will now always set the nearest possible gain
value and return it to the caller.

The routine e4k_set_enh_gain(...) does not affect the gain 
of my hardware so I allow the gain setting function to use it
with always the same value because I have no idea what this
function is intended to do....

The default IF gain is too high. I reduced it by 6dB for
a 6 dB better dynamic range.

With the tuner_e4k.c currently incorporated in Linrad
there is an AGC action that degrades the dynamic range by 
about 10 dB. I do not know anything about the e4000 internals
but in case this remaining AGC can be disabled and the gain
set 10 dB lower in the particular gain step controlled by the
AGC, the dynamic range would improve from 66 dB to 76 dB
with respect to the usual MDS (noise in 500 Hz bandwidth.)
That means going from outside the scale in the QST "Key 
Measurements Summary" in their product testing to a mediocre 
result 6 dB above the limit of the range they have for SSB radios. 
The rtlsdr would be superior to hand held units like TH-D72A 
or VX-8GR in adjacent channel rejection (QST July 2011 and 
September 2011) if the AGC could be disabled. 

The details are here:

The Extio_RTLSDR.dll file provides 6 dB worse dynamic range
because of the high IF gain setting. It also has a poor
noise figure.


To be able to use the callback in Linrad I have had to include
various structures in the Linrad c code. I need to have this 
code in Linrad:
  i = libusb_handle_events_timeout(dev_rtlsdr->ctx, &tv1);
Therefore I need the structure rtlsdr_dev which is not included
in rtl-sdr.h. That structure requires other structures and it
would be a good thing if those things as well as something
like this:
#define MAX_RTL2832_SAMP_RATE  3200000
#define MIN_RTL2832_SAMP_RATE  900001
were included in rtl-sdr.h

I attach the Linrad interface routine to rtlsdr in case any of
you are interested to see how I use the library.

I realize the chip is far more clever and that I do not use it
well. There is a substantial DC offset that seems to be possible to
auto-remove. The AGC I want to get rid of might be something
related to: 
/* disable auto mixer gain */
e4k_reg_set_mask(e4k, E4K_REG_AGC7, E4K_AGC7_MIX_GAIN_AUTO, 0);

Hard to know without any documentation on the chip....


Leif / SM5BSZ
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtl2832.c
Type: text/x-csrc
Size: 14294 bytes
Desc: not available
URL: <>

More information about the osmocom-sdr mailing list