AM62A7: soc mcan0 instance can not found on linux.

Part Number: AM62A7

Tool/software:

Hi ti expert,

I want to use the mcan0 device on the linux side. so I add a new node in the k3-am62a7-sk.dts  as follow:

kernel/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts:

///// Add by mason 2024/11/07 begin /////

aliases {
serial0 = &mcu_uart0;
serial1 = &wkup_uart0;
serial2 = &main_uart0;
mmc0 = &sdhci0;
mmc1 = &sdhci1;
ethernet0 = &cpsw_port1;
spi0 = &ospi0;
can0 = &nullmax_can;
};


main_mcan0_pins_default: main-mcan0-pins-default {
pinctrl-single,pins = <
AM62PX_IOPAD(0x41DC, PIN_INPUT, 0) /* (C18) MCAN0_RX */
AM62PX_IOPAD(0x41D8, PIN_OUTPUT, 0) /* (B17) MCAN0_TX */
/*AM62PX_IOPAD(0x41D0, PIN_OUTPUT, 7) (F14) UART0_CTSN,SOC_CAN0_STBz */
>;
};
transceiver1: can-phy0 {
compatible = "ti,TJA1051TK";
#phy-cells = <0>;
max-bitrate = <5000000>;
};
nullmax_can:mason_canfd {
status = "okay";
compatible = "bosch,m_can";
pinctrl-names = "default";
pinctrl-0 = <&main_mcan0_pins_default>;
phys = <&transceiver1>;
reg = <0x00 0x20701000 0x00 0x200>,
<0x00 0x20708000 0x00 0x8000>;
reg-names = "m_can", "message_ram";
power-domains = <&k3_pds 98 TI_SCI_PD_EXCLUSIVE>;
clocks = <&k3_clks 98 6>, <&k3_clks 98 1>;
clock-names = "hclk", "cclk";
/* ======================== GICSS0_COMMON_0_INTERRUPT_MAP TRM page:1231 =====================================
MCAN0_COMMON_0_MCANSS_EXT_TS_ROLLOVER_LVL_INT_0 GICSS0_COMMON_0_SPI_IN_186
MCAN0_COMMON_0_MCANSS_MCAN_LVL_INT_0 GICSS0_COMMON_0_SPI_IN_187
MCAN0_COMMON_0_MCANSS_MCAN_LVL_INT_1 GICSS0_COMMON_0_SPI_IN_188
*/
interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1";
bosch,mram-cfg = <0x0 128 64 64 64 64 32 32>;
};
///// Add by mason 2024/11/07 end /////
};

And I remove main_mcan0 node in the arch/arm64/boot/dts/ti/k3-am62a-main.dtsi as follow:

/*
main_mcan0: can@20701000 {
compatible = "bosch,m_can";
reg = <0x00 0x20701000 0x00 0x200>,
<0x00 0x20708000 0x00 0x8000>;
reg-names = "m_can", "message_ram";
power-domains = <&k3_pds 98 TI_SCI_PD_EXCLUSIVE>;
clocks = <&k3_clks 98 6>, <&k3_clks 98 1>;
clock-names = "hclk", "cclk";
interrupts = <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1";
bosch,mram-cfg = <0x0 128 64 64 64 64 32 32>;
status = "disabled";
};*/

After updated the DTB and reboot the linux. I can NOT found the can0 device:

And I fond some error via dmesg command:

In MCU1-0 only mcu_can0 and mcu_can1 be used.

SDK version: 9.2 

can you help me to analysis analyze the root cause?

thank you .

  • Hi, are you using a custom board or TI EVM board?

    You will need to apply the MCAN overlay file if your board doesnot have an on-board transceiver

    Please refer this document to perform CAN communication:
    https://software-dl.ti.com/processor-sdk-linux/esd/AM62AX/10_00_00/exports/docs/linux/How_to_Guides/Target/How_to_test_MCAN_on_AM62x.html

    Regards,
    Aparna

  • Hi, are you using a custom board or TI EVM board?

    ----custom board 

      

  • You will need to apply the MCAN overlay file if your board doesnot have an on-board transceiver

    -------- I have add  an new transceiver device node.

  • Hi,

    The compatible drivers supported for CAN transceivers are only the following:

    I could not find "ti,TJA1051TK" in the linux source code.

    How is ti,TJA1051TK mapped to CAN driver?

    Regards,
    Aparna

  • Hi, Aprama.

    thank you for your response.

    I have solved this issue via modify the transceiver1 node's compatible as follow:

    ---------------------

    transceiver1: can-phy1 {
    compatible = "ti,tcan1042";
    #phy-cells = <0>;
    max-bitrate = <5000000>;
    pinctrl-names = "default";
    pinctrl-0 = <&mcu_mcan1_gpio_pins_stb>;
    standby-gpios = <&mcu_gpio0 23 GPIO_ACTIVE_HIGH>;
    };

    -----------------------

    Now I can found the the can0 instance on linux side:

    But a new issue is appeared,

    I can sent can frame via can0:

    root@am62axx-evm:/opt/edgeai-gst-apps# cansend can0 213##311223344
    [ 795.407307] can: controller area network core
    [ 795.411774] NET: Registered PF_CAN protocol family
    [ 795.431924] can: raw protocol

    And my upping debugging device(ZLG's USBCANFD-200U ) can capture the CAN telegram sent by linux. 

    but when I try capture  can telegram on the linux side via can0, nothing to receive:

    root@am62axx-evm:/opt/edgeai-gst-apps# candump can0

    would you help me?

    thank you.

  • Hi,

    What is the SDK version being used?

    Could you share the snapshot of the CAN frame that you are trying to send from ZLG software? I need to check the bit timing configurations.

    Have you tried with all the CAN instances? Is there any difference in behavior between main and mcu domain CANs?

    Regards,
    Aparna

  • SDK Versin: 9.2

    this is connection graph:

    Note: Channel0 and Channel1 external 120 ohm resistor, and build int 120 ohm is enable, so CAN0 and CAN1 bus resistor is 60 ohm.

    only  MCU_CAN0 and MCU_CAN1 is controlled by MCU1-0, only  SOC_CAN0 is controlled by Linux.

    SOC_CAN0 map to can0 on linux. SOC_CAN0 is setup by ip link command:

    ip link set can0 type can bitrate 500000 sample-point 0.8 dbitrate 2000000 dsample-point 0.8 berr-reporting on fd on restart-ms 1000

    Now. SOC_CAN0 can send out telegram normal. cand ZLG software can captured successfully.

    But when the ZLG send to telegram to CAN1,  the linux CAN0  nothing to received:

  • Hi Aparna,

    Would you have some idea for this topic?