Patching rtl_fm for use with 15+ RTL-SDR Dongles

Enrique is working on a project which would record FM audio as MP3 files. To do this he uses rtl_fm with several RTL-SDR dongles. However, a major roadblock was that he found that adding five or more dongles to his server resulted in all dongles with a USB index over 3 producing the error “Failed to submit transfer 4!”.

After trying to work around the problem with Docker and VMs and ultimately failing he decided to look into other solutions. He found that rtl_test had an option to force synced output, and with this option enabled he was able to use more than four dongles. So he ended up implementing that synchronization code into rtl_fm.

With that code implemented he is now able to run up to 15 dongles on a single server. A higher amount might still be possible, but Enrique did not have that many dongles to test.

If you’ve been experiencing this problem Enrique has uploaded a patched version of rtl_fm at https://github.com/niofis/rtl-sdr.

Update: On Keenerds branch he’s rejected a merge of this patch citing the following:

Synchronous mode doesn’t work. Rtl_fm used to use synchronous mode. It produced constant minor glitches that made data decoding impossible. Don’t use it.

The whole “many simultaneous dongles” problem is a well-known issue related to LibUSB. All you need to do is reduce the DEFAULT_BUF_NUMBER in librtlsdr.c and recompile.

15 instances of rtl_fm running
15 instances of rtl_fm running
Subscribe
Notify of
guest

9 Comments
Inline Feedbacks
View all comments
frank haynes

Running all cores at 100%

We need an update on how many fires this caused.

Anonymous

Ok I’m going to ask the obvious:
Why don’t you just use an SDRPlay which provides plenty enough bandwidth, and a bunch of of VFOs?

Bertie

The FM broadcast band in most countries is 87.5 to 108 MHz, You would need at least three SDRplay devices to cover that much bandwidth. Where as you could buy 15 RTL-SDR devices, with 3-5 USB hubs for less than the price of one SDRplay with shipping included.

Tim

Or replace every 3 RTL-SDR’s by one Airspy Mini and pay less for better performance. Only one USB hub.

Bertie

Is performance at FM critical, maybe spend more on better antennas. It would cost less than three SDRplay devices but you would need to NOT use USB hubs. A hub might work at 3MSPS (~12MB/sec per mini device), but not at 6MSPS (~24MB/sec per mini device).

I was initially thinking about the really really really cheap rtl-sdr devices @ €7/$7/£7 (from aliexpress) which actually have do have a genuine R820T2 in them. But the construction is relatively poor and they WILL overheat and glitch if powered on 24/365. But tripling the price to get high quality does make the Airspy minis start to look more attractive. But you could also buy 15 high quality RTL-SDR Blog dongles $19.95 each. You might even be able to negotiate a bulk discount.

Tim

For high performance FM, you definitely need better antennas and of course you need more dynamic range to match in the receiver side.

Anonymous

https://github.com/steve-m/librtlsdr/issues/34
it seems that the library supports only 4 parallel transmitting dongles at the moment. If the fifth dongle is added and started to transfer data, e.g. rtl_test -d 4, the error message appears:
“Failed to submit transfer 3!”
“Library error -5, exiting…”

The issue is that the Kernel limits the maximum size of all buffers that libusb can allocate to 16MB by default. In order to disable the limit, you have to run the following command as root:

echo 0 > /sys/module/usbcore/parameters/usbfs_memory_mb

Bogdan

Recording FM? Why? What’s so interesting?

Truth

I can see historical uses (like recordings of the Hindenburg disaster – https://www.youtube.com/watch?v=CgWHbpMVQ1U ). But I would also see major legal and licensing issues.