Deploying device-tree overlay using torizoncore-builder

Hi Team,

I’m currently working on the integration of MSP3520 TFT Display on Verdin development board (via SPI), which has verdin am62 SoM integrated.

We tried with SPI1, which is readily enabled in the verdin dev board. We could see our display is working fine. But we need to connect the display via SPI2. The pins we had selected were -

SPI2:

SODIMM_131 → CLK

SODIMM_133 → D1 (MISO)

SODIMM_135 → D0 (MOSI)

SODIMM_129 → CS0 (Display)

SODIMM_30 → CS1 (Touch Controller)

For GPIO, we are using dedicated GPIO pins:-

GPIO:

SODIMM_206 → DC/RS

SODIMM_208 → Reset

SODIMM_210 → Backlight

I created an overlay file for this:-

:penguin: root @GalaxyBook/home/Meenakshy/Projects/SPI_TFT_Display/tcbdir: cat device-trees/overlays/verdin-am62_msp3520_tft_display_spi2_overlay.dts

/dts-v1/;

/plugin/;

#include “k3-pinctrl.h”

/ {

compatible = “toradex,verdin-am62”;

};

/\* Verdin SPI_2 pins */*

*&main_pmx0 {*

*main_spi2_pins_default: main-spi2-pins-default {*

*pinctrl-single,pins = <*

*AM62X_IOPAD(0x01b0, PIN_OUTPUT, 1) /* SPI2_CLK - SODIMM_131 */*

*AM62X_IOPAD(0x0198, PIN_INPUT, 1) /* SPI2_D1 - SODIMM_133 - MISO */*

*AM62X_IOPAD(0x0194, PIN_OUTPUT, 1) /* SPI2_D0 - SODIMM_135 - MOSI */*

*AM62X_IOPAD(0x01ac, PIN_OUTPUT, 1) /* SPI2_CS0 - SODIMM_129 */*

*AM62X_IOPAD(0x01a4, PIN_OUTPUT, 1) /* SPI2_CS1 - SODIMM_30 \*/

;

};

};

/\* Disable UART4 to free up pins for SPI2. SODIMM_131 is used by UART4 \*/

&main_uart4 {

status = “disabled”;

};

/\* Verdin SPI_2 - Enable for LCD \*/

&main_spi2 {

pinctrl-names = “default”;

pinctrl-0 = <&main_spi2_pins_default>;

status = “okay”;

    #address-cells = <1>;
    #size-cells = <0>;

msp3520_display@0 {
            compatible = "spidev";
            reg = <0>;
            spi-max-frequency = <10000000>;
            status = "okay";
    };

msp3520_touch@1 {
            compatible = "spidev";
            reg = <1>;
            spi-max-frequency = <10000000>;
            status = "okay";
    };

};

@GalaxyBoo@GalaxyBoo@GalaxyBook root @GalaxyBook/home/Meenakshy/Projects/SPI_TFT_Display/tcbdir:

The steps for deployment that I followed are -

mkdir tcbdir

cd tcbdir

wget https://raw.githubusercontent.com/toradex/tcb-env-setup/master/tcb-env-setup.sh

source tcb-env-setup.sh

torizoncore-builder --help //Test whether the torizoncore-builder command is available

Downloaded the toradex easy installer image of Torizon OS to tcbdir/ path

Downloaded the Linux kernel :-

git clone -b toradex_ti-linux-6.6.y git://git.toradex.com/linux-toradex.git linux --depth 1

Downloaded the device tree overlays :-

git clone -b toradex_ti-linux-6.6.y git://git.toradex.com/device-tree-overlays.git device-trees

Created a configuration file (tcbuild.yaml):-

:penguin: root @GalaxyBook/home/Meenakshy/Projects/SPI_TFT_Display/tcbdir: cat tcbuild.yaml

input:

  easy-installer:

    local: torizon-docker-verdin-am62-Tezi_7.3.0+build.18

 

customization:

  device-tree:

    \# >> Directories where to look for include files.

    include-dirs:

      - linux/include/

      - linux/arch/arm64/boot/dts/ti/

    \# >> Custom device tree source:

    #custom: linux/arch/arm64/boot/dts/ti/k3-am625-verdin-wifi-dev.dts

    overlays:

      add:

        - device-trees/overlays/verdin-am62_msp3520_tft_display_spi2_overlay.dts

 

output:

  \# >> (2) Parameters for deploying to an Easy Installer image.

  easy-installer:

    \# >> Output directory of the customized image (REQUIRED):

    local: custom-torizon-docker-verdin-am62

    \# >> Information used by Toradex Easy Installer:

    name: "Torizon OS - SPI2 Enabled"

:penguin: root @GalaxyBook/home/Meenakshy/Projects/SPI_TFT_Display/tcbdir:

Directory structure will be :-

tcbdir

├── linux

├── device-trees

│ └── overlays

│ └── msp3520_tft_display_spi2_overlay.dts

├── tcbuild.yaml

└── torizon-docker-verdin-am62-Tezi_7.3.0+build.18

Build :-

torizoncore-builder build

Deploy :-

Deploy image to board :-

torizoncore-builder deploy --remote-host 192.168.0.131 --remote-username torizon --remote-password torizon --reboot

I couldn’t see my overlay got applied. SPI2 is not enabled. Also, UART4 didn’t get disabled.

Kindly help me to resolve this issue.

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Issue Analysis and Solution

Looking at your device tree overlay and configuration, there are several issues that need to be addressed to properly enable SPI2 on your Verdin AM62.

1. Missing Required Headers

Your overlay is missing essential header files (1). You need to include:

#include <dt-bindings/gpio/gpio.h>
#include "k3-pinctrl.h"

(1)

2. Device Tree File Path Issue

In your tcbuild.yaml, you have commented out the custom device tree line (2). For Verdin AM62 with development board, you should specify:

customization:
  device-tree:
    include-dirs:
      - linux/include
      - linux/arch/arm64/boot/dts/ti/
    custom: linux/arch/arm64/boot/dts/ti/k3-am625-verdin-wifi-dev.dts
    overlays:
      add:
        - device-trees/overlays/verdin-am62_msp3520_tft_display_spi2_overlay.dts

(2)

3. Corrected Device Tree Overlay Structure

Based on the Toradex documentation structure (1), here’s the corrected overlay:

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include "k3-pinctrl.h"

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

&main_pmx0 {
    main_spi2_pins_default: main-spi2-pins-default {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x01b0, PIN_OUTPUT, 1) /* SPI2_CLK - SODIMM_131 */
            AM62X_IOPAD(0x0198, PIN_INPUT, 1)  /* SPI2_D1 - SODIMM_133 - MISO */
            AM62X_IOPAD(0x0194, PIN_OUTPUT, 1) /* SPI2_D0 - SODIMM_135 - MOSI */
            AM62X_IOPAD(0x01ac, PIN_OUTPUT, 1) /* SPI2_CS0 - SODIMM_129 */
            AM62X_IOPAD(0x01a4, PIN_OUTPUT, 1) /* SPI2_CS1 - SODIMM_30 */
        >;
    };
};

&main_uart4 {
    status = "disabled";
};

&main_spi2 {
    pinctrl-names = "default";
    pinctrl-0 = <&main_spi2_pins_default>;
    status = "okay";
    #address-cells = <1>;
    #size-cells = <0>;

    msp3520_display@0 {
        compatible = "spidev";
        reg = <0>;
        spi-max-frequency = <10000000>;
        status = "okay";
    };

    msp3520_touch@1 {
        compatible = "spidev";
        reg = <1>;
        spi-max-frequency = <10000000>;
        status = "okay";
    };
};

(1)

4. Build Process Verification

Follow these steps to ensure proper deployment (3):

  1. Verify your directory structure matches exactly:
tcbdir/
├── linux/
├── device-trees/
│   └── overlays/
│       └── verdin-am62_msp3520_tft_display_spi2_overlay.dts
├── tcbuild.yaml
└── torizon-docker-verdin-am62-Tezi_7.3.0+build.18/

(3)

  1. Build the custom image:
torizoncore-builder build

(3)

  1. Deploy the custom image (not just the overlay):
torizoncore-builder deploy --remote-host 192.168.0.131 --remote-username torizon --remote-password torizon --reboot

(3)

5. Verification Steps

After deployment, verify the changes:

  1. Check if SPI2 is enabled:
ls /dev/spi*
  1. Verify UART4 is disabled:
dmesg | grep uart
  1. Check overlay application:
cat /proc/device-tree/compatible

Key Points to Remember

  • Always uncomment the custom: line in your tcbuild.yaml to specify the base device tree (2)
  • Include all required header files in your overlay (1)
  • Deploy the entire custom image, not just the overlay (3)
  • Ensure your overlay file path matches exactly what’s specified in tcbuild.yaml (3)

This should resolve your SPI2 enablement issue and properly disable UART4 as intended.

Best regards, Toradex AI Assistant.


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

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hi @Meenakshy

Can you try:.

  1. Build the image
    torizoncore-builder build
  2. Unpack the new image
    torizoncore-builder images unpack custom-torizon-docker-verdin-am62
  3. Remote deploy
    torizoncore-builder deploy --remote-host 192.168.0.131 --remote-username torizon --remote-password torizon --reboot

Hi Allan,

Thanks for the response.

The suggested solution worked perfectly.

Thanks & Regards,
Meenakshy K M