# Beaglebone UART 1 (p9-24,26) and 4 (p9-11,13)



## comarius (Sep 12, 2019)

Hello,
I want to enable the uart 1 and 4 on a beaglebone.
I can see so far:


```
grep -E '^(sio|uart)[0-9]' < /var/run/dmesg.boot
uart0: <TI UART (16550 compatible)> mem 0-0xfff irq 13 on ti_sysc2
uart0: console (115384,n,8,1)


root@generic:/home/freebsd # ls /dev/tty*
/dev/ttyU0    /dev/ttyU0.init    /dev/ttyU0.lock    /dev/ttyu0    /dev/ttyu0.init    /dev/ttyu0.lock
root@generic:/home/freebsd #
```

The gpio's for the PINS are well up and configured.


```
P_9 11 and 13
pin 30:    1    gpio_30<IN,PU>, caps:<IN,OUT,PU,PD,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN>
pin 31:    1    gpio_31<IN,PU>, caps:<IN,OUT,PU,PD,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN>

P_9 15 and 14
pin 24:    0    gpio_24<>, caps:<IN,OUT,PU,PD,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN>
pin 25:    0    gpio_25<>, caps:<IN,OUT,PU,PD,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN>
```

How do I configure the P_9 pins as UART ? On Linux I can use


```
config-pin p9.11 uart
    config-pin p9.13 uart
```

Is there in freeBSD a similar command.
Where I can check which dtbos are loaded. the boot/ folder has so many files.
Which one is the good one to add new dtbos and where to put the compiled dts files.
Thank you.


----------



## Phishfry (Sep 12, 2019)

comarius said:


> Where I can check which dtbos are loaded.


There is a facility to see what the device tree has. It does not specifically show the overlays but the whole device tree.
`ofw -dump`


----------



## comarius (Sep 12, 2019)

Phishfry said:


> There is a facility to see what the device tree has. It does not specifically show the overlays but the whole device tree.
> `ofw -dump`




```
[freebsd@generic /]$ sudo ofwdump -a | grep uart
              Node 0x4d74: pinmux_uart0_pins
[freebsd@generic /]$
```

I decompiled the am335x-boneblack.dts
and the uarts are there...


```
[freebsd@generic /home/freebsd/dtb]$ cat ./am335x-boneblack.dts  | grep uart
                    ti,hwmods = "uart1";
                        compatible = "ti,am3352-uart", "ti,omap3-uart";
                            pinmux_uart0_pins {
                    ti,hwmods = "uart2";
                        compatible = "ti,am3352-uart", "ti,omap3-uart";
                    ti,hwmods = "uart3";
                        compatible = "ti,am3352-uart", "ti,omap3-uart";
                    ti,hwmods = "uart4";
                        compatible = "ti,am3352-uart", "ti,omap3-uart";
                    ti,hwmods = "uart5";
                        compatible = "ti,am3352-uart", "ti,omap3-uart";
                    ti,hwmods = "uart6";
                        compatible = "ti,am3352-uart", "ti,omap3-uart";
        uart5 = "/ocp/interconnect@48000000/segment@100000/target-module@aa000/serial@0";
        uart4 = "/ocp/interconnect@48000000/segment@100000/target-module@a8000/serial@0";
        uart3 = "/ocp/interconnect@48000000/segment@100000/target-module@a6000/serial@0";
        uart2 = "/ocp/interconnect@48000000/segment@0/target-module@24000/serial@0";
        uart1 = "/ocp/interconnect@48000000/segment@0/target-module@22000/serial@0";
        uart0_pins = "/ocp/interconnect@44c00000/segment@200000/target-module@10000/scm@0/pinmux@800/pinmux_uart0_pins";
        uart0 = "/ocp/interconnect@44c00000/segment@200000/target-module@9000/serial@0";
```

How do I know the boot loads the /am335x-boneblack.dtb ?

Thank you


----------



## comarius (Sep 12, 2019)

comarius said:


> ```
> [freebsd@generic /]$ sudo ofwdump -a | grep uart
> Node 0x4d74: pinmux_uart0_pins
> [freebsd@generic /]$
> ...


Hi,
I guess I found it . uart 1 2 3 4 are marked disabled. I changed them okay. let's see. work in progress...

I put them okay and recompiled the dts into dtb, I did not work.

I had a look at








						bes-dtb-rebuilder/src/arm at master · hendersa/bes-dtb-rebuilder
					

Beagle Entertainment System device tree builder for 3.14-ti kernel - bes-dtb-rebuilder/src/arm at master · hendersa/bes-dtb-rebuilder




					github.com
				



brought over the tty dtsi files, included them in the main dts
like they did in linux.
and follow this https://theunemployablekoder.wordpr...t4-on-the-beaglebone-black-and-debian-jessie/
Still no UART's except 0


----------



## comarius (Sep 12, 2019)

I rolled back the include mode uart. and did in the am335x-boneblack.dts  following changes.
Enabled 1 and 4 under the @ from the line
at module's


```
target-module@a8000/

target-module@22000
```

Like:


```
[freebsd@generic /home/freebsd/dtb]$ diff ./am335x-boneblack-old.dts ./am335x-boneblack.dts -U10
--- ./am335x-boneblack-old.dts    2019-09-12 15:59:58.321986000 -0400
+++ ./am335x-boneblack.dts    2019-09-12 17:07:18.441328000 -0400
@@ -1,12 +1,13 @@
 /dts-v1/;
 
+
 /  {
 
     compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
     interrupt-parent = <0xc4>;
     #address-cells = <0x1>;
     #size-cells = <0x1>;
     model = "TI AM335x BeagleBone Black";
     chosen {
 
         stdout-path = "/ocp/interconnect@44c00000/segment@200000/target-module@9000/serial@0";
@@ -910,21 +911,21 @@
                     clock-names = "fck";
                     #address-cells = <0x1>;
                     #size-cells = <0x1>;
                     ranges = <0x0 0x9000 0x1000>;
                     serial@0 {
 
                         compatible = "ti,am3352-uart", "ti,omap3-uart";
                         clock-frequency = <0x2dc6c00>;
                         reg = <0x0 0x1000>;
                         interrupts = <0x48>;
-                        status = "okay";
+                        status = "disabled";
                         dmas = <0xc5 0x1a 0x0 0xc5 0x1b 0x0>;
                         dma-names = "tx", "rx";
                         pinctrl-names = "default";
                         pinctrl-0 = <0x69>;
                         phandle = <0x54>;
                     };
                 };
                 target-module@b000 {
 
                     compatible = "ti,sysc-omap2", "ti,sysc";
@@ -1541,21 +1542,21 @@
                     clock-names = "fck";
                     #address-cells = <0x1>;
                     #size-cells = <0x1>;
                     ranges = <0x0 0x22000 0x1000>;
                     serial@0 {
 
                         compatible = "ti,am3352-uart", "ti,omap3-uart";
                         clock-frequency = <0x2dc6c00>;
                         reg = <0x0 0x2000>;
                         interrupts = <0x49>;
-                        status = "disabled";
+                        status = "okay";
                         dmas = <0xc5 0x1c 0x0 0xc5 0x1d 0x0>;
                         dma-names = "tx", "rx";
                         phandle = <0x8c>;
                     };
                 };
                 target-module@24000 {
 
                     compatible = "ti,sysc-omap2", "ti,sysc";
                     ti,hwmods = "uart3";
                     reg = <0x24050 0x4 0x24054 0x4 0x24058 0x4>;
@@ -2158,26 +2159,25 @@
                     reg = <0xa8050 0x4 0xa8054 0x4 0xa8058 0x4>;
                     reg-names = "rev", "sysc", "syss";
                     ti,sysc-mask = <0x7>;
                     ti,sysc-sidle = <0x0 0x1 0x2 0x3>;
                     clocks = <0x3f 0x40 0x0>;
                     clock-names = "fck";
                     #address-cells = <0x1>;
                     #size-cells = <0x1>;
                     ranges = <0x0 0xa8000 0x1000>;
                     serial@0 {
-
                         compatible = "ti,am3352-uart", "ti,omap3-uart";
                         clock-frequency = <0x2dc6c00>;
                         reg = <0x0 0x2000>;
                         interrupts = <0x2d>;
-                        status = "disabled";
+                        status = "okay";
                         phandle = <0xa9>;
                     };
                 };
                 target-module@aa000 {
 
                     compatible = "ti,sysc-omap2", "ti,sysc";
                     ti,hwmods = "uart6";
                     reg = <0xaa050 0x4 0xaa054 0x4 0xaa058 0x4>;
                     reg-names = "rev", "sysc", "syss";
                     ti,sysc-mask = <0x7>;
```

I still don't get the UART's



```
uart0: <TI UART (16550 compatible)> mem 0-0xfff irq 13 on ti_sysc2
uart0: console (115384,n,8,1)
```

Any help would be indeed appreciated.


----------



## comarius (Sep 13, 2019)

Actually does this kernel on BBB loades the dtbs from boot/dtv/* folder ?
FreeBSD generic 13.0-CURRENT FreeBSD 13.0-CURRENT r351363 GENERIC  ar


----------



## Phishfry (Sep 13, 2019)

Have you tried using any UART overlays?








						bb.org-overlays/BB-UART1-00A0.dts at master · beagleboard/bb.org-overlays
					

Device Tree Overlays for bb.org boards. Contribute to beagleboard/bb.org-overlays development by creating an account on GitHub.




					github.com


----------



## comarius (Sep 13, 2019)

Hi,
I am investigating why I get this.



```
Using DTB provided by EFI at 0x87ee8000.
Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...
Using DTB provided by EFI at 0x87ee8000.
Loading DTB overlays: 'am335x-boneblack.dtb,pwm.dtbo'
/boot/dtb/am335x-boneblack.dtb size=0x140b5
/boot/dtb/pwm.dtbo size=0x5fc
Kernel entry at 0x97000180...
Kernel args: (null)
applying DTB overlay '/boot/dtb/am335x-boneblack.dtb'
failed to apply overlay: FDT_ERR_BADOVERLAY   <------------------------------- ???
DTB overlay '/boot/dtb/pwm.dtbo' not compatible <-------------------------------- ???
---<<BOOT>>---
```


----------



## comarius (Sep 13, 2019)

NOT RESOLVED​I used the 2018 image ,  though the only one that loads the dtb's without errors. 


```
FreeBSD beaglebone 11.3-RELEASE FreeBSD 11.3-RELEASE #0 r349754: Fri Jul  5 03:41:31 UTC 2019     root@releng2.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/BEAGLEBONE  arm
```

and here is the patch file generated from prev dts and current dtb applied


```
oot@beaglebone:/home/freebsd/dtb # diff am335x-boneblack-original.dts am335x-boneblack.dts -A5 -B5
diff: invalid option -- A
diff: Try `diff --help' for more information.
root@beaglebone:/home/freebsd/dtb # diff am335x-boneblack-original.dts am335x-boneblack.dts -U5
--- am335x-boneblack-original.dts       2019-07-05 05:41:32.905063000 +0000
+++ am335x-boneblack.dts        2019-07-05 05:33:56.290736000 +0000
@@ -1187,11 +1187,11 @@
                        compatible = "ti,am3352-uart", "ti,omap3-uart";
                        ti,hwmods = "uart2";
                        clock-frequency = <0x2dc6c00>;
                        reg = <0x48022000 0x2000>;
                        interrupts = <0x49>;
-                       status = "disabled";
+                       status = "okay";
                        dmas = <0x29 0x1c 0x0 0x29 0x1d 0x0>;
                        dma-names = "tx", "rx";
                        linux,phandle = <0x84>;
                        phandle = <0x84>;
                };
@@ -1224,11 +1224,11 @@
                        compatible = "ti,am3352-uart", "ti,omap3-uart";
                        ti,hwmods = "uart5";
                        clock-frequency = <0x2dc6c00>;
                        reg = <0x481a8000 0x2000>;
                        interrupts = <0x2d>;
-                       status = "disabled";
+                       status = "okay";
                        linux,phandle = <0x87>;
                        phandle = <0x87>;
                };

                serial@481aa000 {
```

And I have 3 uarts now.


```
root@beaglebone:/dev # dmesg |grep uart
uart0: <TI UART (16550 compatible)> mem 0x44e09000-0x44e0afff irq 11 on simplebus0
uart0: console (115384,n,8,1)
uart1: <TI UART (16550 compatible)> mem 0x48022000-0x48023fff irq 12 on simplebus0
uart2: <TI UART (16550 compatible)> mem 0x481a8000-0x481a9fff irq 15 on simplebus0


/dev/ttyU0.init /dev/ttyu0      /dev/ttyu0.lock /dev/ttyu1.init /dev/ttyu2      /dev/ttyu2.lock
root@beaglebone:/dev # ls -l /dev/tt*
crw-------  1 root  wheel  0x50 Jul  5 05:40 /dev/ttyU0
crw-------  1 root  wheel  0x53 Jul  5 05:40 /dev/ttyU0.init
crw-------  1 root  wheel  0x54 Jul  5 05:40 /dev/ttyU0.lock
crw-------  1 root  tty    0x26 Jul  5 05:47 /dev/ttyu0
crw-------  1 root  wheel  0x27 Jul  5 05:39 /dev/ttyu0.init
crw-------  1 root  wheel  0x28 Jul  5 05:39 /dev/ttyu0.lock
crw-------  1 root  wheel  0x2c Jul  5 05:39 /dev/ttyu1
crw-------  1 root  wheel  0x2d Jul  5 05:39 /dev/ttyu1.init
crw-------  1 root  wheel  0x2e Jul  5 05:39 /dev/ttyu1.lock
crw-------  1 root  wheel  0x32 Jul  5 05:39 /dev/ttyu2
crw-------  1 root  wheel  0x33 Jul  5 05:39 /dev/ttyu2.init
crw-------  1 root  wheel  0x34 Jul  5 05:39 /dev/ttyu2.lock
```

The ports are there in kernel, but I cannot communicate on any of them.
I wired the RX to TX configured the speed wit stty. 

Echoing in /dev/cuau#   does not goes to /dev/tty* neither as echo.

Any help would be appreciated.


----------



## comarius (Sep 13, 2019)

Hello,

I got this far and I am stuck.

 I have the UARTS on the /dev


```
freebsd@beaglebone:~/gpioctl % dmesg | grep uart
uart0: <TI UART (16550 compatible)> mem 0x44e09000-0x44e0afff irq 11 on simplebus0
uart0: console (115384,n,8,1)
uart1: <TI UART (16550 compatible)> mem 0x48022000-0x48023fff irq 12 on simplebus0
uart2: <TI UART (16550 compatible)> mem 0x48024000-0x48025fff irq 13 on simplebus0
uart3: <TI UART (16550 compatible)> mem 0x481a6000-0x481a7fff irq 14 on simplebus0
uart4: <TI UART (16550 compatible)> mem 0x481a8000-0x481a9fff irq 15 on simplebus0
```

It looks like I have to mux them up, but the gpioctl utility
does not have like the Linux pin_config flag for  UART.

I am looking at the gpioctl.c and  https://nxmnpg.lemoda.net/3/gpio_pin_pulsate all supported flags are, and there isno flag to mux it on UART. Thank you


```
static struct flag_desc gpio_flags[] = {
        { "IN", GPIO_PIN_INPUT },
        { "OUT", GPIO_PIN_OUTPUT },
        { "OD", GPIO_PIN_OPENDRAIN },
        { "PP", GPIO_PIN_PUSHPULL },
        { "TS", GPIO_PIN_TRISTATE },
        { "PU", GPIO_PIN_PULLUP },
        { "PD", GPIO_PIN_PULLDOWN },
        { "II", GPIO_PIN_INVIN },
        { "IO", GPIO_PIN_INVOUT },
        { "PULSE", GPIO_PIN_PULSATE },
        { NULL, 0 },
};
```

Anyone knows any work around. Thx


----------



## aragats (Sep 13, 2019)

I've never tried muxing in runtime, IMO it's much easier to do in a .DTB to configure them at boot.
By the way, in most cases Linux .DTS files can be compiled in FreeBSD and perfectly work.


----------



## comarius (Sep 14, 2019)

Thank you.
...cool to know . i'll get the dts from a debian build.

Done, they gracefully failed to load. Wit  ha mix of overlays I get

so far...


```
uart0: <TI UART (16550 compatible)> mem 0x44e09000-0x44e0afff irq 11 on simplebus0
uart0: console (115384,n,8,1)
uart1: <TI UART (16550 compatible)> mem 0x48022000-0x48023fff irq 12 on simplebus0
uart2: <TI UART (16550 compatible)> mem 0x48024000-0x48025fff irq 13 on simplebus0
uart3: <TI UART (16550 compatible)> mem 0x481a6000-0x481a7fff irq 14 on simplebus0
uart4: <TI UART (16550 compatible)> mem 0x481a8000-0x481a9fff irq 15 on simplebus0
```


But strapping TX-RX on all pins I cannot get an echo back.


```
stty: /dev/cuau0: Device busy
speed 9600 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
    brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab0 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
    lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
    status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
speed 9600 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
    brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab0 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
    lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
    status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
speed 9600 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
    brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab0 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
    lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
    status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
speed 9600 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
    brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab0 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
    lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
    status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
-------------------------------------------------------------
speed 115384 baud; 33 rows; 146 columns;
lflags: -icanon isig -iexten -echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
    -extproc
iflags: -istrip icrnl inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
    brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab3 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = <undef>; eof = <undef>; eol = <undef>;
    eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
    lnext = <undef>; min = 1; quit = ^\; reprint = <undef>;
    start = ^Q; status = <undef>; stop = ^S; susp = <undef>;
    time = 0; werase = <undef>;
speed 9600 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
    brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab0 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
    lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
    status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
speed 9600 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
    brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab0 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
    lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
    status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
speed 9600 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
    brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab0 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
    lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
    status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
speed 9600 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
    brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab0 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
    lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
    status = ^T; stop
```


They look good but they dont work.... What is going on....


----------



## comarius (Sep 16, 2019)

comarius said:


> Hi,
> I guess I found it . uart 1 2 3 4 are marked disabled. I changed them okay. let's see. work in progress...
> 
> I put them okay and recompiled the dts into dtb, I did not work.
> ...



Followed ad literam the
https://theunemployablekoder.wordpr...t4-on-the-beaglebone-black-and-debian-jessie/

Same thing. I hooked an arduino serial blaster @9600 to uart1 (p915 p914),
and trying to cat /dev/tty*  or /dev/cuau* and same thing, no outputs,

Though the 'Nelson' am dtb tree compiles and loads without errors to freeBSD11.
Ill try them in 13 and get back soon.
...

I tried   'https://github.com/RobertCNelson/dtb-rebuilder.git' on freeBSD13 for beaglebone and is worst. Looks like is ignoring the dtb folder alltogether.

I am going back on 11 and fight my battle there...


----------



## comarius (Sep 17, 2019)

*RESOLVED* *I GOT UART4* working. Getting uart 1  is simple now.
========================================================
I looked in several links and posts at nabble and I got it.
Does not work in freeBSD 12 and freeBSD 13
Works fine on freeBSD 11

Here is the patch file diff from the version of the freeBSD listed at the end of the patch.


```
freebsd@beaglebone:~/dtb % diff -u am335x-boneblack-original.dts.orig /boot/dtb/am335x-boneblack.dts
--- am335x-boneblack-original.dts.orig    2019-07-05 05:41:32.905063000 +0000
+++ /boot/dtb/am335x-boneblack.dts    2019-09-17 03:08:26.704636000 +0000
@@ -812,6 +812,15 @@
                         phandle = <0x2d>;
                     };

+
+                    pinmux_uart4_pins {
+                        pinctrl-single,pins = <0x070 0x2e 0x074 0x06>;
+                        linux,phandle = <0xce>;
+                        phandle = <0xce>;
+                        };
+
+
+
                     pinmux_clkout2_pin {
                         pinctrl-single,pins = <0x1b4 0x3>;
                         linux,phandle = <0x20>;
@@ -1189,7 +1198,7 @@
             clock-frequency = <0x2dc6c00>;
             reg = <0x48022000 0x2000>;
             interrupts = <0x49>;
-            status = "disabled";
+            status = "okay";
             dmas = <0x29 0x1c 0x0 0x29 0x1d 0x0>;
             dma-names = "tx", "rx";
             linux,phandle = <0x84>;
@@ -1202,7 +1211,7 @@
             clock-frequency = <0x2dc6c00>;
             reg = <0x48024000 0x2000>;
             interrupts = <0x4a>;
-            status = "disabled";
+            status = "okay";
             dmas = <0x29 0x1e 0x0 0x29 0x1f 0x0>;
             dma-names = "tx", "rx";
             linux,phandle = <0x85>;
@@ -1215,9 +1224,13 @@
             clock-frequency = <0x2dc6c00>;
             reg = <0x481a6000 0x2000>;
             interrupts = <0x2c>;
-            status = "disabled";
+            status = "okay";
+            dmas = <0x29 0x1e 0x0 0x29 0x1f 0x0>;
+            dma-names = "tx", "rx";
             linux,phandle = <0x86>;
             phandle = <0x86>;
+            pinctrl-0 = <0xce>;
+            pinctrl-names = "default";
         };

         serial@481a8000 {
@@ -1226,9 +1239,13 @@
             clock-frequency = <0x2dc6c00>;
             reg = <0x481a8000 0x2000>;
             interrupts = <0x2d>;
-            status = "disabled";
+            status = "okay";
+            dmas = <0x29 0x1e 0x0 0x29 0x1f 0x0>;
+            dma-names = "tx", "rx";
             linux,phandle = <0x87>;
             phandle = <0x87>;
+            pinctrl-names = "default";
+            pinctrl-0 = <0xce>;
         };

         serial@481aa000 {
@@ -2229,6 +2246,7 @@
         i2c0_pins = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins";
         i2c2_pins = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c2_pins";
         uart0_pins = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_uart0_pins";
+        uart4_pins = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_uart4_pins";
         clkout2_pin = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_clkout2_pin";
         cpsw_default = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/cpsw_default";
         cpsw_sleep = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/cpsw_sleep";
freebsd@beaglebone:~/dtb %
freebsd@beaglebone:~/dtb %
freebsd@beaglebone:~/dtb % uname -a
FreeBSD beaglebone 11.3-RELEASE FreeBSD 11.3-RELEASE #0 r349754: Fri Jul  5 03:41:31 UTC 2019     root@releng2.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/BEAGLEBONE  arm
freebsd@beaglebone:~/dtb %
```


----------



## comarius (Sep 17, 2019)

I took the pinmuxes reg for UART 1 and 4  offsets   from bone.js @ github.


----------



## intron (Dec 13, 2019)

comarius said:


> *RESOLVED* *I GOT UART4* working. Getting uart 1  is simple now.
> ========================================================
> I looked in several links and posts at nabble and I got it.
> Does not work in freeBSD 12 and freeBSD 13
> Works fine on freeBSD 11



This bug came from Linux kernel.
It hasn't been fixed at FreeBSD 12.x branch, but has been eliminated at FreeBSD 13-CURRENT.
See also
https://patchwork.kernel.org/patch/11056769/
https://svnweb.freebsd.org/base/head/sys/gnu/dts/arm/am33xx-l4.dtsi?view=log


----------

