[PATCH] RTL-SDR: Fix regression in FC00012 tuner startup (needs testing on FC2580)

David Kozub zub at linux.fjfi.cvut.cz
Mon Feb 5 12:41:46 UTC 2018

On Sun, 4 Feb 2018, David Basden wrote:

> This patch fixes a regression of rtl-sdr dongles with the FC00012 tuner.    
> The code to switch on the FC00012 tuner by pulling it's ~RESET line
> low ended up with an off-by-one error in a refactor a long time ago,
> The FC00012 only continued to work by accident as a different bug in
> rtlsdr_set_gpio_output had a side-effect of pulling low the FC00012's
> ~RESET line
> When the rtl_set_gpio_output bug was fixed in ba64a7459a43 the side-
> effect also went away, leaving the FC00012 tuner in reset, and failing
> to be detected (or indeed work at all).
> This patch fixes the original off-by-one error.  It's been tested
> on an FC00012 in a GTek T803 from both warm and cold starts, but needs testing on the FC2580 as both the FC00012 and FC2580 are brought out of reset by a GPIO off the RTL (at least in some
> designs). If the FC2580 actually uses a different pin, this code will also break.  (I'm only going from vague memory that the FC2580 used the same pin.)

Hi David,

I ran into the same issue and already submitted a patch 
but it seems nobody was interested in integrating it. I wasn't the first 
to run into this either: 

I see we reached the same conclusions and the patches are also very 
similar. The one difference is that you also do:

> @@ -1581,7 +1581,7 @@ int rtlsdr_open(rtlsdr_dev_t **out_dev, uint32_t index)
>   reg = rtlsdr_i2c_read_reg(dev, FC0012_I2C_ADDR, FC0012_CHECK_ADDR);
>   if (reg == FC0012_CHECK_VAL) {
>   fprintf(stderr, "Found Fitipower FC0012 tuner\n");
> - rtlsdr_set_gpio_output(dev, 6);
> + rtlsdr_set_gpio_output(dev, 5);
>   dev->tuner_type = RTLSDR_TUNER_FC0012;
>   goto found;
>   }

What is the purpose of this change? I see GPIO 6 is used in 

int fc0012_set_freq(void *dev, uint32_t freq) {
         /* select V-band/U-band filter */
         rtlsdr_set_gpio_bit(dev, 6, (freq > 300000000) ? 1 : 0);
         return fc0012_set_params(dev, freq, 6000000);

so I think we need to set GPIO 6 to output mode.

Best regards,

More information about the osmocom-sdr mailing list