Dygear
Posts: 19
Joined: Wed Jul 01, 2015 1:50 am

Raspberry Pi 4 USB Power Issues? RTL-SDRs

Fri Jun 28, 2019 5:55 pm

When trying to use an RTL SDR I'm getting the following error rtlsdr_write_reg failed with -7. -7 according to it’s value within libusb_error enum is LIBUSB_ERROR_TIMEOUT. I’ve been told that -6 (LIBUSB_ERROR_BUSY) is due to a lack of power on the USB Bus, perhaps that’s the same problem here? But that seems very unlikely given that this Pi is meant to have a lot more power delivery capability towards the USB ports. I’ve had it plugged into the USB 3.0 ports and the USB 2.0 ports both resulting in the same error. I’m also using the official Raspberry Pi 4 USB-C power adaptor, so it should be able to fully power the unit, regardless of load CPU load state of USB peripheral count. But to be sure, I removed everything but the RTL and then SSH’d into the Pi4B. Still no luck.

As a sanity check, I plugged the dongles that didn’t work on the rPi4B into a rPi3B+, both are running up to date versions of Raspbian Buster as of about 1 hour prior to this post. I went though the install test from Raspberry Pi Stretch Install process that I wrote for the trunk_recorder wiki. Installed all dependencies and compiled all of the software from the last master versions on their official public git repositories. And … It works completely fine on the rPi3B+, but not the rPi4B. I’m at a loss as to what to do next? A powered USB Hub, I guess. At least I can rule that out …

Anyone have have other ideas that I haven't presented?

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2073
Joined: Thu Jul 11, 2013 2:37 pm

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Fri Jun 28, 2019 7:22 pm

We've seen this during testing. The set of commands sent to the device to put it into raw streaming mode sometimes stalls and for some reason the host controller doesn't respond with the correct endpoint state to the host driver; or there's a race between the command submission and completions returned by the driver.

Oddly, you can get it to work about 25% of the time - which implies a software race rather than hardware bugginess.
Rockets are loud.
https://astro-pi.org

Dygear
Posts: 19
Joined: Wed Jul 01, 2015 1:50 am

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Fri Jun 28, 2019 7:36 pm

That rules out the rPi4B as a software defined radio then, at least until the software is fixed. I'm using it to capture emergency traffic for most of the ambulance corps in the county that I live and giving them access to the audio feed to better respond to emergency assignments. Good thing the rPi3B+ is going to be around for at least another 4 years.

wren
Posts: 66
Joined: Mon May 28, 2018 9:06 pm

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Fri Jun 28, 2019 7:40 pm

I noticed this too while trying to get GQRX up and running. I was gonna try my Elonics 4000 and no USB extension today, but I guess you've ruled that out.
I have a Pi 4 with 4GB RAM and the R820T2 tuner plugged into USB3 port. Keyboard and mouse were the only other things plugged in.

Dygear
Posts: 19
Joined: Wed Jul 01, 2015 1:50 am

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Fri Jun 28, 2019 7:46 pm

wren wrote:
Fri Jun 28, 2019 7:40 pm
I noticed this too while trying to get GQRX up and running. I was gonna try my Elonics 4000 and no USB extension today, but I guess you've ruled that out.
I have a Pi 4 with 4GB RAM and the R820T2 tuner plugged into USB3 port. Keyboard and mouse were the only other things plugged in.
I'm using the NESDR Nano 3 plugged directly into the USB3 port on the rPi4B-2GB. Works perfect on the rPi3B+ with the same software stack (rPi3B+ Buster vs rPi4B Buster). So if there is a software problem, it's specific to the rPi4B's implementation of that code path.

wren
Posts: 66
Joined: Mon May 28, 2018 9:06 pm

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Fri Jun 28, 2019 7:50 pm

I will try my USRP at some point to see if it works, but I'm not very hopeful. Hopefully this can be fixed soon.

User avatar
jbeale
Posts: 3476
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Fri Jun 28, 2019 8:22 pm

jdb wrote:
Fri Jun 28, 2019 7:22 pm
The set of commands sent to the device to put it into raw streaming mode sometimes stalls and for some reason the host controller doesn't respond with the correct endpoint state to the host driver; or there's a race between the command submission and completions returned by the driver.
If there's a software race condition, consider the fact that 1) the Pi4 ARM cores are faster and 2) the USB hardware itself is different and I presume, more efficient and faster due to not having the relatively large interrupt overhead that the USB2 subsystem in the Pi3 and all earlier models did. Could it be that the Pi4 is able to send and respond to USB setup data *too fast* and the RTL-SDR gets locked up when a command comes before it's ready to act on it?

Just my uninformed speculation- if the same RTL-SDR unit works fine with other, faster machines than the Pi4, then this probably isn't it.

Dygear
Posts: 19
Joined: Wed Jul 01, 2015 1:50 am

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Fri Jun 28, 2019 10:19 pm

wren wrote:
Fri Jun 28, 2019 7:50 pm
I will try my USRP at some point to see if it works, but I'm not very hopeful. Hopefully this can be fixed soon.
Good point. I have a HackRF laying around. So I used that and it works just fine. AND IT'S FREAKING FAST! Well ... The first time it was. Haven't been able to get it to work a next time.

Feek
Posts: 3
Joined: Tue May 02, 2017 10:56 am

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Sun Jun 30, 2019 7:03 am

I'm pretty sure it's not a power issue. I've had a USB power meter in line with the RTL-SDR while trying to make this work with little success and the voltage has never dropped below a fraction under 5.1 volts. This is using an official RPi PSU.

I've used four different RTL-SDR dongles and out of at least fifty different attempts, have had a partial success (ie it was recognised by rtl_test) just once so it's not quite a 25% success rate. When I ran the test a second time, it failed.

Same symptoms as originally posted in this thread.

It works perfectly well on a Pi3B with Buster, it's just the Pi4 that doesn't work.

wren
Posts: 66
Joined: Mon May 28, 2018 9:06 pm

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Sun Jun 30, 2019 9:22 pm

I have no idea why, at this point, but the Terratec T Stick PLUS Elonics E4000 tuner seems to work every time I've tested it. Rafael Micro R820T2 has issues, which must still be Pi4 related because it works fine on my Pi3 and PC.

Dygear
Posts: 19
Joined: Wed Jul 01, 2015 1:50 am

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Sun Jun 30, 2019 10:30 pm

wren wrote:
Sun Jun 30, 2019 9:22 pm
I have no idea why, at this point, but the Terratec T Stick PLUS Elonics E4000 tuner seems to work every time I've tested it. Rafael Micro R820T2 has issues, which must still be Pi4 related because it works fine on my Pi3 and PC.
It's super odd that the E4000 would work fine every time. What about your USRP, how did that work on the 4? Given that I'm still having trouble with the HackRF working (Although, it did work for me ... once.) given that it happens more often on the Pi4 side than Pi3 side, I still think we need a software patch from the Foundation.

wren
Posts: 66
Joined: Mon May 28, 2018 9:06 pm

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Mon Jul 01, 2019 12:31 am

Dygear wrote:
Sun Jun 30, 2019 10:30 pm
wren wrote:
Sun Jun 30, 2019 9:22 pm
I have no idea why, at this point, but the Terratec T Stick PLUS Elonics E4000 tuner seems to work every time I've tested it. Rafael Micro R820T2 has issues, which must still be Pi4 related because it works fine on my Pi3 and PC.
It's super odd that the E4000 would work fine every time. What about your USRP, how did that work on the 4? Given that I'm still having trouble with the HackRF working (Although, it did work for me ... once.) given that it happens more often on the Pi4 side than Pi3 side, I still think we need a software patch from the Foundation.
It works on my B100, but I have to back it off to 500ksps input to keep the audio smooth. It chokes on GQRX at 8Msps. I'll have to try 16Msps in GNURadio Companion as GQRX doesn't support 8bit samples.
Image

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2073
Joined: Thu Jul 11, 2013 2:37 pm

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Wed Jul 10, 2019 3:47 pm

https://github.com/raspberrypi/linux/is ... -510107304

The bug has been identified - the VLI chip is doing a bad thing. Dunno how to go about fixing it yet - I need to better understand the mechanisms used in the driver before I can make an informed change to cope with the hardware brokenness.
Rockets are loud.
https://astro-pi.org

leshniak
Posts: 4
Joined: Wed Jul 10, 2019 6:44 pm

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Thu Jul 11, 2019 6:47 pm

I've just compiled a new kernel from this pull request https://github.com/raspberrypi/linux/pull/3066 . No issues on tvheadend so far. I hope this fix will be merged into the next kernel release.

Dygear
Posts: 19
Joined: Wed Jul 01, 2015 1:50 am

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Tue Jul 23, 2019 3:14 am

I just did a firmware upgrade on my rPi4/4GB and now rtl_test works flawlessly. Excellent job!

Wow, I can even capture at 3.2Msps with GQRX and the 8192 @ 30fps waterfall. Doesn't get too hot while doing that too in an open case with an ambient temperature of 17C. CPU load is up at 70% but the system with the full GUI interface is still VERY useable.

MACH1SCJ
Posts: 3
Joined: Thu Jul 25, 2019 1:37 am
Location: Earth

Re: Raspberry Pi 4 USB Power Issues? RTL-SDRs

Sun Jul 28, 2019 7:25 am

The firmware seemed to help but I am still getting some USB error codes with RTL-SDR.

I thought it was related to https://github.com/raspberrypi/linux/issues/3060 .. -510107304 with a fix here https://github.com/raspberrypi/linux/pull/3066

Code: Select all

dmesg 
reports the following errors

Code: Select all

3.442204]usb 1-1.2.4: device descriptor read/64, error -32]   (this error is reported 4 times)

 .......... brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio f or chip BCM4345/6  (this error is reported twice)

........... brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Feb 27 2018 03:15:32 version 7.45.154 (r684107 CY) FWID 01-4fbe0b04

 5.431771] usb 1-1.2.4: device not accepting address 11, error -71

5.971798] usb 1-1.2.4: device not accepting address 12, error -71

 5.974424] usb 1-1.2-port4: unable to enumerate USB device
Pi Model 4B V1.1
Raspberry Pi reference 2019-07-10
buster V. 10

Linux version 4.19.59-v7l+ ([email protected]) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1246 SMP Tue Jul 23 19:25:04 BST 2019

update 7-28-19

Code: Select all

rtl_test
will run once with a few lost bytes.

Code: Select all

Ctrlz 
to exit.
Allocating 15 zero-copy buffers
lost at least 108 bytes
^Z
[3]+ Stopped rtl_test

Code: Select all

 $ ps
PID TTY TIME CMD
3944 pts/0 00:00:00 bash
4367 pts/0 00:00:00 rtl_test
5037 pts/0 00:00:00 ps

looks like it is still running rtl_test ??????

from task manager "kill"

Code: Select all

$ ps
PID TTY TIME CMD
3944 pts/0 00:00:00 bash
5060 pts/0 00:00:00 ps
[1]- Killed rtl_test

Code: Select all

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

Using device 0: Generic RTL2832U OEM
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...
Allocating 15 zero-copy buffers
lost at least 160 bytes
lost at least 294 bytes
lost at least 166 bytes

Code: Select all

Ctrlc
User cancel, exiting...
Samples per million lost (minimum): 3

SNICKERDOODLES!! I guess thats it. Its nice to get lucky sometimes.

Code: Select all

Ctrlz 
only stops the run and does not unload where

Code: Select all

Ctrlc 
exits correctly.

perhaps this will help someone else?

I still might have error messages -----maybe its normal for what I have plugged in. Will test more & update
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable


lsusb -v https://pastebin.com/rDQggkze
Loose nut behind the wheel. Watch out!

Return to “Troubleshooting”