From f388a3f9d9168860b544dd753efc1dedd2ae50f4 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Thu, 26 Jan 2017 18:26:46 -0700 Subject: [PATCH] For anti-aliasing, the baseband filter bandwidth is automatically set to the widest available setting that is no more than 75% of the sample rate. This happens every time the sample rate is set. If you want to override the baseband filter selection, you must do so after setting the sample rate. --- host/libhackrf/src/hackrf.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/host/libhackrf/src/hackrf.c b/host/libhackrf/src/hackrf.c index b308cda6..1ff55195 100644 --- a/host/libhackrf/src/hackrf.c +++ b/host/libhackrf/src/hackrf.c @@ -1109,6 +1109,11 @@ typedef struct { } set_fracrate_params_t; +/* + * You should probably use hackrf_set_sample_rate() below instead of this + * function. They both result in automatic baseband filter selection as + * described below. + */ int ADDCALL hackrf_set_sample_rate_manual(hackrf_device* device, const uint32_t freq_hz, uint32_t divider) { @@ -1135,10 +1140,17 @@ int ADDCALL hackrf_set_sample_rate_manual(hackrf_device* device, { return HACKRF_ERROR_LIBUSB; } else { - return HACKRF_SUCCESS; + return hackrf_set_baseband_filter_bandwidth(device, + hackrf_compute_baseband_filter_bw((uint32_t)(0.75*freq_hz/divider))); } } +/* + * For anti-aliasing, the baseband filter bandwidth is automatically set to the + * widest available setting that is no more than 75% of the sample rate. This + * happens every time the sample rate is set. If you want to override the + * baseband filter selection, you must do so after setting the sample rate. + */ int ADDCALL hackrf_set_sample_rate(hackrf_device* device, const double freq) { const int MAX_N = 32;