[PATCH] Revert "lib: fix direction bit in GPIO code"

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-sdr@lists.osmocom.org/.

Oliver Jowett oliver.jowett at gmail.com
Fri Oct 27 17:44:45 UTC 2017


The original commit fixes configuring the direction of the GPIO pins on the
2832 so it actually works. The FC0012 failure is probably a side-effect of
the direction bits now really being set.

The tuner initialization does this:

rtlsdr_set_gpio_output(dev, 5); /* should set GPIO 5 to output mode, but
actually does not touch the direction bits and instead turns on GPIO output
5 */
rtlsdr_set_gpio_bit(dev, 5, 1);   /* turns on GPIO 5 output */
rtlsdr_set_gpio_bit(dev, 5, 0);   /* turns off GPIO 5 output */

I don't know the reset state of the 2832 offhand but assuming GPIO 5 is not
set as an output on reset, then that tuner reset was doing nothing much
before the GPIO fix.
Maybe the FC0012 takes a while to settle after a reset, so when it really
gets reset the detection immediately afterwards fails. You could try
commenting out those three lines and see if anything changes.

Oliver


On 27 October 2017 at 18:13, Marcus Müller <mueller at kit.edu> wrote:

> Hi Sylvain,
>
> I'd love to, but I honestly don't even have the symptom (whatever that is)
> of what this commit fixes. Admittedly, I'd assume myself that maybe I just
> haven't looked hard enough for a symptom, but if you'd have insight on what
> the fact that the register was wrong effects, then I'd be thankful!
>
> I really just observe that this commit breaks something, and that I
> haven't been able to find out what out fixes :(
>
> Cheers
> Marcus
>
>
> On 27 October 2017 6:09:18 PM GMT+02:00, Sylvain Munaut <246tnt at gmail.com>
> wrote:
>>
>> That commit might break something but it still looks like the right thing to do.
>> This is just a symptom of another underlying problem. Find that
>> problem and fix it.
>>
>>
>> On Fri, Oct 27, 2017 at 5:03 PM, Marcus Müller <mueller at kit.edu> wrote:
>>
>>>  This reverts commit ba64a7459a43652354990855176a7d8dad5b9d54.
>>>
>>>  The mentioned commit leads to nonfunctionality of Fitipower FC0012
>>>  dongles (tested by a small horde of students) and doesn't increase
>>>  functionality on my "RTL-SDR.com" branded R820T-based dongle.
>>>  ---
>>>   src/librtlsdr.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>>  diff --git a/src/librtlsdr.c b/src/librtlsdr.c
>>>  index b369a5d..6c079a5 100644
>>>  --- a/src/librtlsdr.c
>>>  +++ b/src/librtlsdr.c
>>>  @@ -570,7 +570,7 @@ void rtlsdr_set_gpio_output(rtlsdr_dev_t *dev, uint8_t gpio)
>>>          gpio = 1 << gpio;
>>>
>>>          r = rtlsdr_read_reg(dev, SYSB, GPD, 1);
>>>  -       rtlsdr_write_reg(dev, SYSB, GPD, r & ~gpio, 1);
>>>  +       rtlsdr_write_reg(dev, SYSB, GPO, r & ~gpio, 1);
>>>          r = rtlsdr_read_reg(dev, SYSB, GPOE, 1);
>>>          rtlsdr_write_reg(dev, SYSB, GPOE, r | gpio, 1);
>>>   }
>>>  --
>>>  2.13.6
>>
>>
>>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/osmocom-sdr/attachments/20171027/9af7e5fe/attachment.htm>


More information about the osmocom-sdr mailing list