device-tree on BeagleBone Black (enabling UART)

Ian Lepore ian at freebsd.org
Mon Feb 8 20:41:45 UTC 2021


On Sun, 2021-02-07 at 00:58 +0100, Kristoff wrote:
> Hi all,
> 
> 
> I was pointed to this mailing-list by the FreeBSD "stand" at fosdem.
> 
> 
> I am running FreeBSD 12.1 on a beaglebone black. As I want to use it
> for 
> a time-server (i.e. connect it to a GPS), I want to enable an
> additional 
> UART (and also a pps gpio-pin, I guess).
> 
> 
> I have been trying to create a DTS-overlay file for this, but for
> some 
> reason, I do not get this OK.
> 
> 
> The overlay file (see below) I use is below.
> 
> Some remarks:
> - I compile the blob with dtc, copy the file to /boot/DTB and modify 
> /boot/loader.conf
> I guess this is correct?
> 
> - when I do "ofwdump -a -p", I see that UART1_pins exists, but no
> UART1.
> 
> - while searching the web, I found multiple posts about this. What I 
> have noticed is that in quite a lot of them, in the DTS file the
> pinmux 
> for the UART has the TX pins first followed by the RX pin.
> However, looking the output of ofwdump, that seams to have the RX
> pin 
> first. (at least for UART0, which does seams to work)
> 
> So am I correct to assume that the pinmux must have the RX pin
> 
> 
> Can somebody shed some light on this?
> 
> Any feedback would be welcome.
> As far as I see, enabling an UART using the Device-tree should be
> quite 
> simple, so I do not understand why I cannot get this to work.
> 
> 
> --- cut here --- cut here --- cut here --- cut here --- cut here ---
> cut 
> here --- cut here --- cut here ---
> /dts-v1/;
> /plugin/;
> 
> / {
>          compatible = "ti,am335x-bone-black", "ti,am335x-bone",
> "ti,am33xx";
> 
>          fragment at 0 {
>                  target = <&am33xx_pinmux>;
>                  __overlay__ {
>                          uart1_pins: pinmux_uart1_pins {
>                                  pinctrl-single,pins = <
>                                      0x180 0x25 /* P9.26 
> uart1_rxd.uart1_rxd MODE5 INPUT (RX) */
>                                      0x184 0x05 /* P9.24 
> uart1_txd.uart1_txd MODE5 OUTPUT (TX) */
>                                  >;
>                    };
>                  };
>          };
> 
>          fragment at 1 {
>                  target = <&uart1>;
>                  __overlay__ {
>                                                          status =
> "okay";
> pinctrl-names = "default";
>                                                          pinctrl-0 = 
> <&uart1_pins>;
>                  };
>          };
> };
> 
> 
> --- cut here --- cut here --- cut here --- cut here --- cut here ---
> cut 
> here --- cut here --- cut here ---
> 
> 
> 
> Cheerio! Kr. Bonne.
> 

The beaglebone has a special pps driver that uses the am335x chip's
timer hardware to measure the pps pulse time with better accuracy than
the generic gpio-pps driver.  To use it, add 

  am335x_dmtpps_load=YES

to your /boot/loader.conf, and use this overlay to set up the pps pin:

/dts-v1/;
/plugin/;

#include <dt-bindings/pinctrl/am33xx.h>

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

&am33xx_pinmux {
        timer4_pins: timer4_pins {
                pinctrl-single,pins = <
                        AM33XX_IOPAD(0x890, (PIN_INPUT | MUX_MODE2))  /* timer4 */
                >;
        };
};

&timer4 {
        pinctrl-names = "default";
        pinctrl-0 = <&timer4_pins>;
        status = "okay";
};

-- Ian




More information about the freebsd-arm mailing list