RealTek RTL2832U Can't change frequency

2,521 views
Skip to first unread message

Bryan Lee

unread,
Nov 9, 2017, 10:41:26 AM11/9/17
to Gqrx SDR
I can't change the frequency inside GQRX.  I get a "r82xx_set_feq: failed=-9" error when I try.  Any ideas?

Ubuntu 17.10.
GQRX 2.8 (installed from ppa)

$ gqrx 
linux; GNU C++ version 6.3.0 20170618; Boost_106200; UHD_003.010.002.000-release

gr-osmosdr v0.1.x-xxx-xunknown (0.1.5git) gnuradio 3.7.10
built-in source types: file osmosdr fcd rtl rtl_tcp uhd plutosdr miri hackrf bladerf rfspace airspy soapy redpitaya 
FM demod gain: 3.05577
Resampling audio 96000 -> 48000
IQ DCR alpha: 1.04166e-05
Using audio backend: auto
BookmarksFile is /home/bragon/.config/gqrx/bookmarks.csv
gr-osmosdr v0.1.x-xxx-xunknown (0.1.5git) gnuradio 3.7.10
built-in source types: file osmosdr fcd rtl rtl_tcp uhd plutosdr miri hackrf bladerf rfspace airspy soapy redpitaya 
Using device #0 Realtek RTL2838UHIDIR SN: 00000001
Detached kernel driver
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
[R82XX] PLL not locked!
IQ DCR samp_rate: 1.024e+06
IQ DCR alpha: 9.76562e-07
Changing NB_RX quad rate: 96000 -> 1.024e+06
No change in output device:
  old: 
  new: 
[R82XX] PLL not locked!
IQ DCR samp_rate: 2.88e+06
IQ DCR alpha: 3.47222e-07
Changing NB_RX quad rate: 1.024e+06 -> 2.88e+06
FM demod gain: 0.509296
Genrating taps for new filter   LO:-80000   HI:80000 TW:32000   Taps: 19
Genrating taps for new filter   LO:-80000   HI:80000 TW:32000   Taps: 19
rtlsdr_demod_write_reg failed with -9
r82xx_write: i2c wr failed=-9 reg=17 len=1
r82xx_set_freq: failed=-9



Bryan Lee

unread,
Nov 9, 2017, 10:44:19 AM11/9/17
to Gqrx SDR
Using SDRTouch on Android I can change frequencies properly, so I don't believe this is a case of faulty hardware.

Alexandru Csete

unread,
Nov 9, 2017, 2:18:59 PM11/9/17
to gq...@googlegroups.com
Please test the device on the same computer and OS with rtl_test. You
will probably get the same errors. I haven't really tested the PPA on
17.10.

Alex
> --
> You received this message because you are subscribed to the Google Groups
> "Gqrx SDR" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to gqrx+uns...@googlegroups.com.
> To post to this group, send email to gq...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gqrx/b5930bce-58a8-40d9-b0ec-e1de8b8207a0%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Bryan Lee

unread,
Nov 9, 2017, 2:34:33 PM11/9/17
to Gqrx SDR
What options should I give rtl_test?

$ rtl_test
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Detached kernel driver
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 
[R82XX] PLL not locked!
Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode...
lost at least 36 bytes
^CSignal caught, exiting!

User cancel, exiting...
Samples per million lost (minimum): 0
rtlsdr_demod_write_reg failed with -9
r82xx_write: i2c wr failed=-9 reg=06 len=1
Reattached kernel driver


$ rtl_test -t
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Detached kernel driver
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 
[R82XX] PLL not locked!
Sampling at 2048000 S/s.
No E4000 tuner found, aborting.
Reattached kernel driver


Bryan Lee

unread,
Nov 9, 2017, 3:07:55 PM11/9/17
to Gqrx SDR
rtl_power gives no errors, but soapy_power gives the same failure to set frequency.

Again, re-testing on android allows me to scan properly.

Robin Gape

unread,
Nov 9, 2017, 3:19:07 PM11/9/17
to gq...@googlegroups.com

Bryan,

I was writing you a note about rtl_test when Alex got there first.

1) the lines in the output

Using device 0: Generic RTL2832U OEM
Detached kernel driver

and

r82xx_write: i2c wr failed=-9 reg=06 len=1
Reattached kernel driver

are a clue that all is not well. The indication (detached & reattached kernel driver) is that you have not blacklisted the regular kernel modules for an RTL dongle. Most on-line documentation for using an RTL Dongle was written 4 or so years ago, and has lots of stuff that should be ignored in 2017, but quite a lot that still applies. The essence, though, is to set up a udev rule, and to blacklist kernel modules. Try this:

Blacklist kernel module

Generally, Linux will automatically load a kernel module to support the normal operation of an RTL dongle. However, for knockabout SDR use, which repurposes a mode otherwise intended only for VHF and DAB/DAB+, this kernel module must be blocked from loading.

As root, generate a new file: /etc/modprobe.d/no-rtl.conf

Make the contents1 of the file:

# Blacklist RTL driver modules to allow full-range SDR application
# Remove blacklist to restore normal operation, if required
blacklist dvb_usb_rtl28xxu
blacklist dvb_usb_rtl2832u
blacklist dvb_usb_v2
blacklist e4000
blacklist fc0013
blacklist r820t
blacklist rtl2830
blacklist rtl2832
Let me know if you'd like a copy of some fuller instructions, and I'll send it off list.

HTH, 73,

Robin, G8DQX

Bryan Lee

unread,
Nov 9, 2017, 4:00:19 PM11/9/17
to Gqrx SDR
No luck.  I created the file as instructed and rebooted (initially tried to just manually unload the modules with rmmod, but that didn't work).  When I insert the RTL these are my syslog messages:

Nov  9 15:52:42 ZE kernel: [   78.295917] usb 1-5: new high-speed USB device number 5 using xhci_hcd
Nov  9 15:52:42 ZE kernel: [   78.467087] usb 1-5: New USB device found, idVendor=0bda, idProduct=2838
Nov  9 15:52:42 ZE kernel: [   78.467089] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov  9 15:52:42 ZE kernel: [   78.467090] usb 1-5: Product: RTL2838UHIDIR
Nov  9 15:52:42 ZE kernel: [   78.467090] usb 1-5: Manufacturer: Realtek
Nov  9 15:52:42 ZE kernel: [   78.467091] usb 1-5: SerialNumber: 00000001
Nov  9 15:52:42 ZE mtp-probe: checking bus 1, device 5: "/sys/devices/pci0000:00/0000:00:01.1/0000:01:00.0/usb1/1-5"
Nov  9 15:52:42 ZE mtp-probe: bus: 1, device: 5 was not an MTP device


Now when I run GQRX the results are different, but the same error message...

$ gqrx 
linux; GNU C++ version 6.3.0 20170618; Boost_106200; UHD_003.010.002.000-release

gr-osmosdr v0.1.x-xxx-xunknown (0.1.5git) gnuradio 3.7.10
built-in source types: file osmosdr fcd rtl rtl_tcp uhd plutosdr miri hackrf bladerf rfspace airspy soapy redpitaya 
FM demod gain: 3.05577
Resampling audio 96000 -> 48000
IQ DCR alpha: 1.04166e-05
Using audio backend: auto
BookmarksFile is /home/bragon/.config/gqrx/bookmarks.csv
Found Rafael Micro R820T tuner
gr-osmosdr v0.1.x-xxx-xunknown (0.1.5git) gnuradio 3.7.10
built-in source types: file osmosdr fcd rtl rtl_tcp uhd plutosdr miri hackrf bladerf rfspace airspy soapy redpitaya 
Using device #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
[R82XX] PLL not locked!
IQ DCR samp_rate: 1.024e+06
IQ DCR alpha: 9.76562e-07
Changing NB_RX quad rate: 96000 -> 1.024e+06
No change in output device:
  old: 
  new: 
[R82XX] PLL not locked!
IQ DCR samp_rate: 2.4e+06
IQ DCR alpha: 4.16666e-07
Changing NB_RX quad rate: 1.024e+06 -> 2.4e+06

Robin Gape

unread,
Nov 9, 2017, 4:30:52 PM11/9/17
to gq...@googlegroups.com

Bryan,

are you using a udev rule? The line about MTP device relates to digital cameras!

R.

Bryan Lee

unread,
Nov 9, 2017, 5:11:20 PM11/9/17
to Gqrx SDR
This is a brand new fresh install of Ubuntu 17.10.  The only additional udev rules I could find, are the ones that belonged to VirtualBox at /etc/udev/rules.d/

Searching the rules at /lib/udev/rules.d/ the only file that matches the idVendor and idProduct are the rules in 60-librtlsdr0.rules

Alexandru Csete

unread,
Nov 9, 2017, 5:21:40 PM11/9/17
to gq...@googlegroups.com
I think the permissions are fine, otherwise you would get a clear
"access denied" message in the terminal.

The register write error suggests that something is wrong with the
communication to the device. Since the device is working on Android, I
suspect it is the USB port, connector or perhaps a cable. I would try
different port and/or cable. I would also try rtl_fm in scan mode to
see if it gives error while scanning. It is a bit strange that
rtl_power reports no errors.

It would be nice to hear whether anybody else is using my PPA on
Ubuntu 17.10 since I can only test on LTS releases.

Alex
> --
> You received this message because you are subscribed to the Google Groups
> "Gqrx SDR" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to gqrx+uns...@googlegroups.com.
> To post to this group, send email to gq...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gqrx/20a51311-34dc-4275-b0ef-f1c1c91bb127%40googlegroups.com.

Bryan Lee

unread,
Nov 10, 2017, 1:16:48 PM11/10/17
to Gqrx SDR
Switching to a rear port worked.

I have a X399 Gaming Pro Carbon AC motherboard (1.63 BIOS), the front USB connectors are connected to a Cooler Master MasterCase Pro 6 stock front panel.  In this front panel, the tuner would not work.  In the rear panel it would.

Rear Panel USB hub info:
$ sudo lsusb -D /dev/bus/usb/007/001
[sudo] password for bragon: 
Device: ID 1d6b:0002 Linux Foundation 2.0 root hub
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         1 Single TT
  bMaxPacketSize0        64
  idVendor           0x1d6b Linux Foundation
  idProduct          0x0002 2.0 root hub
  bcdDevice            4.13
  iManufacturer           3 Linux 4.13.0-16-generic xhci-hcd
  iProduct                2 xHCI Host Controller
  iSerial                 1 0000:43:00.3
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              12
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             4
  wHubCharacteristic 0x000a
    No power switching (usb 1.0)
    Per-port overcurrent protection
    TT think time 8 FS bits
  bPwrOn2PwrGood       10 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0503 highspeed power enable connect
   Port 2: 0000.0503 highspeed power enable connect
   Port 3: 0000.0100 power
   Port 4: 0000.0503 highspeed power enable connect
Device Status:     0x0001
  Self Powered


The front panel hub
$ sudo lsusb -D /dev/bus/usb/001/001
Device: ID 1d6b:0002 Linux Foundation 2.0 root hub
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         1 Single TT
  bMaxPacketSize0        64
  idVendor           0x1d6b Linux Foundation
  idProduct          0x0002 2.0 root hub
  bcdDevice            4.13
  iManufacturer           3 Linux 4.13.0-16-generic xhci-hcd
  iProduct                2 xHCI Host Controller
  iSerial                 1 0000:01:00.0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              12
Hub Descriptor:
  bLength              11
  bDescriptorType      41
  nNbrPorts            14
  wHubCharacteristic 0x000a
    No power switching (usb 1.0)
    Per-port overcurrent protection
    TT think time 8 FS bits
  bPwrOn2PwrGood       10 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00 0x02
  PortPwrCtrlMask    0xff 0xff
 Hub Port Status:
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
   Port 3: 0000.0100 power
   Port 4: 0000.0100 power
   Port 5: 0000.0503 highspeed power enable connect
   Port 6: 0000.0303 lowspeed power enable connect
   Port 7: 0000.0100 power
   Port 8: 0000.0100 power
   Port 9: 0000.0100 power
   Port 10: 0000.0103 power enable connect
   Port 11: 0000.0100 power
   Port 12: 0000.0100 power
   Port 13: 0000.0503 highspeed power enable connect
   Port 14: 0000.0103 power enable connect
Device Status:     0x0001
  Self Powered


GQRX Would fail to set the frequency no matter which of the two front ports I would plug into. (No idea where the other 12 ports are... internally used perhaps?)

So not sure what's different with the front port's hub, but your fix worked for me.  Thank you, I don't know why I didn't think to try another port.

Robin Gape

unread,
Nov 10, 2017, 2:13:53 PM11/10/17
to gq...@googlegroups.com

Bryan,

glad that you got it sorted. USB can be a minefield, with Linux and other OSes, or so I hear!

A little further research, following my earlier reply, reveals that as of Ubuntu 16.04 LTS no specific configuration is required either in terms of udev rules or blacklisting modules. So any RTL dongle should be plug & play. The required udev rule is installed as part of a library installation, and there is a kernel module rtl2832_sdr that unloads unwanted modules when direct sample (software SDR) mode is requested.

Thus, no more user configuration is required for either normal or direct sample operation, assuming suitably written software, and a competent USB implementation.

Cheers, 73,

Robin, G8DQX

Jeff _

unread,
Aug 26, 2019, 3:18:33 PM8/26/19
to Gqrx SDR
I've got exactly the same problem and error message with Ubuntu 19.04 and a RTL-SDR v3.
Also, I have the same motherboard : I suspect there is and issue with Linux and these ports ; also using the rear ports does not solve anything for me :(
Reply all
Reply to author
Forward
0 new messages