<div dir="ltr">(Caveat: I don't have a FC0012 and I'm mostly guessing at the meaning of the GPIO registers here..)<div class="gmail_extra"><br><div class="gmail_quote">On 7 November 2017 at 18:38, David Kozub <span dir="ltr"><<a href="mailto:zub@linux.fjfi.cvut.cz" target="_blank">zub@linux.fjfi.cvut.cz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I added some traces and I see the values after plugging in the tuner, just after the call rtlsdr_set_i2c_repeater(dev, 1) in rtlsdr_open, are:<br>
<br>
GPD = 0x06<br>
GPOE = 0x19<br>
GPO = 0x18<br>
<br>
so in my understanding initially:<br>
* GPIOs 1 and 2 are set to INPUT<br>
* GPIOs 0, 3 and 4 are set to OUTPUT<br>
* output GPIOs 3 and 4 are set to 1, GPIO 0 is set to 0<br></blockquote><div><br></div><div>I read those values as:</div><div><br></div><div>GPD ("direction"): pins 1,2 inputs, others outputs</div><div>GPO ("output"): outputs 3,4 high, others low</div><div>GPOE ("output enable"): output drivers for pins 0,3,4 enabled</div><div><br></div><div>i.e.</div><div><br></div><div>pin 0: driven low</div><div>pin 1, pin 2: inputs</div><div>pin 3: driven high</div><div>pin 4: driven high</div><div>pin 5, pin 6, pin 7: high impedance</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
With the code before the GPIO fix (ba64a745) the call rtlsdr_set_gpio_output(dev, 5) read GPD and set its value to GPO while dropping the 5-th bit from the GPD value. So it assigs the value 6 to GPO. This sets all output GPIOs to 0: GPIOs 3 and 4 are dropped to 0. Then it sets GPOE to the previous value of GPOE plus the 5th bit, so it sets GPIO 5 to output and its output value is 0 because of the previous write.</blockquote><div><br></div><div>So now we have:</div><div><br></div><div><div>pin 0: driven low</div><div>pin 1, pin 2: inputs</div><div>pin 3: driven low</div><div>pin 4: driven low</div><div>pin 5: driven low</div><div>pin 6, pin 7: high impedance</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I don't know where does the value 5 come from. Is it possible some other dongles have the tuner at GPIO 5? Or is it really supposed to be GPIO 4 and it worked with 5 by accident - by pulling GPIO 4 to 0 accidentally?<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
A friend of mine looked at the PCB of the dongle I'm using and he found out that GPIO 4 seems to be connected - via a transistor - to the TC0012. GPIO 5 didn't seem to be connected - at least not in an obvious way - to the tuner. I have to say this was just a quick look, so we could have missed things.<br>
<br>
Also, as there's a transistor in between... could it be that GPIO 4 is not really tuner reset, but tuner power? But this would be rather philosophical point. Either way, from my tests, GPIO 4 has to be set to 0 for the tuner to be reachable.<br></blockquote><div><br></div><div>"Working by accident" seems fairly plausible given that you didn't have any luck regardless of what you did with GPIO 5. It seems like it has to be either GPIO 3 or 4, and if your PCB works with 4 then that's a strong argument.</div><div><br></div><div>Oliver</div><div><br></div></div></div></div>