TLeconte / acarsdec

ACARS SDR decoder
329 stars 88 forks source link

Wrong sample rate for RTL-SDR (R820T) #20

Closed E3V3A closed 7 years ago

E3V3A commented 7 years ago

Two problems here:

  1. Wrong sample rate. The RTL-SDR (820T2) max stable sample rate is: 2.4 MS/s (USB 2.0)
  2. There should be an app exit when provided with frequencies that are separated more than 2 MHz.
 # ./acarsdec -v -o 2 -p 1 -r 0 131.525 131.550 131.725 131.850 136.750 136.900

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

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain : 49.600000
Frequencies too far apart
Set center freq. to -1Hz
[R82XX] PLL not locked!
Exact sample rate is: 2500000.107620 Hz
[R82XX] PLL not locked!
Decoding 6 channels
E3V3A commented 7 years ago

To fix issue 1.

To get correct sample rates replace this:

#define RTLMULT 200
#define RTLINRATE (INTRATE*RTLMULT)

with:

//#define RTLMULT 200   // 2.5000 Ms/s
#define RTLMULT 192 // 2.4000 Ms/s
//#define RTLMULT 160   // 2.0000 Ms/s
//#define RTLMULT 144   // 1.8000 Ms/s
#define RTLINRATE (INTRATE*RTLMULT)

This seem especially important when running on Linux distro in a VM. However, according to superkuh:

The highest safe sample rate is 2.56 MS/s but in some situations [usb3] up to 3.2 MS/s works without USB dropping samples (RTL2832U drops them internally).

See this

TLeconte commented 7 years ago

ok will add theses comments in rtl.c and in README