From owner-freebsd-arm@FreeBSD.ORG Sat Feb 28 18:43:32 2015 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B3956C99 for ; Sat, 28 Feb 2015 18:43:32 +0000 (UTC) Received: from mail-wg0-x22e.google.com (mail-wg0-x22e.google.com [IPv6:2a00:1450:400c:c00::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 43F079B6 for ; Sat, 28 Feb 2015 18:43:32 +0000 (UTC) Received: by wgha1 with SMTP id a1so26134374wgh.12 for ; Sat, 28 Feb 2015 10:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=kALT3ByZHoiXLKAn7G1fOL27eq3KXbBfMm4fgCvIuT8=; b=nblGP0PW4Wjp8T56gzu/gUDwN4dUdJcXP5h+oyBIliY/01ME9gMTO8aA2wxEblWYUU Y6kDt1CC/qrhLn0MFu17iwj/i2Kmy2l7Nk2o6EhAmWV2H8HmcC7LLiCaJPbSt27MlIBb Wx3kjIzr3affd7ZM8pQNr0YUqwlIWM7BR9Sd35ZYgx5pvVCt1M+6gWJrwf2a5SSMgR0W +UyqxAU+MeXLllTuoIrf3R8XQrFvJ3oL0DiAlPnu3EsjhbfHIs4Ilqz/588eONS5FSLB Ed+ktEoKKA++H9boK6QqTFqis/GJSLqM1DnQO6BHisltHwnC8v7D0rIC4nCJoYTVtlbi 4WwA== MIME-Version: 1.0 X-Received: by 10.180.92.71 with SMTP id ck7mr7335694wib.48.1425149010631; Sat, 28 Feb 2015 10:43:30 -0800 (PST) Received: by 10.180.195.99 with HTTP; Sat, 28 Feb 2015 10:43:30 -0800 (PST) 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> Date: Sat, 28 Feb 2015 15:43:30 -0300 Message-ID: Subject: Re: Raspberry Pi with PiTFT - some GPIO weirdness From: Luiz Otavio O Souza To: Milan Obuch Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-arm@freebsd.org" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Feb 2015 18:43:32 -0000 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 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'), 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