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.

TDA4VH-Q1: How to enable mcan3 and mcan5 on TDA4VH EVM (proc1413)

Part Number: TDA4VH-Q1
Other Parts Discussed in Thread: TDA4VH

Tool/software:

Hi Team,

I want to enable mcan3 and mcan5 on TDA4VH EVM,but got confused by usage of mux1 and mux2.

&main_i2c0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&main_i2c0_pins_default>;

	clock-frequency = <400000>;

	exp1: gpio@20 {
		compatible = "ti,tca6416";
		reg = <0x20>;
		gpio-controller;
		#gpio-cells = <2>;
		gpio-line-names = "PCIE1_2L_MODE_SEL", "PCIE1_4L_PERSTZ", "PCIE1_2L_RC_RSTZ",
				  "PCIE1_2L_EP_RST_EN", "PCIE0_4L_MODE_SEL", "PCIE0_4L_PERSTZ",
				  "PCIE0_4L_RC_RSTZ", "PCIE0_4L_EP_RST_EN", "PCIE1_4L_PRSNT#",
				  "PCIE0_4L_PRSNT#", "CDCI1_OE1/OE4", "CDCI1_OE2/OE3",
				  "AUDIO_MUX_SEL", "EXP_MUX2", "EXP_MUX3", "GESI_EXP_PHY_RSTZ";

		p12-hog {
			/* P12 - AUDIO_MUX_SEL */
			gpio-hog;
			gpios = <12 GPIO_ACTIVE_HIGH>;
			output-low;
			line-name = "AUDIO_MUX_SEL";
		};
	};

	exp2: gpio@22 {
		compatible = "ti,tca6424";
		reg = <0x22>;
		gpio-controller;
		#gpio-cells = <2>;
		gpio-line-names = "R_GPIO_RGMII1_RST", "ENET2_I2CMUX_SEL", "GPIO_USD_PWR_EN",
				  "USBC_PWR_EN", "USBC_MODE_SEL1", "USBC_MODE_SEL0",
				  "GPIO_LIN_EN", "R_CAN_STB", "CTRL_PM_I2C_OE#",
				  "ENET2_EXP_PWRDN", "ENET2_EXP_SPARE2", "CDCI2_RSTZ",
				  "USB2.0_MUX_SEL", "CANUART_MUX_SEL0", "CANUART_MUX2_SEL1",
				  "CANUART_MUX1_SEL1", "ENET1_EXP_PWRDN", "ENET1_EXP_RESETZ",
				  "ENET1_I2CMUX_SEL", "ENET1_EXP_SPARE2", "ENET2_EXP_RESETZ",
				  "USER_INPUT1", "USER_LED1", "USER_LED2";

		p13-hog {
			/* P13 - CANUART_MUX_SEL0 */
			gpio-hog;
			gpios = <13 GPIO_ACTIVE_HIGH>;
			output-high;
			line-name = "CANUART_MUX_SEL0";
		};

		p15-hog {
			/* P15 - CANUART_MUX1_SEL1 */
			gpio-hog;
			gpios = <15 GPIO_ACTIVE_HIGH>;
			output-high;
			line-name = "CANUART_MUX1_SEL1";
		};
	};
};

Can you give some insight?

Best Regards

Kong Xiangxu

  • Hi Kong,

    There should be 4 MCAN interfaces that are already enabled on the J784S4. Is this request because more CAN interface is needed?

    But in any case, if you want to enable the extra CAN interfaces and are confused by the MUX settings, there are two sets of MUX to configure. First is this AUDIO_MUX_SEL:

    This AUDIO_MUX_SEL controls the MUX here:

    The default 0 selects McASP, while 1 selects CAN3 and CAN5 to be enabled:

    Second set of muxes are the MUX selects you have screenshotted. You would want to connect A port to B2 port for both MUX1 (which has MCAN3 on B2) and MUX2 (which has MCAN5 on B2).

    And for our EVM, here is a truth table for reference:

    So, for CAN to be selected, we need CANUART_MUX1_SEL1 and CANUART_MUX2_SEL1 (S1) to both be high. S2 is hardwired to be pulled up to high. S0 is pulled down, but would need to be high as well, and DIP SW2.2 should control this.

    Regards,

    Takuma

  • &main_pmx0 {
        mymcan3_pins_default: mymcan3-default-pins {
            pinctrl-single,pins = <
                J784S4_IOPAD(0x080, PIN_INPUT, 0) /* (AK34) MCASP0_AXR4.MCAN3_RX */
                J784S4_IOPAD(0x07c, PIN_INPUT, 0) /* (AJ38) MCASP0_AXR3.MCAN3_TX */
            >;
        };
    
        mymcan5_pins_default: mymcan5-default-pins {
            pinctrl-single,pins = <
                J784S4_IOPAD(0x03c, PIN_INPUT, 0) /* (AK38) MCASP0_AFSX.MCAN5_RX */
                J784S4_IOPAD(0x038, PIN_INPUT, 0) /* (AK35) MCASP0_ACLKX.MCAN5_TX */
            >;
        };
    
    };
    
    
    
    &main_mcan3 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&mymcan3_pins_default>;
    	//phys = <&transceiver3>;
    };
    
    &main_mcan5 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&mymcan5_pins_default>;
    	//phys = <&transceiver3>;
    };

    &main_i2c0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c0_pins_default>;
    
    	clock-frequency = <400000>;
    
    	exp1: gpio@20 {
    		compatible = "ti,tca6416";
    		reg = <0x20>;
    		gpio-controller;
    		#gpio-cells = <2>;
    		gpio-line-names = " "AUDIO_MUX_SEL",PCIE1_2L_MODE_SEL", "PCIE1_4L_PERSTZ", "PCIE1_2L_RC_RSTZ",
    				  "PCIE1_2L_EP_RST_EN", "PCIE0_4L_MODE_SEL", "PCIE0_4L_PERSTZ",
    				  "PCIE0_4L_RC_RSTZ", "PCIE0_4L_EP_RST_EN", "PCIE1_4L_PRSNT#",
    				  "PCIE0_4L_PRSNT#", "CDCI1_OE1/OE4", "CDCI1_OE2/OE3",
    				  "EXP_MUX2", "EXP_MUX3", "GESI_EXP_PHY_RSTZ";
    
    		p12-hog {
    			/* P12 - AUDIO_MUX_SEL */
    			gpio-hog;
    			gpios = <12 GPIO_ACTIVE_HIGH>;
    			output-low;
    			line-name = "AUDIO_MUX_SEL";
    		};
    	};
    
    	exp2: gpio@22 {
    		compatible = "ti,tca6424";
    		reg = <0x22>;
    		gpio-controller;
    		#gpio-cells = <2>;
    		gpio-line-names = ""CANUART_MUX2_SEL1",R_GPIO_RGMII1_RST", "ENET2_I2CMUX_SEL", "GPIO_USD_PWR_EN",
    				  "USBC_PWR_EN", "USBC_MODE_SEL1", "USBC_MODE_SEL0",
    				  "GPIO_LIN_EN", "R_CAN_STB", "CTRL_PM_I2C_OE#",
    				  "ENET2_EXP_PWRDN", "ENET2_EXP_SPARE2", "CDCI2_RSTZ",
    				  "USB2.0_MUX_SEL", "CANUART_MUX_SEL0", 
    				  "CANUART_MUX1_SEL1", "ENET1_EXP_PWRDN", "ENET1_EXP_RESETZ",
    				  "ENET1_I2CMUX_SEL", "ENET1_EXP_SPARE2", "ENET2_EXP_RESETZ",
    				  "USER_INPUT1", "USER_LED1", "USER_LED2";
    
    		p13-hog {
    			/* P13 - CANUART_MUX_SEL0 */
    			gpio-hog;
    			gpios = <13 GPIO_ACTIVE_HIGH>;
    			output-high;
    			line-name = "CANUART_MUX_SEL0";
    		};
    
    		p15-hog {
    			/* P15 - CANUART_MUX1_SEL1 */
    			gpio-hog;
    			gpios = <15 GPIO_ACTIVE_HIGH>;
    			output-high;
    			line-name = "CANUART_MUX1_SEL1";
    		};
    	};
    };

    Here is my dts. "ifconfig -a" didn't show mcan3 or mcan5.  Please help me check if I did it right.

  • Hi Kong,

    Three things:

    1. AUDIO_MUX_SEL - can you set this to high instead of low?
    2. What is set for DIP switches 2?
    3. Can full logs from "dmesg" be shared?

    Other than the 3 points, I do see transceiver phys in the CAN devicetree node is commented out. I'm not sure if CAN will still initialize without the phys property. However, we can check the transceiver phys setting once the above 3 points are checked.

    Regards,

    Takuma

  • root@j784s4-evm:~# ifconfig -a
    eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            ether 68:e7:4a:08:bd:80  txqueuelen 1000  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    eth1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            ether 8a:d1:60:ed:d6:28  txqueuelen 1000  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    main_mcan4: flags=128<NOARP>  mtu 16
            unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 114
    
    main_mcan16: flags=128<NOARP>  mtu 16
            unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 108
    
    mcu_mcan0: flags=128<NOARP>  mtu 16
            unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 102
    
    mcu_mcan1: flags=128<NOARP>  mtu 16
            unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 103
    
    root@j784s4-evm:~# dmesg |grep can
    [    0.629274] HugeTLB: 0 KiB vmemmap can be freed for a 1.00 GiB page
    [    0.642612] HugeTLB: 0 KiB vmemmap can be freed for a 32.0 MiB page
    [    0.655949] HugeTLB: 0 KiB vmemmap can be freed for a 2.00 MiB page
    [    0.669286] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
    [    8.199112] m_can_platform 40528000.can: m_can device registered (irq=614, version=32)
    [    8.216996] m_can_platform 40568000.can: m_can device registered (irq=615, version=32)
    [    8.230441] m_can_platform 26a1000.can: m_can device registered (irq=620, version=32)
    [    8.288569] m_can_platform 2741000.can: m_can device registered (irq=626, version=32)
    [    8.365703] m_can_platform 40568000.can mcu_mcan1: renamed from can1
    [    8.445612] m_can_platform 26a1000.can main_mcan16: renamed from can2
    [    8.518505] m_can_platform 40528000.can mcu_mcan0: renamed from can0
    [    8.538102] m_can_platform 2741000.can main_mcan4: renamed from can3
    root@j784s4-evm:~# dmesg |grep pca953
    [    1.316352] pca953x 3-0020: supply vcc not found, using dummy regulator
    [    1.323198] pca953x 3-0020: using no AI
    [    1.350491] pca953x 3-0022: supply vcc not found, using dummy regulator
    [    1.357298] pca953x 3-0022: using AI
    [    1.368136] pca953x 4-0020: supply vcc not found, using dummy regulator
    [    1.374937] pca953x 4-0020: using no AI
    [    1.408120] pca953x 5-0020: supply vcc not found, using dummy regulator
    [    1.414924] pca953x 5-0020: using no AI
    [    1.475629] pca953x 6-0020: supply vcc not found, using dummy regulator
    [    1.482439] pca953x 6-0020: using no AI
    root@j784s4-evm:~# dmesg | grep -i can
    [    0.629274] HugeTLB: 0 KiB vmemmap can be freed for a 1.00 GiB page
    [    0.642612] HugeTLB: 0 KiB vmemmap can be freed for a 32.0 MiB page
    [    0.655949] HugeTLB: 0 KiB vmemmap can be freed for a 2.00 MiB page
    [    0.669286] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
    [    7.931659] CAN device driver interface
    [    8.199112] m_can_platform 40528000.can: m_can device registered (irq=614, version=32)
    [    8.216996] m_can_platform 40568000.can: m_can device registered (irq=615, version=32)
    [    8.230441] m_can_platform 26a1000.can: m_can device registered (irq=620, version=32)
    [    8.288569] m_can_platform 2741000.can: m_can device registered (irq=626, version=32)
    [    8.365703] m_can_platform 40568000.can mcu_mcan1: renamed from can1
    [    8.445612] m_can_platform 26a1000.can main_mcan16: renamed from can2
    [    8.518505] m_can_platform 40528000.can mcu_mcan0: renamed from can0
    [    8.538102] m_can_platform 2741000.can main_mcan4: renamed from can3
    [    8.650267] tidss 4a00000.dss: [drm] Cannot find any crtc or sizes
    [    8.827015] tidss 4a00000.dss: [drm] Cannot find any crtc or sizes
    [    9.199609] tidss 4a00000.dss: [drm] Cannot find any crtc or sizes
    root@j784s4-evm:~#
    
    &main_i2c0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c0_pins_default>;
    
    	clock-frequency = <400000>;
    
    	exp1: gpio@20 {
    		compatible = "ti,tca6416";
    		reg = <0x20>;
    		gpio-controller;
    		#gpio-cells = <2>;
    		gpio-line-names = " "AUDIO_MUX_SEL",PCIE1_2L_MODE_SEL", "PCIE1_4L_PERSTZ", "PCIE1_2L_RC_RSTZ",
    				  "PCIE1_2L_EP_RST_EN", "PCIE0_4L_MODE_SEL", "PCIE0_4L_PERSTZ",
    				  "PCIE0_4L_RC_RSTZ", "PCIE0_4L_EP_RST_EN", "PCIE1_4L_PRSNT#",
    				  "PCIE0_4L_PRSNT#", "CDCI1_OE1/OE4", "CDCI1_OE2/OE3",
    				  "EXP_MUX2", "EXP_MUX3", "GESI_EXP_PHY_RSTZ";
    
    		p12-hog {
    			/* P12 - AUDIO_MUX_SEL */
    			gpio-hog;
    			gpios = <12 GPIO_ACTIVE_HIGH>;
    			//output-low;
    			output-high;
    			line-name = "AUDIO_MUX_SEL";
    		};
    	};
    
    	exp2: gpio@22 {
    		compatible = "ti,tca6424";
    		reg = <0x22>;
    		gpio-controller;
    		#gpio-cells = <2>;
    		gpio-line-names = ""CANUART_MUX2_SEL1",R_GPIO_RGMII1_RST", "ENET2_I2CMUX_SEL", "GPIO_USD_PWR_EN",
    				  "USBC_PWR_EN", "USBC_MODE_SEL1", "USBC_MODE_SEL0",
    				  "GPIO_LIN_EN", "R_CAN_STB", "CTRL_PM_I2C_OE#",
    				  "ENET2_EXP_PWRDN", "ENET2_EXP_SPARE2", "CDCI2_RSTZ",
    				  "USB2.0_MUX_SEL", "CANUART_MUX_SEL0", 
    				  "CANUART_MUX1_SEL1", "ENET1_EXP_PWRDN", "ENET1_EXP_RESETZ",
    				  "ENET1_I2CMUX_SEL", "ENET1_EXP_SPARE2", "ENET2_EXP_RESETZ",
    				  "USER_INPUT1", "USER_LED1", "USER_LED2";
    
    		p13-hog {
    			/* P13 - CANUART_MUX_SEL0 */
    			gpio-hog;
    			gpios = <13 GPIO_ACTIVE_HIGH>;
    			output-high;
    			line-name = "CANUART_MUX_SEL0";
    		};
    
    		p15-hog {
    			/* P15 - CANUART_MUX1_SEL1 */
    			gpio-hog;
    			gpios = <15 GPIO_ACTIVE_HIGH>;
    			output-high;
    			line-name = "CANUART_MUX1_SEL1";
    		};
    	};
    };
        mymcan3_pins_default: mymcan3-default-pins {
            pinctrl-single,pins = <
                J784S4_IOPAD(0x080, PIN_INPUT, 0) /* (AK34) MCASP0_AXR4.MCAN3_RX */
                J784S4_IOPAD(0x07c, PIN_INPUT, 0) /* (AJ38) MCASP0_AXR3.MCAN3_TX */
    			>;
    	};	
    
        mymcan5_pins_default: mymcan5-default-pins {
            pinctrl-single,pins = <
                J784S4_IOPAD(0x03c, PIN_INPUT, 0) /* (AK38) MCASP0_AFSX.MCAN5_RX */
                J784S4_IOPAD(0x038, PIN_INPUT, 0) /* (AK35) MCASP0_ACLKX.MCAN5_TX */
            >;
        };
        &main_mcan3 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&mymcan3_pins_default>;
    	phys = <&transceiver3>;
    };
    
    &main_mcan5 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&mymcan5_pins_default>;
    	phys = <&transceiver3>;
    };
    

  • Hi Kong,

    Can you share the full logs from dmesg?

    I do not think the transceiver3 node can be shared between multiple CAN nodes. You can try referencing this thread for MCAN5 where the engineer was able to successfully bring up MCAN5: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1434713/tda4vh-q1-enabling-main_mcan5-for-linux-on-evm

    Regards,

    Takuma