Adding UART via Device Tree Overlay - Verdin AM62

Hello dear Toradex community,

I am struggling with activation of a UART with a device tree overlay at the SoM Verdin AM62 on a Dahlia Board. The SoM is running Torizon OS 7 with PREEMPT_RT patch (7.3.0-devel-202506+build.9).

The goal is to use verdin-uart7 which actually is UART2 of the SoC.

My development computer is running Win11 and I develop code in VS Code in WSL. I have a demo application running on the SoM and the other UARTs already work. I do not want to change the OS (Torizon OS).

I had a look on smartstuffs question ( How to configure custom UART? - #13 by SmartStuff ) and others but I couldnt make mine work so far.

I downloaded linux-toradex and checked out branch toradex_ti-linux-6.6.y. For the device tree compilation I followed Build Device Tree Overlays from Source Code | Toradex Developer Center , but only the steps at Manual Device Tree Overlays Compilation.

My device tree overlay looks as follows: (I had to copy k3-pinctrl.h into my folder with the DTO file so that compilation worked)

/dts-v1/;

/plugin/;

#include “k3-pinctrl.h”

&{/} {

aliases {

    serial5 = &main_uart2;

    /\*serial5 = "/bus@f0000/serial@2820000";\*/

};

};

&main_i2c3

{

status = "disabled";

};

&main_pmx0 {

main_uart2_alt_pins: main_uart2_alt_pins {

    pinctrl-single,pins = <

        AM62X_IOPAD(0x01d0, PIN_INPUT_PULLUP, 3) /\* (A15) UART2_RXD \*/ /\* SODIMM 95 \*/

        AM62X_IOPAD(0x01d4, PIN_OUTPUT, 3)   /\* (B15) UART2_TXD \*/ /\* SODIMM 93 \*/

        /\*AM62X_IOPAD(0x0078, PIN_OUTPUT, 8) \*/ /\* (U24) UART2_RTSn \*/ /\* SODIMM 21 \*/

        /\*AM62X_IOPAD(0x0074, PIN_INPUT, 8)  \*/ /\* (U25) UART2_CTSn \*/ /\* SODIMM 76 \*/

    >;

};

};

/* Configure UART7 with alternate pins */

/* Verdin UART_7 */

&main_uart2 {

status = "okay";

pinctrl-names = "default";

pinctrl-0 = <&main_uart2_alt_pins>;

/\*uart-has-rtscts;\*/

};

Note: I disabled I2C3 as it would conflict as it uses the same pins (93, and 95).

When I compile this, I get the error:

uart7-alt-pins.dts:7.10-11.4: ERROR (path_references): /fragment@0/overlay/aliases: Reference to non-existent node or label “main_uart2”

This looks pretty similar to smartstuffs problem, so I changed the serial5 alias to

    serial5 = "/bus@f0000/serial@2820000";

which then throws:

uart7-alt-pins.dts:9.6-44: Warning (alias_paths): /fragment@0/overlay/aliases:serial5: aliases property is not a valid node (/bus@f0000/serial@2820000)

Another Torizon developer posted: Verdin Am62 : using all the Main Uart in am62 - #2 by ToradexAI that the number of UART instances is by default set to 6 in kernel menuconfig, and after setting this to 8 it worked, however i dont think thats the problem here.

Any help would be appreciated :slight_smile:

Kind regards,
Dom

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Device Tree Overlay for UART Configuration on Verdin AM62

Based on the documentation, I can help you create a proper device tree overlay for enabling UART on your Verdin AM62. The error you’re encountering is due to incorrect overlay structure and alias handling.

Correct Overlay Structure

According to the Toradex documentation, a device tree overlay should follow this structure (1):

/dts-v1/;
/plugin/;

// Header file with SoC-specific pinmux macros
#include "k3-pinctrl.h"

/ {
    compatible = "toradex,verdin-am62";
};

&main_pmx0 {
    pinctrl_sodimm_uart2_pins: sodimm_uart2_pins_grp {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x01d0, PIN_INPUT_PULLUP, 3) /* (A15) UART2_RXD */ /* SODIMM 95 */
            AM62X_IOPAD(0x01d4, PIN_OUTPUT, 3)       /* (B15) UART2_TXD */ /* SODIMM 93 */
        >;
    };
};

&main_uart2 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sodimm_uart2_pins>;
};

&main_i2c3 {
    status = "disabled";
};

(1)

Key Points to Fix

  1. Remove the aliases section - This is causing your compilation error. The kernel already handles UART device numbering automatically (1).

  2. Add compatible property - This is required for proper overlay identification (1):

    / {
        compatible = "toradex,verdin-am62";
    };
    
  3. Correct pinmux configuration - For AM6X based modules, you need to define the pin configuration inside the &main_pmx0 node with the pinctrl-single,pins property (2):

    &main_pmx0 {
        pinctrl_sodimm_uart2_pins: sodimm_uart2_pins_grp {
            pinctrl-single,pins = <
                AM62X_IOPAD(0x01d0, PIN_INPUT_PULLUP, 3) /* UART2_RXD */
                AM62X_IOPAD(0x01d4, PIN_OUTPUT, 3)       /* UART2_TXD */
            >;
        };
    };
    

    (2)

Building and Deploying

To build and deploy your overlay using TorizonCore Builder (1):

  1. Create a YAML configuration file:

    input:
      easy-installer:
        local: torizon-docker-verdin-am62-Tezi_7.3.0+build.x
    customization:
      device-tree:
        include-dirs:
          - linux/include
          - linux/arch/arm64/boot/dts/ti/
        custom: linux/arch/arm64/boot/dts/ti/k3-am625-verdin-wifi-dahlia.dts
        add:
          - /device-trees/overlays/uart2-verdin-am62-overlay.dts
    output:
      easy-installer:
        local: custom-torizon-docker-verdin-am62
        name: Torizon OS - UART2 enabled
    

    (1)

  2. Build the custom image with TorizonCore Builder (1).

Verification

After applying the overlay, your UART2 should be available as /dev/ttyS2 in your system. You can verify this by checking the device files in /dev/.

The overlay correctly disables I2C3 to avoid pin conflicts, which is the right approach for pins 93 and 95 (1).

Best regards, Toradex AI Assistant.

I changed my overlay as from the AI suggested, and it compiles, but it doesnt solve the problem.

In the dmesg output i found the following line:

[ 1.315286] omap8250 2820000.serial: failed to get alias

and during boot the output showed, that the overlay was applied correctly:

Scanning mmc 0:1...
Found U-Boot script /boot.scr
969 bytes read in 10 ms (93.8 KiB/s)
Executing script at 90280000
Applying Overlay: verdin-am62_spidev_overlay.dtbo
560 bytes read in 11 ms (48.8 KiB/s)
**Applying Overlay: uart7-alt-pins-v07.dtbo**
854 bytes read in 11 ms (75.2 KiB/s)
11105035 bytes read in 86 ms (123.1 MiB/s)
13171190 bytes read in 142 ms (88.5 MiB/s)

Please try to add

&aliases {
serial5 = &main_uart2;
};

to your DT overlay.

Hello Alex, and thanks for your response

With that addition I still get the error:
uart7_alt_pins_v10.dts:11.10-13.3: ERROR (path_references): /fragment@0/__overlay__: Reference to non-existent node or label "main_uart2"

/dts-v1/;
/plugin/;

// Header file with SoC-specific pinmux macros
#include "k3-pinctrl.h"

/ {
    compatible = "toradex,verdin-am62";
};

&aliases {
    serial5 = &main_uart2;
};


&main_i2c3 {
    status = "disabled";
};


&main_uart2 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sodimm_uart2_pins>;
};

&main_pmx0 {
    pinctrl_sodimm_uart2_pins: sodimm_uart2_pins_grp {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x01d0, PIN_INPUT_PULLUP, 3) /* (A15) UART2_RXD */ /* SODIMM 95 */
            AM62X_IOPAD(0x01d4, PIN_OUTPUT, 3)       /* (B15) UART2_TXD */ /* SODIMM 93 */
        >;
    };
};



Hi @domi471!

Where did you find the node &main_uart2?

As the error suggests and as far as I searched, there isn’t a node called main_uart2 in the AM62 device tree. So, this is giving the error since your overlay is referencing a non-existent node.

Best regards.

Hi Lucas!

torizon@verdin-am62-15563598:~$ cat /proc/device-tree/compatible
toradex,verdin-am62-nonwifi-devtoradex,verdin-am62-nonwifitoradex,verdin-am62ti,am625

I found:
k3-am625-verdin-nonwifi-dahlia.dts includes four files:

#include "k3-am625.dtsi"
#include "k3-am62-verdin.dtsi"
#include "k3-am62-verdin-nonwifi.dtsi"
#include "k3-am62-verdin-dahlia.dtsi"

k3-am625.dtsi includes k3-am62.dtsi

and k3-am62.dtsi includes k3-am62-main.dtsi (at the bottom of the file)

and k3-am62-main.dtsi contains:

&cbass_main {
   (...)

	main_uart2: serial@2820000 {
		compatible = "ti,am64-uart", "ti,am654-uart";
		reg = <0x00 0x02820000 0x00 0x100>;
		interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&k3_pds 153 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 153 0>;
		clock-names = "fclk";
		status = "disabled";
	};
(...)
};

Kind regards,
Dom

Hi @domi471!

Sorry for the delayed answer.

Another possible approach is to make these changes in the aliases node directly in the device tree, not using overlays.
In this case, you would need to rebuild the kernel and then apply your overlay with the other modifications.

Could you please test this way and see if it works as you expect?

Best regards.

Hello,
sorry also for the late response!
I attached the overlay that finally works for me:
overlay_4xUARTs_for_RS485_test.dts (3.3 KB)

Btw: I have to admit, it is quite confusing to work with all those different uart numberings, on chip level, SoM Level and Carrier Board level.

One thing that prevented my UART3 from working was, that the bootloader tried to query the MMC1 pins (for example at MMC1_CMD and …CLK pins). Because of that, my OS overlay could not overwrite the bootloaders usage of some pins. I still always had the CLK signal on MMC1_CLK pin, even with the overlay applied to the OS Image. So i had to prevent the bootloader from attempting to boot from MMC1 with the following lines and then it worked:
read out the current boot_targets environment values:
sudo fw_printenv boot_targets
which outputs:
boot_targets=mmc1 mmc0 dhcp
and it can be adapted as follows:
sudo fw_setenv boot_targets "mmc0 dhcp"
Then uboot only checks MMC0 and DHCP

Kind regards,
Dominik

Hi @domi471!

I’m glad you were able to get this working.

Best regards.