Freq Show: Raspberry Pi RTL-SDR Scanner problem

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
mitchsfm
 
Posts: 6
Joined: Fri May 10, 2013 6:14 pm

Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by mitchsfm »

Followed the install instructions, everything appeared to install correctly.

When I try to run:
sudo python freqshow.py
The program exits with the error message:
Kernel driver is active, or device is claimed by second instance of librtlsdr. In the first case, please either detach or blacklist the kernel module (dev_usb_rtl28xxu), or enable automatic detaching at compile time.

usb_claim_interface error 6...

Any suggestions on how can I fix the problem?

Thanks in advance,
Mitch W4OA

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by tdicola »

Thanks for checking out the project! Interesting, the issue you see is that the linux kernel has built in support for the digital TV tuner that RTL-SDR uses, and it conflicts with the RTL-SDR driver. When the RTL-SDR code is compiled there's a special flag passed in (-DDETACH_KERNEL_DRIVER=ON) which should enable it to automatically detach the kernel's digital TV tuner driver that conflicts. However if it's not working for you for some reason let's try manually disabling the driver.

Edit the file /etc/modprobe.d/raspi-blacklist.conf and add this line anywhere in it:

Code: Select all

blacklist dev_usb_rtl28xxu
Save, then reboot the Pi and check if you can run the software now. Let me know if that helps, thanks!

User avatar
mitchsfm
 
Posts: 6
Joined: Fri May 10, 2013 6:14 pm

Re: Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by mitchsfm »

Hey... Just got a chance to check out your suggestion. Modified the /etc/modprobe.d/raspi-blacklist.conf file by adding the suggested line, blacklist dev_usb_rtl28xxu ...

Got the exact same error message. Any other suggestion?

Thanks,
Mitch
(sempra)


User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by tdicola »

Thanks for grabbing the details. Hrm, that is really odd that it's still complaining about the driver conflicting. Just to check is there any other instance of freq show running, or any other RTL SDR tools?

Also can you run this command to list all the loaded kernel modules and grab the output to copy here--let's see if something else might be related and conflicting:

Code: Select all

lsmod


User avatar
mitchsfm
 
Posts: 6
Joined: Fri May 10, 2013 6:14 pm

Re: Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by mitchsfm »

To answer your questions, no other programs running, just a clean boot and run freqshow. No RTL SDR tools running.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by tdicola »

Thanks for grabbing the output of lsmod. It looks like for some reason the digital TV tuner driver is still loaded, even though it should be in the blacklist configuration. Try running these commands to manually unload the tuner (until the next reboot):

Code: Select all

sudo modprobe -r dvb_usb_rt128xxu
sudo modprobe -r dvb_usb_v2
sudo modprobe -r dvb_core
Lets give that a shot to see if it can manually unload the conflicting drivers.

User avatar
mitchsfm
 
Posts: 6
Joined: Fri May 10, 2013 6:14 pm

Re: Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by mitchsfm »

Yes! That did it!!!

Now to find a speaker and play with the software!

Many thanks for a GREAT project,
Mitch W4OA
(sempra)

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by tdicola »

Oh nice, glad you got it working. On reboot you might need to run those commands again to disable the kernel module. You might try updating the blacklist file to list all of those modules that the modprobe command runs, similar to the earlier blacklist file update. Hopefully that will keep them from loading and causing issues. Thanks for checking out the project!

User avatar
fmohammed
 
Posts: 2
Joined: Wed Jun 03, 2015 12:08 am

Re: Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by fmohammed »

I am not sure this is the same or similar issue. I have followed the setup instructions and I even added the running drivers to the blacklist items in the /etc/modprobe.d/raspi-blacklist.conf file. However I have an error,

pi@RaspScan ~/FreqShow $ sudo python freqshow.py
Detached kernel driver
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
rtlsdr_demod_write_reg failed with -1
rtlsdr_demod_read_reg failed with -1
r82xx_write: i2c wr failed=-1 reg=06 len=1
rtlsdr_demod_write_reg failed with -1
rtlsdr_demod_read_reg failed with -4
rtlsdr_write_reg failed with -4
Reattaching kernel driver failed!
Traceback (most recent call last):
File "freqshow.py", line 103, in <module>
fscontroller.current().render(screen)
File "/home/pi/FreqShow/views.py", line 364, in render
self.render_spectrogram(screen.subsurface(spect_rect))
File "/home/pi/FreqShow/views.py", line 461, in render_spectrogram
freqs = self.model.get_data()
File "/home/pi/FreqShow/model.py", line 159, in get_data
samples = self.sdr.read_samples(freqshow.SDR_SAMPLE_SIZE)[0:self.width+2]
File "/usr/local/lib/python2.7/dist-packages/rtlsdr/rtlsdr.py", line 328, in read_samples
raw_data = self.read_bytes(num_bytes)
File "/usr/local/lib/python2.7/dist-packages/rtlsdr/rtlsdr.py", line 312, in read_bytes
% (result, num_bytes))
IOError: Error code -1 when reading 2048 bytes

and I see the drivers in the lsmod.


lsmod:
Module Size Used by
joydev 9745 0
stmpe_ts 4560 0
snd_bcm2835 20924 0
snd_pcm 92398 1 snd_bcm2835
snd_seq 60741 0
snd_seq_device 7194 1 snd_seq
snd_timer 22618 2 snd_pcm,snd_seq
snd 66956 5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
evdev 10819 3
ir_lirc_codec 4952 0
ir_xmp_decoder 2909 0
lirc_dev 10992 1 ir_lirc_codec
ir_mce_kbd_decoder 4290 0
ir_sharp_decoder 2201 0
ir_sanyo_decoder 2425 0
ir_sony_decoder 2206 0
ir_jvc_decoder 2179 0
ir_rc6_decoder 2931 0
ir_nec_decoder 2619 0
ir_rc5_decoder 2251 0
fb_hx8357d 4453 1
r820t 17225 1
dvb_usb_rtl28xxu 17041 0
i2c_bcm2708 6136 0
rtl2830 8144 1 dvb_usb_rtl28xxu
rtl2832 9966 2 dvb_usb_rtl28xxu
spi_bcm2708 8865 0
i2c_mux 2460 1 rtl2832
dvb_usb_v2 15747 1 dvb_usb_rtl28xxu
dvb_core 99727 3 rtl2830,rtl2832,dvb_usb_v2
rc_core 23405 14 ir_sharp_decoder,ir_xmp_decoder,lirc_dev,ir_lirc_codec,dvb_usb_rtl28xxu,ir_rc5_decoder,ir_nec_decoder,ir_sony_decoder,ir_mce_kbd_decoder,ir_jvc_decoder,dvb_usb_v2,ir_rc6_decoder,ir_sanyo_decoder
uio_pdrv_genirq 3653 0
uio 9837 1 uio_pdrv_genirq

Any recommendations would be appreciated.
Regards.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by tdicola »

Hrm that's odd, all of the error messages make me think the RTL-SDR driver code is having trouble communicating with the tuner dongle. One thing to check is to make sure you're powering the Raspberry Pi with a good quality 1-2 amp power supply. The tuner will draw a decent amount of power so if the supply can't keep up with the demand the voltage might drop a bit and cause problems when talking to the tuner.

Also do any of the other RTL-SDR tools work? Like rtl_tune, rtl_test, etc--can see more details on them here: http://sdr.osmocom.org/trac/wiki/rtl-sdr#Usage

User avatar
fmohammed
 
Posts: 2
Joined: Wed Jun 03, 2015 12:08 am

Re: Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by fmohammed »

That was it. I bought a new PSU and everthing works. I guess the old PSU just wasn't good anymore.

Regards.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Freq Show: Raspberry Pi RTL-SDR Scanner problem

Post by tdicola »

Oh good to hear it was just a power issue, thanks for the followup and good luck with the project!

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”