Date: Sat, 28 Feb 2015 15:43:30 -0300 From: Luiz Otavio O Souza <lists.br@gmail.com> To: Milan Obuch <freebsd-arm@dino.sk> Cc: "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org> Subject: Re: Raspberry Pi with PiTFT - some GPIO weirdness Message-ID: <CAB=2f8wv9X%2B-=AwBf-_6-Pzc49icWU7KV%2BU0t_qr=uX45BjbXw@mail.gmail.com> In-Reply-To: <20150228142424.6fed0ecf@zeta.dino.sk> References: <20150228111852.15affe31@zeta.dino.sk> <20150228193658.6c872779@B85M-HD3-0.alogt.com> <20150228142424.6fed0ecf@zeta.dino.sk>
index | next in thread | previous in thread | raw e-mail
On 28 February 2015 at 10:24, Milan Obuch wrote:
> On Sat, 28 Feb 2015 19:36:58 +0800
> Erich Dollansky wrote:
>
>> Hi,
>>
>> On Sat, 28 Feb 2015 11:18:52 +0100
>> Milan Obuch <freebsd-arm@dino.sk> wrote:
>>
>> > today I found some time to play a bit with my little display
>> > attached to Rasoberry Pi, and I decided to test buttons connected
>> > to GPIO, as this should work on FreeBSD already. According docs,
>> > buttons are connected to GPIO lines 23, 22, 21 and 18, leftmost
>> > first.
>> >
>> > Using basic 'gpioctl -f /dev/gpioc0 -lv' command I found only first
>> > one, on line 23, reacts. It has value 1 normally and 0 when pressed.
>> >
>> you must setup the pins as inputs first before using them as inputs. I
>> would not rely on any defaults.
>>
>> Erich
>
> According available docs, all GPIO are set to input mode after reset.
> This seems not to be the case, but that's not my point. What was a bit
> of surprise for me was even 'gpioctl -f /dev/gpioc0 -l' tells those
> pins are in input mode ('pin nn<IN>'), it did not work. And fact that
> even after power disconnect the state remains the same is even more
> weird.
>
> Anyway, I accept the necessity for setup, the question is, where should
> these setup instruction go.
>
> Regards,
> Milan
The GPIO driver do not touch the pin settings at boot, there are a few
things like the LAN reset (GPIO pin 6) where we hope the loader is
doing the right thing.
Only a few drivers are checking and making sure that the pins they use
have the right settings at boot.
What I see from PiTFT schematics is that the push buttons doesn't have
any pull-ups resistors, so it must rely on RPi settings.
Please try the following (set the pin as input with pull-up enabled):
gpioctl -c 18 in pu
gpioctl -c 21 in pu # or 27 for rev. 2
gpioctl -c 22 in pu
gpioctl -c 23 in pu
HTH,
Luiz
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAB=2f8wv9X%2B-=AwBf-_6-Pzc49icWU7KV%2BU0t_qr=uX45BjbXw>
