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.

[FAQ] SK-TDA4VM: How do I use the CAN bus headers on SK-TDA4VM using Edge AI SDK?

Part Number: SK-TDA4VM

The SK-TDA4VM has 4 CAN bus interface. How can these be used?

  • Prerequisite: Download and flash Edge AI SDK prebuilt micro SD card image. This FAQ was made using 8.2 version of SDK: https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-SK-TDA4VM/08.02.00.02.

    The Edge AI SDK's prebuilt SD card image comes packaged with the same Linux driver for CAN as used in PSDK Linux. The CAN bus can be enabled and used as documented here: https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-jacinto7/08_02_00_03/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/MCAN.html

    Linux discovers the CAN bus instances with the following names:

    can0=J1=MCU_CAN0
    can1=J5=CAN0
    can2=J6=CAN5
    can3=J2=CAN9

    The header pins are defined like so (taken from SK userguide https://www.ti.com/lit/ug/spruj21b/spruj21b.pdf?ts=1651850889758&ref_url=https%253A%252F%252Fwww.google.com%252F):

    Running "ifconfig -a" should show available CAN interfaces like below logs:

    root@am69a-sk:/opt/edgeai-gst-apps# ifconfig -a
    can0: 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 235
    
    can1: 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 236
    
    can2: 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 237
    
    can3: 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 238
    
    eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            ether 08:04:b4:2e:8f:39  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 92  bytes 7642 (7.4 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 92  bytes 7642 (7.4 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    root@am69a-sk:/opt/edgeai-gst-apps#
    

    To test CAN driver, we can do a loopback by connecting two CAN bus on SK board, then running the following commands:

    root@j721e-eaik:~# ip link set can0 type can bitrate 500000
    root@j721e-eaik:~# ip link set can1 type can bitrate 500000
    root@j721e-eaik:~#
    root@j721e-eaik:~#
    root@j721e-eaik:~#
    root@j721e-eaik:~# ip link set up can0
    root@j721e-eaik:~# ip link set up can1
    root@j721e-eaik:~#
    root@j721e-eaik:~#
    root@j721e-eaik:~# candump can0 &
    [2] 1220
    root@j721e-eaik:~# cansend can1 123#1122334455667788
      can0  123   [8]  11 22 33 44 55 66 77 88
    root@j721e-eaik:~#

    Regards,

    Takuma