TLeconte / acarsdec

ACARS SDR decoder
329 stars 88 forks source link

Trying to understand Airspy R2 sample rate math #100

Open dlpwx opened 1 year ago

dlpwx commented 1 year ago

Today I switched acarsdec SDR from Airspy Mini to Airspy R2. I was successfully receiving frequencies -s 130.025 ~ ... to 131.725 on Airspy Mini, but on the Airspy R2, I got "Frequencies too far apart" error. These freqs are 1.7 MHz apart. But works fine if I remove freq 131.725 from my config and instead receive 130.025 to 131.550, which is 1.525 MHz apart.

Airspy Mini sample rates: 3.0, 6.0 Airspy R2 sample rates: 2.5, 10.0

Frequency range I'm trying to receive is 131.725 - 130.025 = 1.7 MHz apart 2.5 MHz sample rate on Airspy R2 should enable usable range of around 2.0 MHz (IIUC)

So shouldn't frequencies 1.7 MHz apart work on Airspy R2?

On a hunch I modified air.c to change row 163 Fc=chooseFc(minFc,maxFc,AIRINRATE==5000000); to Fc=chooseFc(minFc,maxFc,AIRINRATE==2500000); recompiled acarsdec and now I'm able to successfully receive acars messages on 130.025 to 131.725 MHz, though gain is maybe a bit less on the low and high end frequencies.

I didn't quite maybe understand all the math going on for sample rates in the code, but I'm wondering if everything is optimal for both Airspy Mini and R2? i.e. there's more to it than I'm understanding?