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: CAN access from Linux - using TDA4VM SK

Part Number: TDA4VM


(on behalf of a customer)

Hello,

 

Is there a solution to directly access CAN ports from TDA4VM SK A72/Linux side?

 

Ideally Linux accessing the CAN peripheral directly, alternatively communicating to MCUSW from Linux.

This needs to be usable for the TDA4VM Starter Kit board, i.e. the TDA4VM SK SDK needs to be used.

 

Thanks, Stefan

  • Hi Stefan,

    I tested internal loopback for CAN on the SK EVM, please see the below logs.

    tda4vm-sk login: [   25.339217] process 'docker/tmp/qemu-check010933481/check' started with executable stack
    
    tda4vm-sk login: root
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps# dmesg | grep -i can
    [    0.659909] sysfs: cannot create duplicate filename '/devices/platform/dma_buf_phys'
    [    7.718414] CAN device driver interface
    [    8.099101] tidss 4a00000.dss: [drm] Cannot find any crtc or sizes
    [    9.581775] m_can_platform 40528000.can: m_can device registered (irq=20, version=32)
    [    9.595913] m_can_platform 2701000.can: m_can device registered (irq=42, version=32)
    [    9.611884] m_can_platform 2751000.can: m_can device registered (irq=44, version=32)
    [    9.627052] m_can_platform 2791000.can: m_can device registered (irq=46, version=32)
    root@tda4vm-sk:/opt/edge_ai_apps# ip link set can0 type can bitrate 1000000 dbitrate 5000000 fd on loopback on
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps# ip link set can0 up
    [  477.749173] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps# candump can0 &
    [1] 1398
    [  485.846762] can: controller area network core
    [  485.851167] NET: Registered protocol family 29
    root@tda4vm-sk:/opt/edge_ai_apps# [  485.861522] can: raw protocol
    
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps# cansend can0 113##2AAAAAAAA
      can0  113  [04]  AA AA AA AA
      can0  113  [04]  AA AA AA AA
    root@tda4vm-sk:/opt/edge_ai_apps# cansend can0 113##2AAAAAAAA
      can0  113  [04]  AA AA AA AA
      can0  113  [04]  AA AA AA AA
    root@tda4vm-sk:/opt/edge_ai_apps# cansend can0 113##2AAAAAABB
      can0  113  [04]  AA AA AA BB
      can0  113  [04]  AA AA AA BB

    I am yet to test Tx and Rx from the board for which I would need to make sure the CAN transceiver configuration is correct for the SK.

    As far as the driver is concerned with internal loopback working fine, that piece is flow flushed and you can use CAN directly from A72 running Linux.

    I will post back with the patches to enable the CAN transceiver and pinmux for the CAN on this thread.

    Regards

    Karan

  • Hi Stefan,

    I tested Tx from the SK and that works fine too. Essentially the transceiver configuration was already taken care of by the DTB in the SDK.

    Please find the below logs:

    tda4vm-sk login: [   21.820376] Initializing XFRM netlink socket
    root
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps# [   25.158189] process 'docker/tmp/qemu-check694855289/check' started with executable stack
    rate 5000000 fd onype can bitrate 1000000 dbitr
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps# ip link set can0 type can bitrate 1000000 dbitrate 5000000 fd on
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps# ip link set can0 up
    [   67.103316] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps#
    root@tda4vm-sk:/opt/edge_ai_apps# cansend can0 113##2AAAAAAAA
    [   75.662276] can: controller area network core
    [   75.666667] NET: Registered protocol family 29
    [   75.678134] can: raw protocol
    root@tda4vm-sk:/opt/edge_ai_apps# cansend can0 113##2AAAAAAAB
    root@tda4vm-sk:/opt/edge_ai_apps#

    Reception on PCAN tool:

    Regards

    Karan

  • Hello Karan,

    thanks a lot for validating!

    Not sure what that means for the customer, does the current SDK include all code? or is there a patch required?

    Thanks in advance, Stefan

  • Hi Stefan,

    No additional patches required, I tested on the plain vanilla SDK for Starter Kit.

    I used the latest available at https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-SK-TDA4VM 

    Regards

    Karan

  • just to add, the customer could reproduce the test case successfully, thanks!