Date: Thu, 16 Aug 2018 09:42:28 -0300 From: "Dr. Rolf Jansen" <rj@obsigna.com> To: freebsd-arm <freebsd-arm@freebsd.org> Subject: Re: Beaglebone Black pinmuxing Message-ID: <56756FA3-8FD7-44A4-A2D8-054E7C86744B@obsigna.com> In-Reply-To: <13360A40-3381-4AF9-8EC5-C8E9B00CCABD@dons.net.au> References: <13360A40-3381-4AF9-8EC5-C8E9B00CCABD@dons.net.au>
next in thread | previous in thread | raw e-mail | index | archive | help
> Am 15.08.2018 um 23:56 schrieb O'Connor, Daniel <darius@dons.net.au>: >=20 > Hi, > I have a BBB with a GPS engine attached to UART4 (P9_11 - UART4 Rx, = P9_13 - UART4 Tx) but I am having trouble communicating with it. >=20 > I have tried both an overlay and editing the main DTS file directly = but while the UART is probed and attached I can't see any data coming = in, nor see any go out (by putting a 'scope probe on P9_13 while sending = data out cuau2). >=20 > By my reading of the TRM and some googling P9_13 is gpmc_wait0 who's = pinmux offset is 0x870, P9_11 is gpmc_wpn, offset 0x874. The pinmuxes = get 0x800 subtracted from this (based on what is already in the DTS = file) >=20 > This is the overlay source.. > root@generic:/ # cat /boot/dtb/overlays/am335x-beaglebone-uart4a.dtso > /dts-v1/; > /plugin/; >=20 > / { > compatible =3D "ti,am335x-bone-black", "ti,am335x-bone", = "ti,am33xx"; >=20 > fragment@1 { > target =3D <&uart4>; > __overlay__ { > status =3D "okay"; > pinctrl-names =3D "default"; > pinctrl-0 =3D < > 0x074 0x06 // = gpmc_wpn.uart4_txd_mux2 -> mode 6 > 0x070 0x2e // = gpmc_wait0.uart4_rxd_mux2 -> mode 6 >> ; > }; > }; > }; >=20 > Compiled with.. > dtc -@ -I dts -O dtb -o am335x-beaglebone-uart4a.dtbo = am335x-beaglebone-uart4a.dtso > And I put this in loader.conf > fdt_overlays=3D"am335x-beaglebone-uart4a" Hello, Only recently I need to pass over all the very same obstacles as you = need to do now, in order to get a DAC-I2C module enabled and working on = my BBB. In my case, the curial point was to get the pinmuxing straight = and correctly linked to the respective I2C node. My BeableBone Black is = running on FreeBSD 12-ALPHA1. Note, there are major differences in the = DT between 11 and 12, and therefore depending on your FreeBSD version = the following hints may not fully apply. 1. The overlay needs 2 fragments, one for the pinmuxing node and another one for node which would use the pins 2. The overlay must contain a __local_fixups__ section, because this will let the dtbo loader to link the custom pinmux correctly to your customized node 3. I am almost sure, that MODE6 is incorrect in your case, however, I am ready to learn otherwise. I looked up the modes for my project in the Database of Pins of the bonescript project on GitHup (which is maintained by one of the BBB developers): https://github.com/jadonk/bonescript/ P9_13 starts on line 1271 of the bone.js file: https://github.com/jadonk/bonescript/blob/master/src/bone.js#L1271 P9_11 starts on line 1226 of the bone.js file: https://github.com/jadonk/bonescript/blob/master/src/bone.js#L1226 AFAIK, the field options contains the array of pinmux modes, starting at 0. MODE6 is NA in the case of P9_13 and urat4_rxd in the case of P9_11. You said, you need gpmc_wpn and gpmc_wait0 respectively, and this would be MODE0 for both pins. 4. In order to find out the input/output flags, I consulted the file: = https://svnweb.freebsd.org/base/head/sys/gnu/dts/include/dt-bindings/pinct= rl/am33xx.h?view=3Dco Now, I guess, that P9_13 would be simply PIN_OUTPUT, which means flag = 0x00, and P19_11 would be PIN_INPUT =3D =3D (INPUT_EN | PULL_DISABLE) =3D =3D ((1 << 5)| (1 << 3)) =3D 0x28 Said all this, I suggest to try the following overlay - note, I am = definitely not the authoritative expert: /dts-v1/; /plugin/; / { compatible =3D "ti,am335x-bone-black", "ti,am335x-bone", = "ti,am33xx"; exclusive-use =3D "P9.11","P9.13","uart4"; fragment@0 { target =3D <&am33xx_pinmux>; __overlay__ { gpmc_uart4_pins: pinmux_gpmc_uart4_pins { pinctrl-single,pins =3D < 0x74 0x00 /* UART4_TXD, = PIN_OUTPUT | MODE0 */ 0x70 0x28 /* UART4_RXD, = PIN_INPUT | MODE0 */ >; }; }; }; fragment@1 { target =3D <&uart4>; __overlay__ { status =3D "okay"; pinctrl-names =3D "default"; pinctrl-0 =3D <&gpmc_uart4_pins>; }; }; __local_fixups__ { fragment@1 { __overlay__ { pinctrl-0 =3D <0x0>; }; }; }; }; Best regards Rolf=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56756FA3-8FD7-44A4-A2D8-054E7C86744B>