CAN

The phyCORE-AM62x SOM can support three CAN interfaces. The development kit has one CAN port that is easily accessible for interaction. The MCAN0 interface is accessible at the X9 pin header for general purpose evaluation. This guide will walk you 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-AM62x CAN interface, please see section 7.1 in the Hardware Manual.

phyCORE-AM62x CAN

Requirements

Setup the CAN Network

  • Connect the D-sub 9 ribbon cable to the CAN0 connector X9 (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 X9 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-AM62x 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 main_mcan0 down
    ip link set main_mcan0 up type can bitrate 1000000
    ip link set main_mcan0 up

Send CAN Messages

In this example you will test data transfers from the phyCORE-AM62x to the host PC.

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

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

    Target (Linux)
     cansend main_mcan0 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-AM62x.

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

    Target (Linux)
     candump main_mcan0
    
  • 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-AM62x Linux console, you should see that the message has been received:

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