This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62-LP: How to enable UART5 on user expansion connector

Part Number: SK-AM62P-LP

OS - Linux

Query statement:

I want to enable and use UART5 on main domain of SOC. As there is no readymade "dtso" file for UART5 from TI, I tired to edit "k3-am62p5-mcan.dtso". After applying UART5 changes, we could not see UART5 enabled and can not use it.

Backgound / additional information:

1. I want to use UART5 available on 40 pin user expansion header ( Pin No 8 and Pin No 10)

2. By default Pin 8 and 10 are assigned for mcan0 (main domain CAN) in Pin mux

3. I want to map Pin mux (pin 8 and Pin 10) to UART-5 instead of mcan0.

4. I modified the pin mux setting in "k3-am62p5-mcan.dtso" as below

5. I disabled mcan0 driver 

6. I added uart5 node configuration as below

5. "k3-am62p5-mcan.dtso" overlay is applied already and working for other CAN port which is mcan1 ( we want to replace mcan0. just to clarify)

Tool/software:

// SPDX-License-Identifier: GPL-2.0
/**
* DT overlay for enabling MCAN for AM62P-SK
*
* Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
*/
 
/dts-v1/;
/plugin/;
 
#include <dt-bindings/gpio/gpio.h>
#include "k3-pinctrl.h"
 
&{/} {
	transceiver1: can-phy0 {
		compatible = "ti,tcan1042";
		#phy-cells = <0>;
		max-bitrate = <5000000>;
	};
 
	transceiver2: can-phy1 {
		compatible = "ti,tcan1042";
		#phy-cells = <0>;
		max-bitrate = <5000000>;
	};
 
	transceiver3: can-phy2 {
		compatible = "ti,tcan1042";
		#phy-cells = <0>;
		max-bitrate = <5000000>;
	};
 
	transceiver4: can-phy3 {
		compatible = "ti,tcan1042";
		#phy-cells = <0>;
		max-bitrate = <5000000>;
	};
};
 
&main_pmx0 {
	main_mcan0_pins_default: main-mcan0-pins-default {
		pinctrl-single,pins = <
			AM62PX_IOPAD(0x01dc, PIN_INPUT, 0) /* (F20) MCAN0_RX */
			AM62PX_IOPAD(0x01d8, PIN_OUTPUT, 0) /* (B23) MCAN0_TX */
>;
	};
	main_uart5_pins_default: main-uart5-pins-default {
		pinctrl-single,pins = <
			AM62PX_IOPAD(0x01dc, PIN_OUTPUT, 1) /* (F20) MCAN0_RX */
			AM62PX_IOPAD(0x01d8, PIN_INPUT, 1) /* (B23) MCAN0_TX */
>;
	};
 
	main_mcan1_pins_default: main-mcan1-pins-default {
		pinctrl-single,pins = <
			AM62PX_IOPAD(0x00b4, PIN_INPUT, 5) /* (U25) GPMC0_CSn3.MCAN1_RX */
			AM62PX_IOPAD(0x00b0, PIN_OUTPUT, 5) /* (T22) GPMC0_CSn2.MCAN1_TX */
>;
	};
};
 
&mcu_pmx0 {
	mcu_mcan0_pins_default: mcu-mcan0-pins-default {
		pinctrl-single,pins = <
			AM62PX_MCU_IOPAD(0x0038, PIN_INPUT, 0) /* (D6) MCU_MCAN0_RX */
			AM62PX_MCU_IOPAD(0x0034, PIN_OUTPUT, 0) /* (E8) MCU_MCAN0_TX */
>;
	};
 
	mcu_mcan1_pins_default: mcu-mcan1-pins-default {
		pinctrl-single,pins = <
			AM62PX_MCU_IOPAD(0x0040, PIN_INPUT, 0) /* (E7) MCU_MCAN1_RX */
			AM62PX_MCU_IOPAD(0x003c, PIN_OUTPUT, 0) /* (F8) MCU_MCAN1_TX */
>;
	};
};
 
&main_i2c2{
	/*
	* main_i2c2 is using (U25) and (T22)
	* so disable to use main_mcan1
	*/
	status = "disabled";
};
 
&main_i2c1 {
	/*
	* Unset GPIO SoC_I2C2_MCAN_SEL to
	* route MCAN1 signals to MCAN1 HDR
	*/
	gpio@23 {
		p20-hog {
		/* P20 - SoC_I2C2_MCAN_SEL */
		gpio-hog;
		gpios = <16 GPIO_ACTIVE_HIGH>;
		output-low;
		line-name = "SoC_I2C2_MCAN_SEL";
		};
	};
};
 
&main_uart5 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&main_uart5_pins_default>;
};
 
 
&main_mcan0 {
	status = "disabled";
	pinctrl-names = "default";
	pinctrl-0 = <&main_mcan0_pins_default>;
	phys = <&transceiver1>;
};
 
&main_mcan1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&main_mcan1_pins_default>;
	phys = <&transceiver2>;
};
 
&mcu_mcan0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&mcu_mcan0_pins_default>;
	phys = <&transceiver3>;
};
 
&mcu_mcan1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&mcu_mcan1_pins_default>;
	phys = <&transceiver4>;
};
Hii all,

I am using the Yocto project to build for the AM62P-LP EVM. I'm trying to modify the device tree source (DTS) file for UART5. However, main_mcan0 is also using the same GPIOs as UART5. To resolve this, I modified the k3-am62p5-sk-mcan.dts file, and my plan was to apply the .dtbo (Device Tree Overlay) file whenever I wanted to use UART5.

The issue is that after making the changes to the k3-am62p5-sk-mcan.dts file and applying the .dtbo file, it's not working as expected. I have shared the modified .dts file. Can you please provide a solution for this problem?

  • The subject owner is currently out of office, please expect a response later this week or early next week.

  • Hi,

    The issue is that after making the changes to the k3-am62p5-sk-mcan.dts file and applying the .dtbo file, it's not working as expected.

    Please explain how it is not working as expected.

    	main_mcan0_pins_default: main-mcan0-pins-default {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x01dc, PIN_INPUT, 0) /* (F20) MCAN0_RX */
    			AM62PX_IOPAD(0x01d8, PIN_OUTPUT, 0) /* (B23) MCAN0_TX */
    >;
    	};
    	main_uart5_pins_default: main-uart5-pins-default {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x01dc, PIN_OUTPUT, 1) /* (F20) MCAN0_RX */
    			AM62PX_IOPAD(0x01d8, PIN_INPUT, 1) /* (B23) MCAN0_TX */
    >;
    	};

    I am not sure if you can define the same pin more than once in the pinmux. I don't think anyone tried this.

    Do you see if the kernel boot log has any message about pinmux error? If so, please remove the mcan0 pinmux from the devicetree to see if it solves the issue.

  • It seems you edited the thread, but I don't know what information you revised. It is difficult to see what you have changed in the existing posts.

    If you have any update, please provide it in a new post.

  • Hi Bin Liu,

    I am using the Yocto project to build for the AM62P-LP EVM. I'm trying to modify the device tree source (DTS) file for UART5. However, main_mcan0 is also using the same GPIOs as UART5. To enable UART5 User expansion, I modified the k3-am62p5-sk-mcan.dts0 file, compile using billow bitbake command

    MACHINE=am62pxx-evm bitbake virtual/kernel -c compile
    MACHINE=am62pxx-evm bitbake virtual/kernel -c install
    MACHINE=am62pxx-evm bitbake virtual/kernel -c package
    MACHINE=am62pxx-evm bitbake virtual/kernel -c populate_sysroot

    and my plan was to apply the .dtbo (Device Tree Overlay) file whenever I wanted to use UART5.

    The issue is that after making the changes to the k3-am62p5-sk-mcan.dtso file and applying the .dtbo file, it's not working as expected. I have shared the modified .dtso file.

    // SPDX-License-Identifier: GPL-2.0
    /**
     * DT overlay for enabling MCAN for AM62P-SK
     *
     * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
     */
    
    /dts-v1/;
    /plugin/;
    
    #include <dt-bindings/gpio/gpio.h>
    #include "k3-pinctrl.h"
    
    &{/} {
    	transceiver1: can-phy0 {
    		compatible = "ti,tcan1042";
    		#phy-cells = <0>;
    		max-bitrate = <5000000>;
    	};
    
    	transceiver2: can-phy1 {
    		compatible = "ti,tcan1042";
    		#phy-cells = <0>;
    		max-bitrate = <5000000>;
    	};
    
    	transceiver3: can-phy2 {
    		compatible = "ti,tcan1042";
    		#phy-cells = <0>;
    		max-bitrate = <5000000>;
    	};
    
    	transceiver4: can-phy3 {
    		compatible = "ti,tcan1042";
    		#phy-cells = <0>;
    		max-bitrate = <5000000>;
    	};
    };
    
    &main_pmx0 {
    	main_mcan0_pins_default: main-mcan0-pins-default {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x01dc, PIN_INPUT, 0) /* (F20) MCAN0_RX */
    			AM62PX_IOPAD(0x01d8, PIN_OUTPUT, 0) /* (B23) MCAN0_TX */
    		>;
    	};
    	main_uart5_pins_default: main-uart5-pins-default {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x01dc, PIN_OUTPUT, 1) /* (F20) MCAN0_RX */
    			AM62PX_IOPAD(0x01d8, PIN_INPUT, 1) /* (B23) MCAN0_TX */
    		>;
    	};
    
    	main_mcan1_pins_default: main-mcan1-pins-default {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x00b4, PIN_INPUT, 5) /* (U25) GPMC0_CSn3.MCAN1_RX */
    			AM62PX_IOPAD(0x00b0, PIN_OUTPUT, 5) /* (T22) GPMC0_CSn2.MCAN1_TX */
    		>;
    	};
    };
    
    &mcu_pmx0 {
    	mcu_mcan0_pins_default: mcu-mcan0-pins-default {
    		pinctrl-single,pins = <
    			AM62PX_MCU_IOPAD(0x0038, PIN_INPUT, 0) /* (D6) MCU_MCAN0_RX */
    			AM62PX_MCU_IOPAD(0x0034, PIN_OUTPUT, 0) /* (E8) MCU_MCAN0_TX */
    		>;
    	};
    
    	mcu_mcan1_pins_default: mcu-mcan1-pins-default {
    		pinctrl-single,pins = <
    			AM62PX_MCU_IOPAD(0x0040, PIN_INPUT, 0) /* (E7) MCU_MCAN1_RX */
    			AM62PX_MCU_IOPAD(0x003c, PIN_OUTPUT, 0) /* (F8) MCU_MCAN1_TX */
    		>;
    	};
    };
    
    &main_i2c2{
    	/*
    	* main_i2c2 is using (U25) and (T22)
    	* so disable to use main_mcan1
    	*/
    	status = "disabled";
    };
    
    &main_i2c1 {
    	/*
    	* Unset GPIO SoC_I2C2_MCAN_SEL to
    	* route MCAN1 signals to MCAN1 HDR
    	*/
    	gpio@23 {
    		p20-hog {
    		/* P20 - SoC_I2C2_MCAN_SEL */
    		gpio-hog;
    		gpios = <16 GPIO_ACTIVE_HIGH>;
    		output-low;
    		line-name = "SoC_I2C2_MCAN_SEL";
    		};
    	};
    };
    
    &main_uart5 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_uart5_pins_default>;
    };
    
    
    &main_mcan0 {
    	status = "disabled";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mcan0_pins_default>;
    	phys = <&transceiver1>;
    };
    
    &main_mcan1 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mcan1_pins_default>;
    	phys = <&transceiver2>;
    };
    
    &mcu_mcan0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&mcu_mcan0_pins_default>;
    	phys = <&transceiver3>;
    };
    
    &mcu_mcan1 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&mcu_mcan1_pins_default>;
    	phys = <&transceiver4>;
    };

  • The issue is that after making the changes to the k3-am62p5-sk-mcan.dtso file and applying the .dtbo file, it's not working as expected.

    This was my question, please explain what "is not working as expected", what do you see.

  • UART5 on user User expansion pin (8,10) is not working as expected

  • is not working as expected

    Explain this in details please. What do you see and what do you expect.

  • If you have any log which might help explain the situation, please attach it here.