CAN

The phyCORE-AM64x SOM provides two Controller Area Network (MCAN) ports. Both interfaces support CAN and CAN FD (flexible data-rate) specifications, conforming with CAN protocol version 2.0 part A, B and ISO 11898-1:2015. The development kit breaks out both CAN0 and CAN1 interfaces to the X2 and X3 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-AM64x CAN serial interface, please see section 7.1 in the Hardware Manual.

phyCORE-AM64x CAN Location

Requirements

Setup the CAN Network

  • Connect one of the D-sub 9 ribbon cables (included in development kit) to the CAN0 connector X2 (red line indicates Pin 1).

  • Connect the PCAN-USB adapter to your host PC (USB port) and the D-sub 9 ribbon cable that is now attached to the CAN0 connector X2 on the development kit.

CAN Connection Diagram

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-AM64x Linux console, use the following commands to set up the CAN0 interface and configure the bit rate. The target device (the development kit) will need to reflect the same bit rate used by the host PC.

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 transfers from the phyCORE-AM64x to the host PC.

  • Make sure PCAN View is open on your host PC.

  • Enter the following commands into the phyCORE-AM64x Linux console to send data on the CAN bus:

Target (Linux)
cansend can0 000#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-AM64x.

  • Enter the following command into the phyCORE-AM64x Linux 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. DEADBEEDCAFEBABE is the data (hex) used for this example:

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

  • In the phyCORE-AM64x Linux console, you should see that the message has been received:

Target (Linux)
root@phyboard-electra-am64xx-2:~# candump can0
can0  000   [8]  DE AD BE ED CA FE BA BE
  • To exit listening mode on the phyCORE-AM64x enter Ctrl + C to stop candump