Project

General

Profile

AM62 MCAN Interface

The AM62 devkit supports 2 CAN interfaces, controlled by the M4 processor (MCUSS). These interfaces are available on the devkit via J11 (MCAN0) and J12 (MCAN1) [ pins 256/258 MCU_MCAN0_TX/RX pins 252/254 MCU_MCAN1_TX/RX ].

Objective

This example demonstrates a simple loopback between the 2 CAN interfaces from the MCU processor. It is heavily based on the TI example project, which was a single interface loopback.

Prerequisites

To run this example, you will need to have installed Code Composer and the TI SDK as shown in the M4FMCU_Development page

Steps

  1. Connect the 2 CAN interfaces together as shown here

    clipboard-202301310836-hk2nn.png

  2. Install one of the termination jumpers (J17/J18)

    clipboard-202301301440-0gped.png

Example project

  1. This project is available on the Critical Link Git repository (https://support.criticallink.com/gitweb/?p=mcan_loopback_polling_am62x-sk_m4fss0-0_freertos_ti-arm-clang.git;a=summary)
  2. Clone the repository and then import the project into code Composer Studio
    1. From the Project menu, select Import CCS Projects...

      clipboard-202301310825-sxese.png

    2. With Select search-directory selected, Click the "Browse..." button and Select the working directory you cloned

      clipboard-202301310825-ga2l0.png

    3. Make sure the mcan_loopback project is selected and click "Finish"

      clipboard-202301310826-1saar.png

    4. The project includes a target configuration suitable for JTAG connection via an XDS200 emulator pod.
  3. Build the project
    The output file will located at Debug/mcan_loopback_polling_am62x-sk_m4fss0-0_freertos_ti-arm-clang.out

Load the program

The loopback program can be loaded using JTAG or Remoteproc:

JTAG
  • Launch Am62x Target configuration
    • Open Target Configurations View
    • Expand the Projects, expand macn_loopback..., expand targetConfigs
    • Double click on AM62.ccxml to change/test the connection if necessary
    • Select AM62.ccxml, right-mouse->Launch Selected Configuration
  • Connect to target.
    • Select BLAZER_Cortex_M4F_1, right-mouse->Connect Target
  • Reset CPU.
    • Menu Bar->Run->Reset->CPU Reset
  • Load program.
    • Menu Bar->Run->Load->Load Program.
    • Browse Project. Pick debug executable (mcan_loopback....arm_clang.out)
      • Press OK
    • Press OK
    • If the program does not start running, you may have to select continue.
    • Output will appear in Code Composer and on the M4 uart.
Remoteproc
  • Apply patches to the imported project
  • Build release version
  • Copy release version to /lib/firmware/loopback_polling/am62-mcu-m4f0_0-fw
ssh target_62x mkdir -p /lib/firmware/loopback_polling
scp Release/mcan_loopback_polling_am62x-sk_m4fss0-0_freertos_ti-arm-clang.out target_62x:/lib/firmware/loopback_polling
  • Link /lib/firmware/am62-mcu-m4f0_0-fw to loopback_polling
ssh target_62x ln -sf /lib/firmware/loopback_polling/mcan_loopback_polling_am62x-sk_m4fss0-0_freertos_ti-arm-clang.out /lib/firmware/am62-mcu-m4f0_0-fw
  • On the target
    • See the different remote processors
cd /sys/class/remoteproc
tail */name
  • Pick out the one for the mcu (e.g. remoteproc0) and see the current state of the processor.
tail *0/state
  • Stop the processor
echo 'stop' > *0/state
  • Start the processor (will load the new program)
echo 'start' > *0/state
  • Output will appear on the M4 uart.

Conclusion

This example sets the stage for using the MCAN interfaces from the MCU. The M4 image can be loaded and run from Linux on the A53 processor using the remoteproc Framework.
Inter-processor communication is then supported via Linux rpmsg device (TI has written one for their processor families)

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