CAN

The phyCORE-AM57x SOM can support six CAN interfaces. The development kit has two CAN port that is easily accessible for interaction. The development kit breaks out both CAN1 and CAN2 interfaces to the X6 and X5 headers respectively for general purpose evaluation. This guide will walk-through the basic usage of this interface by transferring data to and from a host PC provisioned with PCAN-View Software. To learn more information about the phyCORE-AM57x CAN serial interface, please see section 17 in the Hardware Manual.

phyCORE-AM57x CAN Locations

Requirements

Setup the CAN Network

  • Connect the PCAN-USB adapter to your host PC (USB port) and the CAN1 connector at X6 on the development kit.

    CAN1 to Carrier Board Connection CAN Connection Diagram

Note

When the carrier board is the end point of a CAN network add 120Ohm termination impedance by closing either JP1 or JP2. JP1 impacts the impedane or CAN1. JP2 impacts the impedance of CAN2. Please see the Hardware Manual for more information.

../_images/pb-057948_can-jp1-jp2.png

Setup CAN Software

  • Open PCAN-View on your host PC and select the device from the available hardware. Set the Bit rate field to 1 Mbit/s and click OK.

Note

If you cannot find your device in the listed hardware, ensure that you have the correct driver installed on your host PC. You can obtain the driver here.

  • Using the phyCORE-AM57x Linux console, use the following commands to set up the CAN1 interface (CAN0 in software) and configure the bit rate. For this example 1 MBit/s is used.

    Target (Linux)
    ip link set can0 down
    ip link set can0 up type can bitrate 1000000
    ip link set can0 up
    

Send CAN messages

In this example you will test data transfer from the phyCORE-AM57x to the host PC.

  • Make sure PCAN View is open on your host PC

  • Enter the following on the phyCORE-AM57x console to send data on the CAN bus.

    Target (Linux)
    cansend can0 001#DE.AD.BE.EF.CA.FE.BA.BE
    
  • In PCAN-View verify that the data is correct in the “Receive” window.

Receive CAN messages

In this example you will test data traveling in the opposite direction - from the host PC to the phyCORE-AM57x.

  • Enter the following command on the phyCORE-AM57x console to put the CAN interface into listening mode:

    Target (Linux)
    candump can0
    
  • On your host PC in PCAN-View, create a new transmit message. Enter DEADBEEFCAFEBABE as the data (hex).

  • Select the message. You can press the space-bar a few times to send the message more than once.

  • On the phyCORE-AM57x you should see that the message has been received.

    Expected Output
    root@phycore-am57xx-1:~# candump can0
    can0  000   [8]  DE AD BE EF CA FE BA BE
    
  • To exit listening mode on the phyCORE-AM57x enter Ctrl + C to stop candump