7.2. Coexistence of Linux & EtherCAT Slave Demo Application

7.2.1. Overview

This demo enables co existence of EtherCAT Slave on MCU R5F Core 1, PDK IPC Echo application on MCU R5F Core 0 and Linux on A53. This demo primarily aims to demonstrate changes required in standard Linux provided by TI SDK and changes required in EtherCAT Slave provided in RTOS SDK to coexist

7.2.2. Prerequisites

  • AM654x IDK, ES 2.0 or later

  • IDK Requires hw changes, by default PHY is configured for RGMII mode. EtherCAT requires it to be configured in MII mode

  • PROCESSOR-SDK-LINUX-AM65X_07_03_00_xx & PROCESSOR_SDK_RTOS_AM65XX_07_03_00_xx

    Note

    EtherCAT Slave will require ethercat stack. Please contact FAE supporting you for details

  • Linux has been built and able to boot AM654x IDK with generated Linux image

  • This demo has been tested in MMC/SD Boot mode only

7.2.3. Required Patches

Once is installed, all the required patches are available at (RTOS SDK Installed Directory)/processor_sdk_rtos_am65xx_07_03_00_xx/demos/ethercat_slave_linux_ipc/

  • 0001-EtherCAT-Slave-Linux-IPC.patch - Is a patch for Linux SDK

  • 0001-PRU_ICSS_EtherCAT_Migration_from_6_3_to_7_3.patch - Is a patch for RTOS SDK

  • 0002-Changes-for-IPC-and-Linux-Integration.patch - Is a patch for RTOS SDK

7.2.3.1. PROCESSOR_SDK_RTOS_AM65XX_07_03_00_xx

The patches listed below are to be applied on RTOS SDK and on component PRU-ICSS-EtherCAT_Slave_01.00.08.01 . Please contact FAE supporting you, if don’t have access to EtherCAT Slave.

  • Initialize a git repository, to enable application of the patch

    • If the SDK is installed on windows, consider installing tool such as git-scm

    • goto (RTOS SDK Installed Directory)/PRU-ICSS-EtherCAT_Slave_01.00.08.01/

    • git init - Initialize an empty git repo

    • git add . and git commit -s - Add all source into this repository

  • Alternately - Installation of git can skipped and patch could still be applied. Please Refer EtherCAT User Guide - Patch Tool

  • 0001-PRU_ICSS_EtherCAT_Migration_from_6_3_to_7_3.patch
    • This patch enables ethercat slave to be user in SDK versioned 07 03 00 - Refer EtherCAT Migration Guide for details

    • This patch could be applied with command git am

    • Below shows an examples in windows/git-scm

$ pwd
/c/ti/psdk_070300/coresdk_rtos_am65xx_07_03_00_xx/PRU-ICSS-EtherCAT_Slave_01.00.08.01
git am -s 0001-PRU_ICSS_EtherCAT_Migration_from_6_3_to_7_3.patch
$ git log

commit 2675bda7c9dbc10550d94dd1e0eb32e6dc49a513
Author: Dhaval Khandla <dhavaljk@ti.com>
Date:   Tue May 18 20:42:23 2021 +0530

    PRU_ICSS_EtherCAT_Migration_from_6_3_to_7_3

    Signed-off-by: Dhaval Khandla <dhavaljk@ti.com>
    Signed-off-by: Shivalingappa <sujith.s@ti.com>

commit 442073b6ac78193946478f1df2aac0693d5d90b4
Author: Shivalingappa <sujith.s@ti.com>
Date:   Thu May 20 14:42:22 2021 +0530

    Initial Code
  • 0002-Changes-for-IPC-and-Linux-Integration.patch
    • This patch adds a new project called ethercat_slave_full_w_hlos this project enables following

      • Allows coexistence of EtherCAT slave on MCU 11 and Linux on A53

      • Includes PDK IPC and provides echo application that interacts with A53 and MCU 11

      • W.R.T Standard EtherCAT slave this project, disables rotary input and GPIO outputs, as these are used in Linux

    • This patch could be applied with command git am

    • Below shows an examples in windows/git-scm

$ pwd
/c/ti/psdk_070300/coresdk_rtos_am65xx_07_03_00_xx/PRU-ICSS-EtherCAT_Slave_01.00.08.01
git am -s 0002-Changes-for-IPC-and-Linux-Integration.patch
$ git log

commit ac0d52744f60a0c3687fea67a028cf353a6fb6fd (HEAD -> master)
Author: Dhaval Khandla <dhavaljk@ti.com>
Date:   Tue May 18 21:03:30 2021 +0530

    Changes for IPC and Linux Integration

    Signed-off-by: Dhaval Khandla <dhavaljk@ti.com>
    Signed-off-by: Shivalingappa <sujith.s@ti.com>


commit 2675bda7c9dbc10550d94dd1e0eb32e6dc49a513
Author: Dhaval Khandla <dhavaljk@ti.com>
Date:   Tue May 18 20:42:23 2021 +0530

    PRU_ICSS_EtherCAT_Migration_from_6_3_to_7_3

    Signed-off-by: Dhaval Khandla <dhavaljk@ti.com>
    Signed-off-by: Shivalingappa <sujith.s@ti.com>

commit 442073b6ac78193946478f1df2aac0693d5d90b4
Author: Shivalingappa <sujith.s@ti.com>
Date:   Thu May 20 14:42:22 2021 +0530

    Initial Code

7.2.3.2. PROCESSOR-SDK-LINUX-AM65X_07_03_00_xx

This patch is to be applied to Linux SDK

  • 0001-EtherCAT-Slave-Linux-IPC.patch
    • Configures run R5F in split mode

    • Configures Linux to not use
      • ICSSG memory ranges, demmux ICSSG pins, ICSSG firmware load, ICSSG as eth ports and MCU UART

$ cd (Linux SDK Install Dir)/board-support/linux-5.4.74+gitAUTOINC+9574bba32a-g9574bba32a
$ git am -s 0001-EtherCAT-Slave-Linux-IPC.patch
$ git log

From 47a1b04c7be1bc5515a6f653732f76377934a81d Mon Sep 17 00:00:00 2001
From: Sujith S <sujith.s@ti.com>
Date: Mon, 17 May 2021 20:31:17 +0530
Subject: [PATCH 1/1] EtherCAT Slave, Linux & IPC

Allows concurrent execution of EtherCAT Slave on MCU 11, Linux on MPU 10 & IPC between MCU 10, MCU 11 & MPU 10

Configured Linux to
    1. Operate MCU R5F in split mode
    2. Allocate MCU MS RAM (41c00000 to 41c40000) to MCU 10
    3. Allocate MCU MS RAM (41c40000 to 41c80000) to MCU 11

Configured Linux to NOT use following
    1. ICSSG memory ranges
    2. demux ICSSG pins
    3. ICSSG firmware load
    4. ICSSG ports
    5. MCU UART

IPC on MCU 11
    1. Added IPC echo example
    2. Uses RTOS IPC driver and communicates with mcu 10 & mpu 10

Signed-off-by: Sujith S <sujith.s@ti.com>

7.2.4. Building

7.2.4.1. RTOS

The projects requires to be generated, please refer EtherCAT Slave User Guide

Key steps to note

  • Update (RTOS SDK Installed Directory)/PRU-ICSS-EtherCAT_Slave_01.00.08.01/protocols/ethercat_slave/projects/projectCreate.bat or projectCreate.sh

    • Ensure following variables are updated

    • CCS_INSTALL_DIR

    • AM65xx_PDK_INSTALL_PATH

    • AM65xx_PDK_VERSION

    • SYS_BIOS_VERSION

  • Generate project using command projectCreate.bat AM65xx r5f ethercat_slave_full_w_hlos

  • Import the generated project in CCS

  • Build the project - ensure ethercat_slave_full_w_hlos_AM65xx_r5f.out is generated

7.2.4.2. Linux

This document assumes that audience of this page has been able to build and boot AM65xx with an MMC/SD card. If not, please refer to Linux User Guide for steps & details.

Once the patch is applied (as described above), steps listed below have to be followed

  1. copy ethercat_slave_full_w_hlos_AM65xx_r5f.out to /media/(mmc/sd folder)/rootfs/lib/firmware/pdk-ipc/ipc_echo_test_mcu1_1_release_strip.xer5f

Note

The firmware for MCU 11 is being replaced with EtherCAT Application

  1. Ensure to edit (Linux SDK Install Dir)/Rule.make & update DESTDIR=/media/$USER/rootfs/

  2. make linux

  3. make linux_install

7.2.5. Run

As part of standard Linux boot sequence the MCU R5F cores are loaded with firmwares (ipc_echo_test_mcu1_0_release_strip.xer5f & ipc_echo_test_mcu1_1_release_strip.xer5f). Note that ipc_echo_test_mcu1_1_release_strip.xer5f is the EtherCAT slave binary is ethercat_slave_full_w_hlos_AM65xx_r5f

  • Once an serial cable is inserted to IDK, 4 uart terminals should be available

    • Terminal 1 : Linux console

    • Terminal 2 : RTOS/EtherCAT Slave console

    • Ensure to open both terminals

    • Configure the AM654x IDK to boot from MMC/SD - refer EVM Setup

  • Insert the MMC/SD which has Linux image and EtherCAT slave image and power up the board

    • Power the IDK

    • Enter u-boot prompt

    • setenv dorprocboot 0

    • saveenv

    • reboot the board, log below shows R5F 1 is started successfully

[   10.182797] platform 41400000.r5f: assigned reserved memory node r5f-dma-memory@a1000000
[   10.198376] remoteproc remoteproc1: 41400000.r5f is available
[   10.276254] remoteproc remoteproc1: powering up 41400000.r5f
[   10.282154] remoteproc remoteproc1: Booting fw image am65x-mcu-r5f0_1-fw, size 4938136
[   10.295420] platform 41400000.r5f: booting R5F core using boot addr = 0x0
[   10.306106]  remoteproc1#vdev0buffer: assigned reserved memory node r5f-dma-memory@a1000000
[   10.315474] virtio_rpmsg_bus virtio1: rpmsg host is online
[   10.324813]  remoteproc1#vdev0buffer: registered virtio1 (type 7)
[   10.331054] remoteproc remoteproc1: remote processor 41400000.r5f is now up
  • RTOS EtherCAT Slave console prints EtherCAT Slave details

Version - EtherCAT Slave 01.00.08.01
Board name      : ¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ@eÇAÿÿÿÿÿÿÿÿÿÿÿÿeZÄAÿÿÿÿ!ÅA
Board Revision  : ¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ@eÇAÿÿÿÿÿÿÿÿÿÿÿÿeZÄAÿÿÿÿ!ÅA
EtherCAT Device
SYS/BIOS EtherCAT Internal application 3.3.0
Revision/Type : x0590 Build : x04ef
Firmware Version : 5.4.239

7.2.6. Testing Done

Basic sanity testing has been completed with TwinCAT XAE Shell

7.2.7. Logs

Logs from the last run is as below