From 8a3547e71e83f5412311563c970edfe79e3bd0ec Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Sun, 14 Nov 2021 12:05:29 -0700 Subject: [PATCH] hackrf_sweep: improve -w (bin_width) guidance --- host/hackrf-tools/src/hackrf_sweep.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/host/hackrf-tools/src/hackrf_sweep.c b/host/hackrf-tools/src/hackrf_sweep.c index 98d10f0b..76310357 100644 --- a/host/hackrf-tools/src/hackrf_sweep.c +++ b/host/hackrf-tools/src/hackrf_sweep.c @@ -349,7 +349,7 @@ static void usage() { fprintf(stderr, "\t[-p antenna_enable] # Antenna port power, 1=Enable, 0=Disable\n"); fprintf(stderr, "\t[-l gain_db] # RX LNA (IF) gain, 0-40dB, 8dB steps\n"); fprintf(stderr, "\t[-g gain_db] # RX VGA (baseband) gain, 0-62dB, 2dB steps\n"); - fprintf(stderr, "\t[-w bin_width] # FFT bin width (frequency resolution) in Hz\n"); + fprintf(stderr, "\t[-w bin_width] # FFT bin width (frequency resolution) in Hz, 2444-5000000\n"); fprintf(stderr, "\t[-1] # one shot mode\n"); fprintf(stderr, "\t[-N num_sweeps] # Number of sweeps to perform\n"); fprintf(stderr, "\t[-B] # binary output\n"); @@ -529,15 +529,25 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } + /* + * The FFT bin width must be no more than a quarter of the sample rate + * for interleaved mode. With our fixed sample rate of 20 Msps, that + * results in a maximum bin width of 5000000 Hz. + */ if(4 > fftSize) { fprintf(stderr, - "argument error: FFT bin width (-w) must be no more than one quarter the sample rate\n"); + "argument error: FFT bin width (-w) must be no more than 5000000\n"); return EXIT_FAILURE; } + /* + * The maximum number of FFT bins we support is equal to the number of + * samples in a block. With our fixed sample rate of 20 Msps, that + * results in a minimum bin width of 2444 Hz. + */ if(8184 < fftSize) { fprintf(stderr, - "argument error: FFT bin width (-w) too small, resulted in more than 8184 FFT bins\n"); + "argument error: FFT bin width (-w) must be no less than 2444\n"); return EXIT_FAILURE; }