Beaglebone Black pinmuxing

Dr. Rolf Jansen rj at obsigna.com
Thu Aug 16 12:42:42 UTC 2018


> Am 15.08.2018 um 23:56 schrieb O'Connor, Daniel <darius at dons.net.au>:
> 
> 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.
> 
> 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).
> 
> 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)
> 
> This is the overlay source..
> root at generic:/ # cat /boot/dtb/overlays/am335x-beaglebone-uart4a.dtso
> /dts-v1/;
> /plugin/;
> 
> / {
>        compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
> 
>        fragment at 1 {
>                target = <&uart4>;
>                __overlay__ {
>                        status = "okay";
>                        pinctrl-names = "default";
>                        pinctrl-0 = <
>                                        0x074 0x06      // gpmc_wpn.uart4_txd_mux2 -> mode 6
>                                        0x070 0x2e      // gpmc_wait0.uart4_rxd_mux2 -> mode 6
>> ;
>                };
>        };
> };
> 
> 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="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/pinctrl/am33xx.h?view=co

   Now, I guess, that P9_13 would be simply PIN_OUTPUT, which means flag 0x00,
   and P19_11 would be PIN_INPUT =
     = (INPUT_EN | PULL_DISABLE) =
     = ((1 << 5)| (1 << 3))
     = 0x28

Said all this, I suggest to try the following overlay - note, I am definitely not the authoritative expert:

/dts-v1/;
/plugin/;

/ {
	compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";

	exclusive-use = "P9.11","P9.13","uart4";

	fragment at 0 {
		target = <&am33xx_pinmux>;
		__overlay__ {
			gpmc_uart4_pins: pinmux_gpmc_uart4_pins {
				pinctrl-single,pins = <
					0x74 0x00	/* UART4_TXD, PIN_OUTPUT | MODE0 */
					0x70 0x28	/* UART4_RXD, PIN_INPUT  | MODE0 */
				>;
			};
		};
	};

	fragment at 1 {
		target = <&uart4>;
		__overlay__ {
			status = "okay";
			pinctrl-names = "default";
			pinctrl-0 = <&gpmc_uart4_pins>;
		};
	};

	__local_fixups__ {
		fragment at 1 {
			__overlay__ {
				pinctrl-0 = <0x0>;
			};
		};
	};
};

Best regards

Rolf


More information about the freebsd-arm mailing list