Questions about r82xx driver narrowband tuning and filter register configuration

Hi all,

I’m reading and porting the r82xx driver from rtl-sdr and have run into some questions regarding narrowband tuning. I am trying to use an R820T2 / R860 for narrowband tuning, hopefully, with a bandwidth within 1 MHz.

In tuner_r82xx.c, the following code configures the IF filters:

	} else {
		reg_0a = 0x00;
		reg_0b = 0x80;
		priv->int_freq = 2300000;

		if (bw > r82xx_if_low_pass_bw_table[0] + FILT_HP_BW1) {
			bw -= FILT_HP_BW2;
			priv->int_freq += FILT_HP_BW2;
			real_bw += FILT_HP_BW2;
		} else {
			reg_0b |= 0x20;
		}

		if (bw > r82xx_if_low_pass_bw_table[0]) {
			bw -= FILT_HP_BW1;
			priv->int_freq += FILT_HP_BW1;
			real_bw += FILT_HP_BW1;
		} else {
			reg_0b |= 0x40;
		}

		// find low-pass filter
		for(i = 0; i < ARRAY_SIZE(r82xx_if_low_pass_bw_table); ++i) {
			if (bw > r82xx_if_low_pass_bw_table[i])
				break;
		}
		--i;
		reg_0b |= 15 - i;
		real_bw += r82xx_if_low_pass_bw_table[i];

		priv->int_freq -= real_bw / 2;
	}

Meanwhile, the register datasheet describes 0x0A and 0x0B as follows:

Reg R/W Bitmap Symbol Description
R10 0x0A R/W [7] PWD_FILT Filter power on/off.
0: channel filter off,
1: on
R/W [6:5] PW_FILT[1:0] Filter power control.
00: highest power,
11: lowest power
R/W [3:0] FILT_CODE[3:0] Filter (In R860 ds, Low pass Filter) bandwidth manual fine tune.
0000: Widest,
1111: narrowest
R11 0x0B R/W [6:5] FILT_BW Filter (In R860 ds, Low pass Filter) bandwidth manual coarse tune
00: widest
10 or 01: middle
11: narrowest
R/W [3:0] HPF[3:0] High pass filter corner control
0000: highest
1111: lowest

Questions:

  1. What exactly is r82xx_if_low_pass_bw_table? Why does the driver use it to decide 0x0B?

  2. 0x0B[3:0] (HPF[3:0]) has 16 possible values, so why does r82xx_if_low_pass_bw_table only have 10 entries?

  3. 0x0A is never modified in this path. Including bits [6:5] (PW_FILT[1:0]), [3:0] (FILT_CODE[3:0]), and even [7] (PWD_FILT). Is this intentional? Shouldn’t these be configured for narrowband operation?

  4. During my porting, I noticed that signals about 1 MHz below int_freq are not being filtered out, which seems odd given the filter settings.

Thanks in advance

I think the only people capable of answering the questions you raise are the authors of the driver, who sadly - as far as I know - are not active here on discourse. You might want to try the osmocom-sdr mailing list and Cc’ign the authors.