Project

General

Profile

Example MCAN on the A53 MPU

Goal

The goal of this example is to demonstrate how to use the mcan interfaces from the A53 MPU with a simple loop back test.

The som has three mcan buses. One is connected to the A53 MPU, and two are connected to the MCU M4. The two connected to the MCU M4 are broken out on the devboard and can easily be accessed. Starting in the 09 SDK, the A53 MPU can now access the two MCU mcan busses, however this is done in a polling mode and does not support interrupts.

CAN can be used for:
  • Communicate with other systems without a host computer
  • Interfacing with external devices

See more info here: https://www.ti.com/lit/an/spracu9/spracu9.pdf

Please see this wiki page for accessing the can devices from the MCU M4: M4F_MCU_MCAN

Enable

To enable access to the CAN devices from the A53 MPU, you must enable the device tree overlay. This can be done u-boot with the following command:
setenv name_overlays k3-am62x-mitysom-mcan.dtbo 

To make this change permanent, add this line to your uEnv.txt (likely in /run/media/boot-mmcblk1p1):
name_overlays=k3-am62x-mitysom-mcan.dtbo

Note the device tree overlay file is different for each of the MitySOM-AM62, MitySOM-AM62A, and MitySOM-AM62P:
  • MitySOM-AM62 : k3-am62x-mitysom-mcan.dtbo
  • MitySOM-AM62A : k3-am62a7-mitysom-mcan.dtbo
  • MitySOM-AM62P : k3-am62p-mitysom-mcan.dtbo

Setup

To bring up mcan0 run. The recommended bitrate is 500000

ip link set mcu_mcan0 type can bitrate <bitrate>
ifconfig mcu_mcan0 up

Note: mcan1 is the same, just replace mcu_mcan0 with mcu_mcan1

Testing

To test if the mcan devices are working, we can connect them together and run a simple loopback test:

  • Connect the mcan terminals with jumper cables as shown:

clipboard-202301310836-hk2nn.png

  • Install one of the termination jumpers (J17/J18):

clipboard-202301301440-0gped.png

  • Download and run the cantest.sh
    • Note: you will need to bring up both mcu_mcan0 and mcu_mcan1 up for this test to run

Go to top
Add picture from clipboard (Maximum size: 1 GB)