How long is a while? Your simple test code has been running on my RPi3 for about 10 minutes without a problem.

Anywhere from a few minutes to several hours. The longest I've had to wait was about 10 hours, the average is probably about 3 hours. Sometimes I think it takes longer to go wrong if there's no antenna connected, but I'm not sure about that.

How are you building your app? I'm using this simple Makefile...

g++ -o PiBug PiBug.cpp -lmirsdrapi-rsp

Press '1' when running top to see the individual core load. On my system your test app takes 50% on one core.

It's consistently using about 32% on my Pi3. Usually on one core, but occasionally split across two.

Have you tried a different USB cable? Or different USB port? Are you using a port sharing hub? If so, connect directly to see if that's the problem.

I'm connected directly to a port on the RPi, and not using a hub. I will try using a different cable and port. I /am/ writing data to a USB thumb drive -- I'll stop doing that too and see whether it makes any difference.

I noticed that you never terminate correctly. You need to capture ctrl-C for example and perform a StreamUninit();

Thank you... yes, I do need to do that. I was trying to keep the example code as simple as possible, though.

Progress report: the problem still occurs with no USB stick in use (or plugged in), and with the RSP1 connected to a different USB port. I'm currently testing with a different USB cable.

Other things I can try are using a different physical RPi3, and using an RSP2 instead (I've got one of those too).

Just a quick thought: given that your RPi seems to be busier than mine (you report 50% rather than the 32% I see), are you possibly running a debug/unoptimised version of the API? Might this make a difference?

My RSP2 seems to work just fine with the test program on the RPi3. I ran it for 32 hours without seeing a single problem.

Reverting to the RSP1 (but keeping everything else -- RPi, USB cable, Antenna, test executable -- identical), the problem is still there: after running for a while the API starts writing many tens of thousands of 'Gap=' debug messages (I truncated the log at 100,000 lines to avoid filling the SD card, so I don't know whether it would eventually have stopped).

Just in case, I swapped the RPi3 itself for a spare, and for good measure did a software update (apt-get update; apt-get dist-upgrade). No difference: the problem is still present on the RSP1.

I'm happy to send you the full log files if you like, but this bulletin board won't let me attach them because it says the zip file is too large (it's 1.3 MB).

I'm starting to wonder whether my RSP1 is faulty? I'm struggling to think of other reasons why this problem would reproduce so readily for me, and not for you.

I don't know: I eventually found a formula which worked reliably enough.

Rather than using one of the non-zero-IF modes, I use zero-IF with 4xdecimation and tune so the signal I want is off centre to avoid the DC spike. That didn't completely eliminate the problem, but it did then take several days rather than several hours to happen. So I also perform a mir_sdr_StreamUninit()/mir_sdr_StreamInit() sequence every midnight too, and I haven't seen the problem since.