From owner-freebsd-arm@freebsd.org Thu Jan 26 23:41:48 2017 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFF5DCC3D8A for ; Thu, 26 Jan 2017 23:41:48 +0000 (UTC) (envelope-from tony@tndh.net) Received: from express.tndh.net (express.tndh.net [IPv6:2001:470:e930:1240:20d:56ff:fe04:4c0a]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA06D129F; Thu, 26 Jan 2017 23:41:48 +0000 (UTC) (envelope-from tony@tndh.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tndh.net; s=dkim; h=Subject:Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:In-Reply-To:References:To:From; bh=VIgjBSyFaMJOTO80EZ4gW4cZneV5NC0slp0Ft1wPq/M=; b=AXg6kOmEOLJ6ckZHbpIwCo2Z26gA09CF5eNxYkqVQbviVIh1N6/iMU3gSFVoHg5cEucHtTklMjfcWgQ3mbhGEo1wTjMQ+oTqwxGyHs3eLCiwEq+TakdSw8gUKN+7Ts1u1DPgCUe+O/B/OZf8g0Xfau4fP73FvtKTbdl4UcxemnEKZDsQ; Received: from express.tndh.net ([2001:470:e930:1240:20d:56ff:fe04:4c0a] helo=eaglet) by express.tndh.net with esmtp (Exim 4.72 (FreeBSD)) (envelope-from ) id 1cWtfh-000Ccf-CC; Thu, 26 Jan 2017 15:41:47 -0800 From: "Tony Hain" To: "'Ian Lepore'" , References: <03a801d2776e$cae997e0$60bcc7a0$@tndh.net> <1485400906.30533.54.camel@freebsd.org> <03bb01d2779d$45d6edd0$d184c970$@tndh.net> <03c101d277ae$70f142c0$52d3c840$@tndh.net> <1485445768.30533.68.camel@freebsd.org> <040101d27816$3f7547b0$be5fd710$@tndh.net> <1485466405.30533.96.camel@freebsd.org> In-Reply-To: <1485466405.30533.96.camel@freebsd.org> Date: Thu, 26 Jan 2017 15:41:41 -0800 Message-ID: <041a01d2782d$bee11850$3ca348f0$@tndh.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQEImxvIZ6VEPYS1CTeMHuF4SjTdHgFGeuiPAfagOS8BXCmlWAJOLTryAjf7KeUBQ5O/qKKL7BpQ Content-Language: en-us X-SA-Exim-Connect-IP: 2001:470:e930:1240:20d:56ff:fe04:4c0a X-SA-Exim-Mail-From: tony@tndh.net X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on express.tndh.net X-Spam-Level: X-Spam-Status: No, score=-4.2 required=4.5 tests=ALL_TRUSTED,RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Subject: RE: BBB uarts & pps dts definitions X-SA-Exim-Version: 4.2 X-SA-Exim-Scanned: Yes (on express.tndh.net) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 23:41:48 -0000 > -----Original Message----- > From: Ian Lepore [mailto:ian@freebsd.org] > Sent: Thursday, January 26, 2017 1:33 PM > To: Tony Hain; freebsd-arm@freebsd.org > Subject: Re: BBB uarts & pps dts definitions >=20 > On Thu, 2017-01-26 at 12:53 -0800, Tony Hain wrote: > > Ian Lepore wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > snip > > > > > > > > > > > > > > > > > > > > > > Even when it gets built though, the scope shows that the = signal > > > > > is being pulled to ground as soon as the wire is connected to > > > > > P8- 7, so I don't > > > > expect it > > > > > > > > > > > > > > > to work. Is there a way to check the state of the gpio? I = would > > > > > expect something like # gpioctl -N gpio_66 Can't find pin = named > > > > > "gpio_66" > > > > > > > > > > # gpioctl -l > > > > > pin 00: 0=A0=A0=A0=A0=A0=A0=A0gpio_0<> > > > > > pin 01: 0=A0=A0=A0=A0=A0=A0=A0gpio_1<> > > > > > ... > > > > > pin 30: 1=A0=A0=A0=A0=A0=A0=A0gpio_30 > > > > > pin 31: 1=A0=A0=A0=A0=A0=A0=A0gpio_31 > > > > > # > > > > > > > > > > How do the 3 additional pinmux controllers get enabled? > > > > > > > > > > > > > > > > > > > > > > > > > > > > =A0 ./ppsapitest /dev/dmtpps > > > > > > > > > > > > You should get something like: > > > > > > > > > > > > =A0 1485400775 .009578536 204 0 .000000000 0 > > > > > > =A0 1485400776 .009621995 205 0 .000000000 0 > > > > > > =A0 1485400777 .009665453 206 0 .000000000 0 > > > > > > =A0 1485400778 .009708869 207 0 .000000000 0 > > > > > > > > > > > > -- Ian > > > Everything I'm doing is with 12-current, but things shouldn't be > > > very > > different > > > > > > in 11-stable. > > > > > > Pin P8-7 is pin 2 on controller 2, so > > > > > > =A0 gpioctl -f /dev/gpcio2 -l > > > > > > when it's configured correctly it should look like: > > > > > > =A0 pin 02: 0=A0=A0=A0=A0=A0=A0=A0gpio_2<> > > # gpioctl -lv -f /dev/gpioc2 > > pin 00: 1=A0=A0=A0=A0=A0=A0=A0gpio_0, > > > caps: OWN> > > pin 01: 0=A0=A0=A0=A0=A0=A0=A0gpio_1, > > > caps: OWN> > > pin 02: 0=A0=A0=A0=A0=A0=A0=A0gpio_2<>, > > > caps: OWN> > > ... > > > > So it looks like gpioctl defaults to the first controller if none = are > > listed, since=A0=A0gpioctl -lv only shows the first 32. Nothing in = gpioctl > > -h indicates that would be the case, though the framework wiki does > > mention a restriction at 32 in the hint files discussion. Nothing in > > -h, the man page, or the wiki indicates what -t -c or -n do, so I am > > reluctant to try them. I would guess toggle, capabilities, and name, > > but the help and documentation should really be clear about that, = and > > how to set direction. > > >=20 > All good points, but really, gpio has nothing to do with this stuff. Simply trying to figure out how to diagnose the gpio pin, and the ctl = tool is not clear about how to use it. >=20 > > > > > > > > > If you do a verbose boot (in loader, at the prompt do boot -v) do > > > you see > > > these two lines right before the=A0am335x_dmtimer0: line? > > > > > > =A0 ti_pinmux0: setting internal 2a for timer4 > > > =A0 am335x_dmtpps: configured pin P8-7 as input for timer4 > > Booting from disk0s2a: > > /boot/kernel/kernel data=3D0x6d6564+0x145a9c > > syms=3D[0x4+0x7eb30+0x4+0x922fa] > > /boot/kernel/am335x_dmtpps.ko text=3D0x1c60 data=3D0x224+0x8 > > syms=3D[0x4+0x820+0x4+0x742] > > > > loader> boot -v > > > > # dmesg | grep er4 > > ti_pinmux0: setting internal 2a for timer4 > > am335x_dmtpps: configured pin P8-7 as input for timer4 >=20 > Yep, this indicates the config is right, so the problem must be > electrical. >=20 > > am335x_dmtpps0: mem 0x48044000- > > 0x480443ff irq > > 30 on simplebus0 > > Timecounter "DMTimer4" frequency 24000000 Hz quality 1000 > > am335x_dmtpps0: Using DMTimer4 for PPS device /dev/dmtpps > > > > So all that looks as you indicated it should, though I am troubled > > that pin > > 2 is not restricted to IN on the gpioctl listing. It does say > > configured as > > input in dmesg, so it should be doing the right thing. > > >=20 > Pin 2 is not listed as because it's not a gpio pin anymore after > being reconfigured as TIMER4 input. =A0The empty brackets indicate = that > it has been configured as a device pin, not gpio. Ok. That is another point that would be helpful if it were on the wiki. >=20 > > The only thing that comes to mind at this point is some electrical > > restriction about the BBB input, where a 5/3 resistive divider > > (2.2k/3.3k) > > is inadequate, but the fact that the uart is working would tend to > > rule that > > out. Electrically it is acting as though the pin is set to Output at > > 0. > > ...... As I typed that it occurred to me I should really check that > > it is 0, > > and found that there actually is a correct pulse at 60mv. This would > > imply > > that the input impedance of the pin is 26 ohms. The system reference > > manual > > doesn't discuss input impedance that I can find, and search isn't > > turning up > > anything either. Why would the timer pin be different than the uart > > pin on > > the same soc? What are you using to drive your pps? > > > > This is so close, there must be something really trivial that I am > > overlooking... > > > > Tony >=20 > I'm using a 5v->3.3v level shifter right now, but I have in the past > succesfully used resistive dividers. =A0My PPS output device is = designed > to drive 5v into a 50 ohm load, so when using a divider I just try > various values I have handy until my scope says the voltage high level > is somewhere in the 2.8-3.3v range. =A0Usually I use resistance that = adds > up to somewhere between 40-100 ohms when I do that (depends on what > resistors pop out first when I reach into the bag of loosies). >=20 > -- Ian That makes some degree of sense based on what I am seeing, though that = is a very low input impedance on the BBB. I was expecting ~100k. My source is = a 555 on an ancient ttl/RS232 board I built because the 20 us pulse from = the GPS was too fast (between the slew rate of the 3232 and the DCD = detection window on the com port) to go with a simple level conversion. Sounds = like it might be best to do an active 3.3v driver at this point. Tony