CAN

The phyCORE-AM62Ax SOM can support three CAN interface. The development kit has one CAN port easily available for interaction. The MCAN0 interface is accessible at the X9 pin header 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-AM62Ax CAN interface, please see section 7.1 in the Hardware Manual.

phyCORE-AM62Ax 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-AM62Ax 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-AM62Ax to the host PC.

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

  • Enter the following commands into the phyCORE-AM62Ax 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-AM62Ax.

  • Enter the following command into the phyCORE-AM62Ax 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-AM62Ax Linux console, you should see that the message has been received:

    Expected Output
    root@phyboard-lyra-am62axx-2:~# candump can0
    can0  000   [8]  DE AD BE ED CA FE BA BE
    can0  000   [8]  DE AD BE ED CA FE BA BE
    can0  000   [8]  DE AD BE ED CA FE BA BE
    
  • To exit listening mode on the phyCORE-AM62Ax enter Ctrl + C to stop candump