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.

TDA4VM: TDA4 can device

Part Number: TDA4VM

Hi,all:

There are six can interfaces on our carrier board,However, can devices are not loaded in order when the system starts.

So,how can I do to make it in order to load?

Thanks a lot!

  • Hi Yst,

    Could you clarify what the purpose is for loading the CAN interface in order? If the purpose is to have a specific CAN bus have a specific ID, then this FAQ can be referenced: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1267036/faq-am69-how-can-i-assign-interface-id-to-can-modules.

    Regards,

    Takuma

  • Is the intent to get the module probe happen in order or to have the CAN interface IDs in a specified order?

    If it is he latter, the FAQ posted by Takuma will help.

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1267036/faq-am69-how-can-i-assign-interface-id-to-can-modules

    Regards

    Karan

  • Hi Takuma,

    I want to use the CAN interfaces can0, can1, can2 and can3 from Linux user space ,and I hope it can correspond to the number on my board.

    I tried the method mentioned above,but it can not work.

    So,how can I do to make it in order to load?

    Regards,

    Yst

  • Hi Yst

    I'm still unclear on what is the end goal here?

    I want to use the CAN interfaces can0, can1, can2 and can3 from Linux user space ,and I hope it can correspond to the number on my board.

    Can you please elaborate more on this? Also have you looked at this FAQ to update the udev rules?

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1267036/faq-am69-how-can-i-assign-interface-id-to-can-modules

    Regards

    Karan

  • Hi Karan,

    When the system is up,I hope can0 in Linux user space to correspond to can0 on my board.But now,can drivers are not loaded in order.Therefore, the can0 device node may correspond to the can5 interface on my board.Like this:

    The can devices are registered in a different order each time the system starts.

    Regards,

    Yst

  • Hi Yst

    Can you mention what do SoC CAN instances map to the can0, can1 .. instances on your board?

    The SoC CAN instances are MCAN0, MCAN1.. and so on for the MAIN domain and MCU_MCAN0 and MCU_MCAN1 in the MCU domain.

    The FAQ I pointed to exactly tries to do what you want.

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1267036/faq-am69-how-can-i-assign-interface-id-to-can-modules

    #11-can-mylocal.rules

    KERNELS=="40528000.can", ACTION=="add", NAME="can1"
    KERNELS=="40568000.can", ACTION=="add", NAME="can0"
    KERNELS=="2771000.can", ACTION=="add", NAME="can6"
    KERNELS=="2761000.can", ACTION=="add", NAME="can7"

    The above would map can1 to MCU_MCAN0, can0 to MCU_MCAN1, can6 to MCAN7 and can7 yo MCAN6.

    Regards

    Karan

  • Hi,Karan

    I tried the methods mentioned above, but it can not work

    I want the can drivers to be loaded sequentially,like this:

    Registration of can drivers in this order can correspond to the serial number of the CAN hardware interface on my board.

    But now,registration of can drivers is random.

    Regards,

    Yst

  • Hi Yst

    Can you mention what do SoC CAN instances map to the can0, can1 .. instances on your board?

    Can you please answer this?

    Also, please share the new udev rule you added for CAN.

    Regards

    Karan

  • Hi Karan,

    The following is the can on my board:

    I want it to correspond to the can interface on my soc.

    The following is my udev rule:

    Regards,

    Yst

  • Hi Yst

    I tried to use the same udev rule you had and I'm able to get the expected result.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    root@am69-sk:~# cat /etc/udev/rules.d/06-can-load.rules
    #06-can-load.rules
    KERNELS=="2701000.can", ACTION=="add", NAME="can0"
    KERNELS=="2711000.can", ACTION=="add", NAME="can1"
    KERNELS=="2731000.can", ACTION=="add", NAME="can2"
    KERNELS=="2741000.can", ACTION=="add", NAME="can3"
    KERNELS=="2751000.can", ACTION=="add", NAME="can4"
    KERNELS=="2771000.can", ACTION=="add", NAME="can5"
    root@am69-sk:~#
    root@am69-sk:~#
    root@am69-sk:~#
    root@am69-sk:~# ls -la /sys/class/net/can*/device
    lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can0/device -> ../../../2701000.can
    lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can1/device -> ../../../2711000.can
    lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can2/device -> ../../../2731000.can
    lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can3/device -> ../../../2741000.can
    lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can4/device -> ../../../2751000.can
    lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can5/device -> ../../../2771000.can
    root@am69-sk:~#
    root@am69-sk:~#
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Can you check if your udev rule is getting triggered? Are there any other rules which are overwriting this?

    Refer this thread - https://unix.stackexchange.com/questions/200194/how-to-debug-an-udev-rule-in-etc-udev-rules-d

    Regards

    Karan