Enable UART

Hello All…
I have to enable UART in my Beaglebone AI-64. Pls help me to enable UART communication in BBAI-64…

Thank You!!

Which UART ? You will need to edit extlinux.conf and add the required overlay to the line that starts fdtoverlays (make sure there is no # in front of it.

You may need to create an overlay if there isn’t one available.

UART2…I do not know how to add overlay .please help me…

Thank You!!

Ok looks like there is an overlay for that UART, on header pins P9.24 and P9.26.

You need to edit /boot/firmware/extlinux/extlinux.conf

look for the line that says something like
#fdtoverlays /overlays/<file>.dtbo

change it to

fdtoverlays /overlays/BONE-UART1.dtbo

If an overlay is already being loaded, you can specify multiple overlays, just separate them by a space.

save the file and reboot.

The filename is a bit confusing as it says UART1.

Ok…Thank You…

And i have one more doubt also. What about its hardware side?Needed FTDI?How to uderstand serial port enabled? pls rply…

Yes the output is going to be 3V logic level. It depends on what you are connecting it to as to if you need a transceiver chip. What are you connecting it to ?

Connected via ftdi . But no device detected in port list(device manager-port). I expect serial device name there. pls help me to resolve this issue. I powered BBAI-64 via USB-C. Whether serial communication also possible using same USB-C cable?

Thank You!!!

Can you pls give me any solution for verifying these UART1 that i enabled. How to check UART enabled or not?..Can you please help me?

Thank You!!!

Just link pin 24 to 26 and then run something like minicom on the ai64, or some other terminal software.
Make sure local echo and hardware flow control is off. Anything you type should then appear on the screen if the uart is working. Disconnecting pins 24 and 26 should then stop it from working.

Thank you!!!
Is any method possible using putty?

Running Putty on another computer ? SSH into the AI64 and the run minicom.

If you want to test it remotely then no, not without having something running on the AI64 to at least echo back serial data.

when I am editting extlinux.conf with BONE-UART1.dtbo. BONE-UART1.dtbo file is created and It looks empty…is it ok??when i am checking UART between P9.24 and P9.26 it is not getting… what is the reason?

the dtbo file is a binary file, on my system about 380 bytes.
It should be in /boot/firmware/overlays/

Is the overlay being loaded ?
what files are in /proc/device-tree/chosen/overlays/

can you please share BONE-UART1.dtb0 file? I do not know how to load overlays… I checked that location…it contains two files and details are below…
debian@BeagleBone:/proc/device-tree/chosen/overlays$ ls
BONE-UART1.kernel name
I opened BONE_UART1.kernel .But it only contains date and time…Is it ok?

Thank You!!

Ok if the file exists the overlay is being loaded and the UART should be working.

How are you counting the pins on the P9 header ?
It is a bit confusing, but pin 1 is not at the top of the connector.

pin1

Thank you!!
i also counted the same pin as one. Then what is the problem?

I have one more doubt also. I editted extlinux.conf as # fdtoverlays /overlays/BONE-UART1.dtbo and after that i checked the location /dev/bone/uart there exist both zero and one. But when i am trying to change other than one any value ,it not reflected in the same location /dev/bone/uart. For example i placed BONE-UART2.dtb0 then /dev/bone/uart location contains only zero. I expect zero and 2 there. Do you know what is the reason?

Thank You!!!

Not sure how the UARTS are numbered in /dev/bone there is a udev rule I think that creates the links.

/dev/bone/uart/0 is a symlink to /dev/ttyS2

ok not sure what is going on, couldn’t seem to get it to work for me.

I do have an overlay that enables 5 uarts which does work properly and creates symlinks that match the hardware uart.

You could edit it to just enable uart2.

/dts-v1/;
/plugin/;

#include <dt-bindings/pinctrl/k3.h>
#include <dt-bindings/board/k3-j721e-bone-pins.h>

&{/chosen} {
        overlays {
                BONE-UART_X5 = __TIMESTAMP__;
        };
};

&main_pmx0 {

        uartx5_2_pins_default:uartx5_2-pins-default {
                pinctrl-single,pins = <
                P9_24A(PIN_OUTPUT, 3) /* UART2 TX */
                P9_26A(PIN_INPUT, 3)  /* UART2 RX */
                P9_24B(PIN_INPUT, 7)
                P9_26B(PIN_INPUT, 7)
                >;
        };
        uartx5_4_pins_default:uartx5_4-pins-default {
                pinctrl-single,pins = <
                P9_37B(PIN_INPUT, 8)   /* UART4 RX */
                P9_38B(PIN_OUTPUT, 8)  /* UART4 TX */
                P9_37A(PIN_INPUT, 7)
                P9_38A(PIN_INPUT, 7)
                >;
        };
        uartx5_5_pins_default:uartx5_5-pins-default {
                pinctrl-single,pins = <
                P8_31B(PIN_INPUT, 14)  /* UART5 RX */
                P8_37A(PIN_OUTPUT, 3) /* UART5 TX */
                P8_31A(PIN_INPUT, 7)
                P8_37B(PIN_INPUT, 7)
                >;
        };
        uartx5_6_pins_default:uartx5_6-pins-default {
                pinctrl-single,pins = <
                P9_16(PIN_OUTPUT, 3)  /* UART6 TX */
                P9_14(PIN_INPUT, 3)   /* UART6 RX */
                >;
        };
        uartx5_8_pins_default:uartx5_8-pins-default {
                pinctrl-single,pins = <
                P8_29(PIN_OUTPUT, 14)  /* UART8 TX */
                P8_28(PIN_INPUT, 14)   /* UART8 RX */
                >;
        };

};

&main_uart2 {
        pinctrl-names = "default";
        pinctrl-0 = <&uartx5_2_pins_default>;
        symlink = "bone/uart/2";
        status = "okay";
};

&main_uart4 {
        pinctrl-names = "default";
        pinctrl-0 = <&uartx5_4_pins_default>;
        symlink = "bone/uart/4";
        status = "okay";
};

&main_uart5 {
        pinctrl-names = "default";
        pinctrl-0 = <&uartx5_5_pins_default>;
        symlink = "bone/uart/5";
        status = "okay";
};

&main_uart6 {
        pinctrl-names = "default";
        pinctrl-0 = <&uartx5_6_pins_default>;
        symlink = "bone/uart/6";
        status = "okay";
};

&main_uart8 {
        pinctrl-names = "default";
        pinctrl-0 = <&uartx5_8_pins_default>;
        symlink = "bone/uart/8";
        status = "okay";
};

you need to copy this file to

/opt/source/dtb-5.10-ti/src/arm64/overlays

The path might be slightly different on your board. The dtb-5.10 part should match the kernel version you have. Check by running uname -a

Create a file there with a .dts extension. I called mine uartx5.dts. You can name it whatever you like but the extension must be .dts

If you then go back to /opt/source/dtb-5.10-ti
and run make which will compile the overlays files, and then make install to copy the overlay files to /boot/firmware/overlays

Check that folder to make sure your new overlay is there.
Then edit extlinux.conf, remove BONE-UART1 and add your new overlay.

Reboot and check /proc/device-tree/chosen/overlays/ You should see BONE-UART_X5 if the overlays loaded.

/dev/bone/uart/2 should now work

If you run ls -l /dev/bone/uart/ you should see the actual /dev/ttySx device.

1 Like