Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] How to set up an EtherCAT System with AM6xx MainDevice and AM64/AM243 SubDevice using CODESYS Development System

Other Parts Discussed in Thread: UNIFLASH

This FAQ walks the user through setting up an industrial networking EtherCAT system in CODESYS using an AM6xx MainDevice and one-or-more AM64x/AM243x SubDevice(s). Instructions are provided to set up MainDevice, SubDevice(s), and build the project & visualization in CODESYS Development System to control test LEDs on the SubDevice(s) from the MainDevice

Software versions tested in this documentation:

AM62x Processor SDK version: ti-processor-sdk-linux-rt-am62xx-evm-09.00.00.03 & ti-processor-sdk-linux-rt-am62xx-evm-08.06.00.45: https://www.ti.com/tool/PROCESSOR-SDK-AM62X#downloads

AM243x MCU+ SDK version: mcu_plus_sdk_am243x_08_05_00_24 (as of this writing, the AM243x-LP (HSFS) EtherCAT example demo does not work on MCU+ SDK 08_06. AM243x-EVM does not have this issue): https://www.ti.com/tool/download/MCU-PLUS-SDK-AM243X/08.05.00.24

Code Composer Studio version: Match CCS version to the version listed in the MCU+ SDK: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/latest/exports/docs/api_guide_am243x/CCS_SETUP_PAGE.html#autotoc_md21

CODESYS Development System: CODESYS Development System V3 3.5.19.10:

(US store) https://us.store.codesys.com/codesys.html 

(International store) https://store.codesys.com/en/

CODESYS Control for Linux ARM64 SL: CODESYS Control for Linux ARM64 SL 4.9.0.0.package & CODESYS Control for Linux ARM64 SL 4.2.0.0.package:

(US store) https://us.store.codesys.com/codesys-control-for-linux-arm-sl-bundle.html 

(International store)

Old Link: https://store.codesys.com/en/codesys-control-for-linux-arm-sl-bundle.html 

Updated Link: https://us.store.codesys.com/codesys-control-for-linux-arm-sl-1.html 

System set up instructions overview (clickable links):

  1. Set up AM6xx EtherCAT MainDevice
  2. Set up AM64x/AM243x EtherCAT SubDevice(s)
  3. Build project in CODESYS desktop software, build visualization, & test system

Demo:

  • System set up instructions overview (clickable links):

    1. Set up AM6xx EtherCAT MainDevice <--- You are here
    2. Set up AM64x/AM243x EtherCAT SubDevice(s)
    3. Build project in CODESYS desktop software, build visualization, & test system

    Steps to get AM6xx working as the EtherCAT MainDevice:

    1. Install RT Linux on AM62x. Follow AM62x Quickstart Guide: https://dev.ti.com/tirex/content/tirex-product-tree/am62x-devtools/docs/am62x_skevm_quick_start_guide.html
    2. Download & install as administrator CODESYS Development System V3 64 bit
    3. Create account to download the software. There is no cost to download and use the software for demonstration purposes
    4. This software is only available on Windows OS
    5. CODESYS Development System V3 needs to be installed as administrator. Administrator rights allows installer to install dependencies user does not already have installed on their system, such as: Code Meter Runtime, Microsoft VC redistributable 2013 x86, Microsoft VC redistributable 2013 x64, etc.
    6. To install as administrator, right-click the “CODESYS 64 <version>.exe” and click “Run as administrator”
    7. Download CODESYS Control for Linux ARM64 SL <version> 64 bit from the CODESYS store link at the top of the documentation
    8. Double-click “CODESYS Control for Linux ARM64 SL <version>.package” and select “CODESYS 64 <version>”. Click “Continue” to install package
    9. Follow modified instructions here to copy & install CODESYS files necessary to set up the AM62x-EVM as an EtherCAT MainDevice to the root directory of your Linux installation on the AM62x-EVM microSD card: https://software-dl.ti.com/mcu-plus-sdk/esd/AM64X/latest/exports/docs/industrial_protocol_docs/am64x/ethercat_slave/plc_codesys_am64x.html
      1. Right-click “CODESYS Control for Linux ARM64 SL <version>.package” and extract contents to a new folder (replace <version> with the actual version of the file)
      2. The following will appear in the extracted folder:
      3. Locate the following files in the extracted folder:
        1. Delivery/codesyscontrol_linuxarm64_<version>_arm64.deb
        2. Delivery/codesyscontrol_linuxarm64_<version>_arm64.ipk (version 4.9.0.0 and newer)
        3. Dependency/codemeter-lite_<version>_arm64.deb
    1. AM62x should be running Linux and you should be connected to the device via USB before beginning the next steps
    2. The following steps will outline how to copy the files listed below to the AM62x Linux root directory (<username>/root/home/root) over a network connection
      1. Delivery/codesyscontrol_linuxarm64_<version>_arm64.deb
      2. Delivery/codesyscontrol_linuxarm64_<version>_arm64.ipk (version 4.9.0.0 and newer)
      3. Dependency/codemeter-lite_<version>_arm64.deb
    1. OLD LINK: https://software-dl.ti.com/mcu-plus-sdk/esd/AM64X/latest/exports/docs/industrial_protocol_docs/am64x/ethercat_slave/plc_codesys_am64x.html
    2. Updated LINK: https://software-dl.ti.com/processor-industrial-sw/esd/ind_comms_sdk/am64x/latest/docs/am64x/ethercat_slave/plc_codesys_am64x.html 
    3. On the link above, scroll down to “Open CODESYS Control for Linux ARM64 SL <version>.package archive file and extract the files:”
    4. In order to use the “scp” command to transfer files, you will need to set the IP address of the Ethernet port on your AM62x to be on the same subnet as the IP address of the ethernet port on your computer
    5. You can find the IP address of the ethernet port on your computer by opening a PowerShell or command prompt window (press the windows button and search for PowerShell or search for “cmd”, select the application) and type in “ipconfig” (without quotes)
    6. On the AM62x Linux terminal, you can check the IP address of the AM62x ethernet ports using the command “ip a”
    7. You can set the IP address of the ethernet port of the AM62x (eth0 is used here) by entering the following combined command in the AM62x terminal:
      1. $ ip link set dev eth0 down && ip addr add <enter ip address>/16 dev eth0 && ip link set dev eth0 up (don’t include the $)
        1. If you entered the wrong ip address, you can delete it using the following command:
          1. $ ip addr del <ip address you want to delete>/16 dev eth0
    8. After you set the IP address, use the “ping” command to confirm that you can send and receive a signal from the AM62x to your computer.
    9. In the example below, the IP address of the ethernet port (eth0) on the AM62x was set to 169.254.207.3/16 (include the /16 at the end of the IP address you choose) & the IP address of the ethernet port on the computer was 169.254.207.2 (they are on the same subnet because both IP addresses are 169.254.207.x)
    10. If you receive the error: “no matching host key type found. Their offer: ssh-rsa” after running “scp codemeter-lite_<version>deb root@<IP address AM62x Ethernet port>://home/root”
    11. Re-run the command with the addition of “-o HostKeyAlgorithms=+ssh-rsa” immediately after “scp”, i.e., for the above example (the above example uses 192.168.1.100 as the IP address), you enter:
      1. scp -o HostKeyAlgorithms=+ssh-rsa codemeter-lite_<version>_arm64.deb root@<IP address AM62x Ethernet port>://home/root
    12. Repeat the process for the second file:
      1. scp -o HostKeyAlgorithms=+ssh-rsa codesyscontrol_linuxarm64_<version>_arm64.deb root@<IP address AM62x Ethernet port>://home/root
    13. On the AM62x terminal window, confirm that both files were transferred to the root directory. Change to root directory using “cd ~” (without quotes), then type “ls” (without quotes) to list the files in the directory
    14. Confirm that you can see the following files when you run the “ls” command:
      1. codesyscontrol_linuxarm64_<version>_arm64.deb
      2. Delivery/codesyscontrol_linuxarm64_<version>_arm64.ipk (version 4.9.0.0 and newer)
      3. codemeter-lite_<version>_arm64.deb
    15. In the AM62x Linux terminal, install both files using the following two commands:
      1. opkg -V2 install ./codemeter-lite_<version>_arm64.deb (for version 4.9.0.0 and newer)
        1. opkg -V2 install –nodeps –offline-root / –add-arch arm64:13 ./codemeter-lite_<version>_arm64.deb (for version 4.2.0.0)
      2. opkg -V2 install ./codesyscontrol_linuxarm64_<version>_arm64.ipk (for version 4.9.0.0 and newer)
        1. opkg -V2 install –offline-root / –add-arch arm64:13 ./codesyscontrol_linuxarm64_<version>_arm64.deb (for version 4.2.0.0)
    16. Once both files are installed, run the CODESYS configuration on the AM62x Linux terminal using the command:
      1. /opt/codesys/bin/codesyscontrol.bin /etc/CODESYSControl.cfg
      2. The CODESYS splash screen will display
    17. Open CODESYS Development System on your Windows PC and follow the instructions here to create a new standard project:
      1. OLD LINK: https://software-dl.ti.com/mcu-plus-sdk/esd/AM64X/latest/exports/docs/industrial_protocol_docs/am64x/ethercat_slave/plc_codesys_am64x.html
      2. Updated LINK: https://software-dl.ti.com/processor-industrial-sw/esd/ind_comms_sdk/am64x/latest/docs/am64x/ethercat_slave/plc_codesys_am64x.html 
      3. Standard Project options: for “Device” drop down, select “CODESYS Control for Linux ARM64 SL”. For “PLC_PRG in” drop down, select “Structured Text (ST)”
      4. Prior to the next step, download & install AM243x MCU+ SDK onto the Windows PC
        1. Need to install the Windows version of AM243x MCU+ SDK because there are some device files in the AM243x MCU+ SDK we will be using in CODESYS Development System to identify AM243x SubDevices (and CODESYS Development System desktop software is only available on Windows OS)
          1. Install in the default location, C:\ti
          2. Open Windows File Explorer and navigate to:
            1. C:\ti\{MCU+ SDK location}\source\industrial_comms\ethercat_slave\stack\esi
            2. We are interested in the TI AM243X.R5F Simple.xml file (if you are using an AM64x-EVM, you are interested in the TI AM64X.R5F Simple.xml)
          3. Return to the project you created in CODESYS Development System desktop software
          4. In the top menu bar, navigate to Tools > Device Repository
          5. Click “Install”
          6. Navigate to C:\ti\{MCU+ SDK location}\source\industrial_comms\ethercat_slave\stack\esi
          7. Select “TI AM243x.R5F Simple.xml” or “TI AM64x.R5F Simple.xml”, depending on which SubDevice you are using, then click “Open”
          8. After the file is installed, close the Device Repository window
          9. Double click “Device (CODESYS Control for Linux ARM64 SL)” on the left side. On the “Device” tab that opens, click “Scan Network”
            1. CODESYS config needs to be running on the AM62x for the AM62x to be detected by CODESYS Development System desktop software as a MainDevice
            2. To run the CODESYS config on the AM62x terminal, use command: /opt/codesys/bin/codesyscontrol.bin /etc/CODESYSControl.cfg
            3. AM62x ethernet port’s IP address also needs to be on the same subnet as the IP address of the ethernet port on the Windows computer.
    18. If you receive an error for missing libraries in “Messages” on the bottom of the screen, click “Messages”, then double click the error and “…” button will show, click that button and download missing libraries.
      1.   
        1. This example does not have any missing libraries, but the image shows where the errors would be and top-right green box is approximately the area where the “…” button will show after double-clicking the error on the top-left green box
    19. AM62x-EVM will be listed under “Gateway-1”
      1.   
      2. If AM62x-EVM is not listed, uncheck “Hide non-matching devices, filter by Target ID”, then click “Scan Network”
        1. If AM62x-EVM is still not listed, check that you set the Ethernet IP addresses to be on the same subnet for both the AM62x and Windows PC Ethernet
    20. Click “OK” (the “OK” option is greyed out in the image above because am62xx-evm has already been added)
    21. Right-click “Device (CODESYS Control for Linux ARM64 SL” on the left and select “Add Device…”
    22. In the “Add Device” window, click the “+” to the left of “Fieldbuses”, then click the “+” to the left of “EtherCAT”, then click the “+” to the left of “Master”, select “EtherCAT Master” and click “Add Device”
    23. Click “Close” after Device is added
    24. Double-click “EtherCAT_Master (EtherCAT Master)” on the left side menu
    25. In the “EtherCAT_Master” tab that pops up, locate “Source address (MAC)”, by default it will say 00-00-00-00-00-00
    26. On the AM62x-EVM, locate the sticker on top of the RJ45 Ethernet port, this number is the MAC address of the Ethernet port. The image below is only an example, your AM62x-EVM will have a different MAC address than the image below. Use the MAC address on your AM62x-EVM
    27. Enter the MAC address listed on top of the RJ45 connector on your AM62x-EVM into the “Source address (MAC)” input box
    28. You can also click the “Select” button to the right of the input box, and choose the MAC address of your AM62x-EVM from the list. It is important to confirm that the MAC address in the list matches exactly with the MAC address sticker on top of the RJ45 connector on your AM62x-EVM
    29. It will ask you to create login credentials, click “Yes”
    30. A new window titled, “Add Device User” will pop up
    31. Set a “Name” (username) and password, then click “OK”
      1.   
      2. If you forget your username or password, you can reset the device by right-clicking “Device (CODESYS Control for Linux ARM64 SL)”
      3. Then select “Reset Origin Device [Device]”
    32. In the new window, click “Yes” to reset information on the device, then repeat the instructions from earlier to set a username and password
    33. Enter username/password to login, then click “OK”
    34. If you click “Select” that is to the right of “Source address (MAC)”, it will show a list of network adapters connected
    35. Select the MAC address in the list that matches the MAC address on the sticker on top of the RJ45 connector on your AM62x
    36. Press Ctrl + S to save changes
    37. Click the “Login” gear icon that is to the right of “Application [Device: PLC Logic]”
    38. Select, “Yes” if you receive a pop up saying “The application ‘Application’ does not exist on device ‘Device’. Do you want to create it and proceed with download?”
    39. The AM62x-EVM is now set up as an EtherCAT MainDevice in CODESYS Development System desktop software
    40. Continue onto the next steps to setup the SubDevice(s)
  • System set up instructions overview (clickable links):

    1. Set up AM6xx EtherCAT MainDevice
    2. Set up AM64x/AM243x EtherCAT SubDevice(s)  <--- You are here
    3. Build project in CODESYS desktop software, build visualization, & test system

    Steps to get AM64x/AM243x-EVM (GP), AM243x-LP (HSFS), AM243x-EVM (HSFS) working as EtherCAT SubDevice(s):

    1. Follow modified instructions below to complete Steps 1, 2, & 3: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/GETTING_STARTED.html#autotoc_md9
      1. For Step 1: Install AM243x MCU+ SDK 08_05_00_24 (as of this writing, the AM243x-LP EtherCAT example demo does not work on AM243x MCU+ SDK 08_06)
      2. For Step 2: Install Code Composer Studio, download the Windows or Linux installer depending on your system
      3. For Step 2: LINUX USERS, install TI Code Composer Studio as a superuser using “sudo” command. If you install as a “user” it will not install the drivers necessary to connect to the AM64x/AM243x devices (link for more details: https://software-dl.ti.com/ccs/esd/documents/ccsv12_linux_host_support.html). Instructions for installing drivers manually are also provided below if you do not want to install TI CCS as sudo
        1. To install CCS 12.1 as a superuser:
          1. Change directory to the extracted CCS folder using “cd” command, i.e. $ cd Downloads/CCS12.1.0.00007_linux-x64
          2. Run $ sudo ./ccs_setup_12.1.0.00007.run
          3. Enter your password
            1. If you have not set a superuser password enter the following commands before proceeding with the above step (skip this step if you have already setup your sudo password)
              1. $ sudo passwd root
              2. Enter your new password, hit enter key, retype your password, hit enter key again
          4. Go through the installation steps in the installer window, install CCS in the default directory specified in the installer for simplicity
    2. If you did not install CCS 12.1 as a super user, install the necessary libraries & drivers manually using the following commands:
      1. Open a terminal window and enter the following commands:
      2. $ sudo apt update
      3. $ sudo apt install libc6-i386 libusb-0.1-4 libgconf-2-4 libncurses5 libpython2.7 libtinfo5
      4.   
        1. I have already installed the libraries in this screenshot, your terminal log will look different (that is okay)
      5. $ cd ti/ccs1210/ccs/install_scripts
        1. If you installed CCS in another location use: $ cd <CCS install directory>/ccs/install_scripts (replace <CCS install directory> with the location of where you installed CCS)
      6. $ sudo ./install_drivers.sh
    3. For Step 3: Follow these modified instructions to Flash SOC Initialization Binary for the following devices:
      1. Go through the steps in the below link until you reach “Open a command prompt and run the below command to flash the SOC initialization binary to the”, use the following modified commands to Flash SOC Initialization Binary instructions (after setting the boot switches to UART)
      2. Flash SOC Initialization Binary instructions: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/EVM_SETUP_PAGE.html#autotoc_md30
      3. Open terminal and navigate to:
      4. $ cd ${SDK_INSTALL_PATH}/tools/boot (replace ${SDK_INSTALL_PATH} with the path to the AM243x MCU+ SDK)
        1. $ cd ~/ti/{MCU+ SDK version}/tools/boot
      5. For AM243x-LP HSFS:
        1. cfg does not exist in AM243x MCU+ SDK 08_05
        2. We will create one
        3. Open Windows Explorer window and navigate to: C:\ti\mcu_plus_sdk_am243x_08_05_00_24\tools\boot\sbl_prebuilt\am243x-lp
        4. Copy “default_sbl_null.cfg” and paste in same folder
        5. Right-click copy of default_sbl_null.cfg, click “Rename” and change name to “default_sbl_null_hsfs.cfg”
        6. Open “default_sbl_null_hsfs.cfg” with a text editor (VS Code, Notepad (Windows), Text Editor (Linux))
        7. Change line 21 to: --flash-writer=sbl_prebuilt/am243x-lp/sbl_uart_uniflash.release.hs_fs.tiimage
        8. Change line 24 to: --file=sbl_prebuilt/am243x-lp/sbl_null.release.hs_fs.tiimage --operation=flash --flash-offset=0x0
        9. “default_sbl_null_hsfs.cfg” should now look like this:
        10. CTRL + S to save
        11. Return to “Open a command prompt and run the below command to flash the SOC initialization binary to the LP.” and follow instructions but you will flash “default_sbl_null_hsfs.cfg” instead of “default_sbl_null”: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/EVM_SETUP_PAGE.html#autotoc_md30
        12. $ cd ${SDK_INSTALL_PATH}/tools/boot (replace ${SDK_INSTALL_PATH} with the path to the AM243x MCU+ SDK)
          1. $ cd ~/ti/mcu_plus_sdk_am243x_08_05_00_24/tools/boot
        13. $ python uart_uniflash.py -p COM<x> --cfg=sbl_prebuilt/am243x-lp/default_sbl_null_hsfs.cfg
        14. On Windows OS: Find the COM port following the instructions here: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/EVM_SETUP_PAGE.html#CCS_UART_TERMINAL
        15. On Linux: COM<x> needs to be changed to /dev/ttyUSB# or /dev/ttyACM#
          1. It will be /dev/ttyUSB0 OR /dev/ttyACM0 if you have one device connected
          2. You can find the USB or ACM # using the following commands:
            1. $ sudo dmesg | grep ttyUSB
            2. $ sudo dmesg | grep ttyACM
          3. If “$ python uart_uniflash.py -p COM<x> --cfg=sbl_prebuilt/am243x-lp/default_sbl_null_hsfs.cfg” does not work, try the command using python3 instead of python
            1. $ python3py -p COM<x> --cfg=sbl_prebuilt/am243x-lp/default_sbl_null_hsfs.cfg
              1. Replace COM<x> with the port number. If your port is connected to ACM, replace COM<x> with ACM<x> port number
      6. For AM243x-EVM HSFS:
        1. default_sbl_null_hsfs.cfg does not exist does not exist in AM243x MCU+ SDK 08_05
        2. We will create one
        3. Open Windows Explorer window and navigate to: C:\ti\mcu_plus_sdk_am243x_08_05_00_24\tools\boot\sbl_prebuilt\am243x-evm
        4. Copy “default_sbl_null.cfg” and paste in same folder
        5. Right-click copy of default_sbl_null.cfg, click “Rename” and change name to “default_sbl_null_hsfs.cfg”
        6. Open “default_sbl_null_hsfs.cfg” with a text editor (VS Code, Notepad (Windows), Text Editor (Linux)
        7. Change line 21 to: --flash-writer=sbl_prebuilt/am243x-evm/sbl_uart_uniflash.release.hs_fs.tiimage
        8. Change line 24 to: --file=sbl_prebuilt/am243x-evm/sbl_null.release.hs_fs.tiimage --operation=flash --flash-offset=0x0
        9. “default_sbl_null_hsfs.cfg” should now look like this:
        10. CTRL + S to save
        11. Return to “Open a command prompt and run the below command to flash the SOC initialization binary to the LP.” and follow instructions but you will flash “default_sbl_null_hsfs.cfg” instead of “default_sbl_null”: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/EVM_SETUP_PAGE.html#autotoc_md30
        12. $ cd ${SDK_INSTALL_PATH}/tools/boot (replace ${SDK_INSTALL_PATH} with the path to the AM243x MCU+ SDK)
          1. $ cd ~/ti/mcu_plus_sdk_am243x_08_05_00_24/tools/boot
        13. $ python uart_uniflash.py -p COM<x> --cfg=sbl_prebuilt/am243x-evm/default_sbl_null_hsfs.cfg
        14. If “$ python uart_uniflash.py -p COM<x> --cfg=sbl_prebuilt/am243x-evm/default_sbl_null_hsfs.cfg” does not work, try the command using python3 instead of python
          1. $ python3py -p COM<x> --cfg=sbl_prebuilt/am243x-evm/default_sbl_null_hsfs.cfg
            1. Replace COM<x> with the port number. If your port is connected to ACM, replace COM<x> with ACM<x> port number
          2. On Windows OS: Find the COM port following the instructions here: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/EVM_SETUP_PAGE.html#CCS_UART_TERMINAL
          3. On Linux: COM<x> needs to be changed to /dev/ttyUSB# or /dev/ttyACM#
            1. It will be /dev/ttyUSB0 OR /dev/ttyACM0 if you have one device connected
            2. You can find the USB or ACM # using the following commands:
              1. $ sudo dmesg | grep ttyUSB
              2. $ sudo dmesg | grep ttyACM
      7. For AM64x/AM243x-EVM GP use:
        1. $ python uart_uniflash.py -p COM<x> --cfg=sbl_prebuilt/am243x-evm/default_sbl_null.cfg
        2. On Windows OS: Find the COM port following the instructions here: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/EVM_SETUP_PAGE.html#CCS_UART_TERMINAL
        3. On Linux: COM<x> needs to be changed to /dev/ttyUSB# or /dev/ttyACM#
          1. It will be /dev/ttyUSB0 OR /dev/ttyACM0 if you have one device connected
          2. You can find the USB or ACM # using the following commands:
            1. $ sudo dmesg | grep ttyUSB
            2. $ sudo dmesg | grep ttyACM
          3. If “$ python uart_uniflash.py -p COM<x> --cfg=sbl_prebuilt/am243x-evm/default_sbl_null.cfg” does not work, try the command using python3 instead of python
            1. $ python3py -p COM<x> --cfg=sbl_prebuilt/am243x-evm/default_sbl_null.cfg
              1. Replace COM<x> with the port number. If your port is connected to ACM, replace COM<x> with ACM<x> port number
    4. After completing Steps 1, 2, & 3, complete the modified instructions listed below for Steps 4, 5, & 6: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/GETTING_STARTED.html
    5. For Step 4: Build a “hello world” example: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/GETTING_STARTED_BUILD.html
      1. Do not build the “Hello World” example
      2. Instead, we will import the “ethercat simple” project located in:
        1. ~ti/{MCU+ SDK location}/examples/industrial_comms/ethercat_slave_demo/simple
          1. Within the ethercat_slave_demo/simple folder, there are separate folders for the AM243x-EVM & AM243x-LP, select the project for the board you are using
          2. Follow the instructions below to build the project
            1. In CCS, go to "Toolbar > View > Project Explorer"
            2. In the "Project Explorer" window, right click and select "Import > CCS Projects"
            3. Click "Browse" and go to the folder ${SDK_INSTALL_DIR}/examples/industrial_comms/ethercat_slave_demo/simple
            4. Select the project ethercat_slave_simple_demo_{board}_r5fss0-0_freertos_ti-arm-clang
            5. The project will be imported into the "Project Explorer"
            6. Expand the project
            7. Expand the folder titled “targetConfigs”
            8. Double-click the .ccxml file
            9. “Connection” should be listed as “Texas Instruments XDS110 USB Debug Probe”
            10. “Board or Device” type in the device you are using, i.e., AM243x
            11. Two options should be listed, “AM243x_GP_EVM” and “AM243x_LAUNCHPAD”
            12. Check the option for the board you are using, click save
            13. Right click on the project title and click "Build Project"
            14. This will build the project, now you can load and run it (see CCS Launch, Load and Run)
    1. Follow instructions as written for Step 5: Load and run the “hello world” example on the EVM (we will load “ethercat simple” example instead of “hello world”): https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/CCS_LAUNCH_PAGE.html
      1. Use the EtherCAT demo project you built, not the “hello world” project
        1. Project example location: ~ti/{MCU+ SDK location}/examples/industrial_comms/ethercat_slave_demo/simple
      2. Once you connect to R5F_0_0 core, load the application onto it, then resume the core. The EtherCAT simple demo will be running on the R5F_0_0 core until the device is power cycled, at which point you will need to repeat Step 5 to re-load the application onto the core
        1. (Recommended) Automatically load “ethercat simple” example onto the R5F core after the device is power cycled, follow instructions “For Step 6: To automatically reload the example…”
      3. Once application is loaded onto R5F_0_0 core and resumed, the AM243x SubDevice is ready to be detected as an EtherCAT SubDevice in CODESYS Development System desktop software. It is recommended to flash the application directly on the board following instructions below because we will be power cycling the device at times. The user can choose to skip Step 6 and go to “Steps to get EtherCAT system running” if you do not want the application to be automatically be reloaded after the device is power cycled, and instead re-load the application manually using CCS after a power cycle
    2. For Step 6: DO NOT COMPLETE “Flash a Hello World example using DFU”, we are not using this method for this project
    3. For Step 6: To automatically reload the example after the device is power cycled, follow these modified instructions to flash the “ethercat simple” application directly onto the board:
      1. Complete Step 4 and built your EtherCAT demo project in Code Composer Studio prior to starting the instructions below
      2. For “Getting ready to flash the application”
      3. https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/GETTING_STARTED_FLASH.html
      4. Scroll down the page of the above link and locate where it says, “Next, we need to list the files to flash in a flash configuration file. A default configuration file can be found at below path. You can edit this file directly or take a copy and edit this file.”
      5. Complete the steps to power off the board, set the boot switches to UART mode, power the board back on, connect to the UART terminal, make sure “C” prints out in the terminal, then disconnect from the terminal before proceeding with the steps below
      6. Modify the corresponding .cfg file depending on which board you are setting up:
      7. AM64x/AM243x-EVM (GP) instructions:
        1. Open the file below with a text editor, such as: VS Code (Windows/Linux), Notepad (Windows), Text Editor (Linux):
        2. ti/{MCU+ SDK location}/tools/boot/sbl_prebuilt/am243x-evm/default_sbl_ospi.cfg
        3. it will look like this:
      8. We will change lines 27 and 30 to point to the location of .appimage and .appimage_xip files that are created after we build our ethercat demo example in Code Composer Studio (CCS)
      9. The .appimage and .appimage_xip files are located in the following general location in CCS:
      10. <workspace folder name>/<project name>/Debug/<appimage or appimage_xip full file name with extension>
      11. Linux:
        1. In Linux: /home/<user account>/<workspace folder name>/<project folder name>/Debug/<appimage or appimage_xip full file name with extension>
        2. In Linux (Ubuntu), when you are in the folder with the appimage flies, you can press CTRL + L to highlight to full folder path, then press CTRL + C to copy the path. You can copy the full name + extension of the appimage or appimage_xip files by right clicking the file, selecting “Rename”, then in the rename window, press CTRL + A, then CTRL + C to copy the full file name with the file extension
        3. Change line 27 to: home/<CCS workspace folder name>/ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang/Debug/ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang.appimage
        4. Change line 30 to: home/<CCS workspace folder name>/ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang/Debug/ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang.appimage_xip
      12. Windows:
        1. In Windows: C:\Users\<user account>\Documents\<workspace folder name>\<project folder name>\Debug\<appimage or appimage_xip full file name with extension>
        2. Change line 27 to: C:\Users\<user name>\Documents\<CCS workspace folder name>\ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang\Debug\ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang.appimage
        3. Change line 30 to: C:\Users\<user name>\Documents\<CCS workspace folder name>\ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang\Debug\ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang.appimage_xip
        4. Save the file with CTRL + S
      13. The final result will look similar to this on Linux. It will be similar on Windows with /home/<user account>/ replaced with C:\users\<user account>\Documents\
      14. In the example above:
        1. <CCS workspace folder> is AM243x_LP_EtherCAT_Example
        2. <CCS project folder> is ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang
      15. After updating the newly created default_sbl_ospi_hsfs.cfg save the file using CTRL + S
    4. AM243x-LP (HSFS) instructions:
      1. default_sbl_ospi_hsfs.cfg does not exist for the AM243x-EVM in AM243x MCU+ SDK 08_05_00_24
      2. We will create the file by creating a copy of default_sbl_ospi.cfg, renaming it to default_sbl_ospi_hsfs.cfg, then modify the copied file
      3. Open a folder to: ti/{MCU+ SDK location}/tools/boot/sbl_prebuilt/am243x-lp/
      4. Copy “default_sbl_ospi.cfg” and paste it in the same folder
      5. Rename the copy “default_sbl_ospi_hsfs.cfg”
      6. Open “default_sbl_ospi_hsfs.cfg” below with a text editor, such as: VS Code (Windows/Linux), Notepad (Windows), Text Editor (Linux):
      7. ti/{MCU+ SDK location}/tools/boot/sbl_prebuilt/am243x-lp/default_sbl_ospi_hsfs.cfg
      8. it will look like this:
      9. We will modify lines 16, 24, 27, and 30
      10. Change line 16 to: --flash-writer=sbl_prebuilt/am243x-lp/sbl_uart_uniflash.release.hs_fs.tiimage
      11. Change line 24 to: --file=sbl_prebuilt/am243x-lp/sbl_null.release.hs_fs.tiimage --operation=flash --flash-offset=0x0
      12. We will change lines 27 and 30 to point to the location of .appimage.hs_fs and .appimage_xip files that are created after we build our ethercat demo example in Code Composer Studio
      13. The .appimage.hs_fs and .appimage_xip files are located in:
      14. <workspace folder name>/<project name>/Debug/<appimage or appimage_xip full file name with extension>
      15. Linux:
        1. In Linux: /home/<user account>/<workspace folder name>/<project folder name>/Debug/<appimage or appimage_xip full file name with extension>
        2. In Linux (Ubuntu), when you are in the folder with the appimage flies, you can press CTRL + L to highlight to full folder path, then press CTRL + C to copy the path. You can copy the full name + extension of the appimage or appimage_xip files by right clicking the file, selecting “Rename”, then in the rename window, press CTRL + A, then CTRL + C to copy the full file name with the file extension
        3. Change line 27 to: home/<CCS workspace folder name>/ethercat_slave_simple_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang/Debug/ethercat_slave_simple_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang.appimage.hs_fs
        4. Change line 30 to: home/<CCS workspace folder name>/ethercat_slave_simple_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang/Debug/ethercat_slave_simple_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang.appimage_xip
        5. Windows:
          1. In Windows: C:\Users\<user account>\Documents\<workspace folder name>\<project folder name>\Debug\<appimage or appimage_xip full file name with extension>
          2. Change line 27 to: C:\Users\<user name>\Documents\<CCS workspace folder name>\ethercat_slave_simple_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang\Debug\ethercat_slave_simple_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang.appimage.hs_fs
          3. Change line 30 to: C:\Users\<user name>\Documents\<CCS workspace folder name>\ethercat_slave_simple_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang\Debug\ethercat_slave_simple_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang.appimage_xip
          4. Save the file with CTRL + S
        6. The final result will look similar to this on Linux. It will be similar on Windows with /home/<user account>/ replaced with C:\users\<user account>\Documents\
        7. In the example above:
          1. <CCS workspace folder> is AM243x_LP_EtherCAT_Example
          2. <CCS project folder> is ethercat_slave_simple_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang
        8. After updating the newly created default_sbl_ospi.cfg save the file using CTRL + S
      16. AM243x-EVM (HSFS) instructions:
        1. default_sbl_ospi_hsfs.cfg does not exist for the AM243x-EVM in AM243x MCU+ SDK 08_05_00_24
        2. We will create the file by creating a copy of default_sbl_ospi.cfg, renaming it to default_sbl_ospi_hsfs.cfg, then modify the copied file
        3. Open a folder and navigate to:
        4. ti/mcu_plus_sdk_am243x_08_05_00_24/tools/boot/sbl_prebuilt/am243x-evm/
        5. Copy “default_sbl_ospi.cfg” located in:
        6. ti/mcu_plus_sdk_am243x_08_05_00_24/tools/boot/sbl_prebuilt/am243x-evm/
        7. Paste the copied file into the same folder
        8. Rename the new copy “default_sbl_ospi_hsfs.cfg” (right-click the new file, select rename)
        9. We will modify ti/{MCU+ SDK location}/tools/boot/sbl_prebuilt/am243x-evm/default_sbl_ospi_hsfs.cfg using a text editor, such as: Notepad (Windows), VS Code (Windows/Linux), Text Editor (Linux)
        10. Open default_sbl_ospi_hsfs.org in a text editor, such as: VS Code (Windows/Linux), Notepad (Windows), Text Editor (Linux)
        11. You will see the following in the file:
        12. We will modify lines 16, 24, 27, and 30
        13. Change line 16 to: --flash-writer=sbl_prebuilt/am243x-evm/sbl_uart_uniflash.release.hs_fs.tiimage
        14. Change line 24 to: --file=sbl_prebuilt/am243x-evm/sbl_ospi.release.hs_fs.tiimage --operation=flash --flash-offset=0x0
        15. We will change lines 27 and 30 to point to the location of .appimage.hs_fs and .appimage_xip files that are created after we build our ethercat demo example in Code Composer Studio
        16. In General, the .appimage.hs_fs and .appimage_xip files are located in: <workspace folder name>/<project folder name>/Debug/<appimage or appimage_xip full file name with extension>
        17. Linux:
          1. In Linux: /home/<user account>/<workspace folder name>/<project folder name>/Debug/<appimage or appimage_xip full file name with extension>
          2. In Linux (Ubuntu), when you are in the folder with the appimage flies, you can press CTRL + L to highlight to full folder path, then press CTRL + C to copy the path. You can copy the full name + extension of the appimage or appimage_xip files by right clicking the file, selecting “Rename”, then in the rename window, press CTRL + A, then CTRL + C to copy the full file name with the file extension
          3. Change line 27 to: home/<CCS workspace folder name>/ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang/Debug/ethercat_slave_simple_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang.appimage.hs_fs
          4. Change line 30 to: home/<CCS workspace folder name>/ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang/Debug/ethercat_slave_simple_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang.appimage_xip
        18. Windows:
          1. In Windows: C:\Users\<user account>\Documents\<workspace folder name>\<project folder name>\Debug\<appimage or appimage_xip full file name with extension>
          2. Change line 27 to: C:\Users\<user name>\Documents\<CCS workspace folder name>\ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang\Debug\ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang.appimage.hs_fs
          3. Change line 30 to: C:\Users\<user name>\Documents\<CCS workspace folder name>\ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang\Debug\ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang.appimage_xip
          4. Save the file with CTRL + S
        19. The final result will look like this on Linux. It will be similar on Windows with /home/<user account>/ replaced with C:\users\<user account>\Documents\
        20. In the example above:
          1. <CCS workspace folder> is AM243x_LP_EtherCAT_Example
          2. <CCS project folder> is ethercat_slave_simple_demo_am243x-evm_r5fss0-0_freertos_ti-arm-clang
    1. For “Flashing the application” onto the board: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/08_06_00_45/exports/docs/api_guide_am243x/GETTING_STARTED_FLASH.html#autotoc_md53
      1. Go through the steps to set the boot switches to UART, connect to the terminal and confirm that the terminal outputs “C”
      2. Disconnect from the terminal
      3. Stop when you reach instructions that reads, “Open a command prompt and run the below command to flash the SOC initialization binary to the AM243X” follow the modified flashing instructions below instead:
        1. cd ${SDK_INSTALL_PATH}/tools/boot
          1. replace ${SDK_INSTALL_PATH} with actual path where MCU+ SDK is located
        2. For AM243x-LP (HSFS)
          1. Windows: python3 uart_uniflash.py -p COM<X> --cfg=sbl_prebuilt/am243x-lp/default_sbl_ospi_hsfs.cfg
          2. Linux: python3 uart_uniflash.py -p /dev/tty#### --cfg=sbl_prebuilt/am243x-lp/default_sbl_ospi_hsfs.cfg
            1. /dev/ttyUSB# or /dev/ttyACM#
              1. Typically, ttyUSB0 or ttyACM0 but could be different
            2. If python3 doesn’t work, try python
        3. For AM243x-EVM (HSFS)
          1. Windows: python3 uart_uniflash.py -p COM<X> --cfg=sbl_prebuilt/am243x-evm/default_sbl_ospi_hsfs.cfg
          2. Linux: python3 uart_uniflash.py -p /dev/tty#### --cfg=sbl_prebuilt/am243x-evm/default_sbl_ospi_hsfs.cfg
            1. /dev/ttyUSB# or /dev/ttyACM#
              1. Typically, ttyUSB0 or ttyACM0 but could be different
            2. If python3 doesn’t work, try python
        4. For AM64x/AM243x-EVM (GP)
          1. Windows: python3 uart_uniflash.py -p COM<X> --cfg=sbl_prebuilt/am243x-evm/default_sbl_ospi.cfg
          2. Linux: python3 uart_uniflash.py -p /dev/tty#### --cfg=sbl_prebuilt/am243x-evm/default_sbl_ospi.cfg
            1. /dev/ttyUSB# or /dev/ttyACM#
              1. Typically, ttyUSB0 or ttyACM0 but could be different
            2. If python3 doesn’t work, try python
      4. Once flashing successfully completes, follow the instructions as written from the link above to set boot switches to QSPI/OSPI, depending on your device, then power the device back on
      5. The SubDevice now has the EtherCAT simple demo application flashed onto the board and demo application will automatically be loaded onto the R5F RT core when the device is powered on
      6. If program is flashed correctly, test LEDs will cycle sequentially on the SubDevice (eight test LEDs on AM243x-EVM, four test LEDs on AM243x-LP)
      7. Continue with “Steps to get EtherCAT system running”

  • System set up instructions overview (clickable links):

    1. Set up AM6xx EtherCAT MainDevice
    2. Set up AM64x/AM243x EtherCAT SubDevice(s)
    3. Build project in CODESYS desktop software, build visualization, & test system  <--- You are here

    Steps to get EtherCAT system running:

    1. Prior to proceeding with next steps:
    2. Confirm you can ping from AM62x-EVM Ethernet port to Ethernet port on Windows PC running CODESYS Development System desktop software
    3. Have CODESYS config running on AM62x
    4.
    5. Open CODESYS Development System project you created earlier
    6. Login to AM62x-EVM by clicking gear icon
    7.
    8. If you receive a pop up that says, “The connected PLC uses certificates which are about to expire. Would you like to open the security screen for details?”
    9. Click “No”
    10.
    a. Can check box that says, “Remember decision” for this example
    11. Right-click “EtherCAT_Master (EtherCAT Master)” and select “Scan for Devices…”
    12.
    13. Wait for scan to complete (“Scan Devices” button on the bottom left of the pop-up window will greyed out while scan is running)
    14. When device(s) show up in the list, click “Copy All Devices to Project”
    15.
    a. If SubDevice(s) do not show up in the list, power cycle SubDevice(s) and try again.
    i. If you did not flash the application directly onto the board, you will need to re-load the application onto the R5F_0_0 core manually
    b. If SubDevice(s) still do not show up in the list, confirm CODESYS cfg is running on AM62x AND you can ping Ethernet port IP address of Windows PC running CODESYS Development System desktop software
    c. If SubDevice(s) still do not show up in the list, re-do steps for setting up EtherCAT SubDevices
    16. SubDevices now added under “EtherCAT_Master (EtherCAT Master)”
    17.
    18. Double-click first SubDevice (if there are more than one)
    19. TI_EtherCAT_Toolkit_for_AM243x_R5F tab will open
    20.
    21. Check box to the left of “Expert settings”
    22.
    23. CTRL + S to save
    24. Repeat for additional SubDevices (if any)
    25. Click “Logout” gear icon
    26.
    27. Click “Login” gear icon
    28.
    29. If you receive pop window that says, “Warning: The application ‘Application’ is currently in RUN mode on the PLC. However, do you want to download the latest code changes?” Click “Yes”
    30.
    31. Click “Play” icon
    32.
    33. On TI_EtherCAT_Toolkit_for_AM243x_R5F tab, select “Expert Process Data” side tab
    34.
    35. On the bottom right of screen, click “Load PDO Info from the Device”
    36. Wait for process to complete
    37.
    38. Repeat for additional SubDevices (if any)
    39. CTRL + S to save
    40. Click the “Stop” button
    41. Click the “Logout” gear icon
    42. Double-click TI_EtherCAT_Toolkit_for_AM243x_R5F
    43. In the “TI_EtherCAT_Toolkit_for_AM243x_R5F” tab, click “EtherCAT I/O Mapping”
    44. You should see the following:
    45.
    a. Each SubDevice will have different LED addresses
    46. Note the “Address” for Bit0 – Bit7, i.e., %QX0.0 - %QX0.7
    a. These are the physical addresses for the test LEDs on the AM243x SubDevice
    b. Additional SubDevices will be numbered %QXa.0 - %QXa.7
    i. a = n * 8; n = 0, 1, 2, 3, etc. depending on the number of SubDevices you have in your system (with ‘0’ being the first SubDevice)
    1. For example, if you have two SubDevices:
    a. First SubDevice PLC_PRG code will be:
    i. led1_1 AT %QX0.0 : BOOL :=0;
    ii. led1_2 AT %QX0.1 : BOOL :=0;
    iii. led1_3 AT %QX0.2 : BOOL :=0;
    iv. led1_4 AT %QX0.3 : BOOL :=0;
    v. led1_5 AT %QX0.4 : BOOL :=0;
    vi. led1_6 AT %QX0.5 : BOOL :=0;
    vii. led1_7 AT %QX0.6 : BOOL :=0;
    viii. led1_8 AT %QX0.7 : BOOL :=0;
    b. Second SubDevice PLC_PRG code will be:
    i. led2_1 AT %QX8.0 : BOOL :=0;
    ii. led2_2 AT %QX8.1 : BOOL :=0;
    iii. led2_3 AT %QX8.2 : BOOL :=0;
    iv. led2_4 AT %QX8.3 : BOOL :=0;
    v. led2_5 AT %QX8.4 : BOOL :=0;
    vi. led2_6 AT %QX8.5 : BOOL :=0;
    vii. led2_7 AT %QX8.6 : BOOL :=0;
    viii. led2_8 AT %QX8.7 : BOOL :=0;
    c. etc. for any additional devices
    47. Double-click “PLC_PRG” on the sidebar
    48.
    49. Enter the following code after “VAR”:
    led1_1 AT %QX0.0 : BOOL :=0;
    led1_2 AT %QX0.1 : BOOL :=0;
    led1_3 AT %QX0.2 : BOOL :=0;
    led1_4 AT %QX0.3 : BOOL :=0;
    led1_5 AT %QX0.4 : BOOL :=0;
    led1_6 AT %QX0.5 : BOOL :=0;
    led1_7 AT %QX0.6 : BOOL :=0;
    led1_8 AT %QX0.7 : BOOL :=0;
    50. PLC_PRG should look like this now:
    51.
    52. My system has four SubDevices so the top-half of my PLC_PRG code looks like this:
    53.
    54. Next set the initial states of the test LEDs in the lower-half of PLC_PRG
    55.
    a. Repeat for each additional SubDevice
    i. This system has four SubDevices
    1.
    56. CTRL + S to save
    57. Close the “PLC_PRG” tab by clicking the ‘X’ button
    58. Return to the “TI_EtherCAT_Toolkit_for_AM243x_R5F” tab
    59. Click the “+” to the left of 16#1600 RxPDO, click the “+” to the left Channel “i2c-leds”
    60. Double-click the “Variable” input box to the left of “Bit0”
    61. A box with “…” will show, click it
    62.
    63. “Input Assistant” window will open
    64.
    65. Click the “+” to the left of “Application”, click the “+” to the left of “PLC_PRG”
    66.
    67. Double-click “led1_1” because variable is assigned to %QX0.0, which is the physical address of Bit0
    68. Click “OK” to assign variable “led1_1” to Bit0
    69. Double-click the “Variable” input box to the left of “Bit1”
    70. A box with “…” will show, click it
    71.
    72. Variable “led1_2” is assigned to Address %QX0.1, which is the physical address of Bit1
    73.
    74. Click “OK” to assign variable “led1_2” to Bit1
    75. Repeat the process so variable “led1_3” is assigned to Bit2, “led1_4” is assigned to Bit3, … , “led1_8” is assigned to Bit7
    76.
    77. CTRL + S to save
    78. Repeat the process for any additional SubDevices (the LED physical address will be different for additional SubDevices)
    79. For the second SubDevice, Bit0 physical address is %QX8.0, Bit1 physical address is %QX8.1, … , Bit7 physical address is %QX8.7
    80.
    81. Repeat the process from above to assign variables “led2_1” to “led2_8” to %QX8.0 to %QX8.7
    82.
    83.
    84. CTRL + S to save
    85. Repeat the process for any additional SubDevices
    86. We will now test to see if the test LEDs function as expected based on the initial LED variable values we set in the bottom-half of PLC_PRG
    87. Login by clicking the gear icon
    88.
    a. Make sure CODESYS cfg is running on the AM62x before logging in on the CODESYS Development System desktop software
    b.
    89. Click “Yes” if you receive a popup message saying, “Warning: The application ‘Application’ is currently in RUN mode on the PLC. However, do you want to download the latest code changes?”
    90.
    91. “Start” by clicking the “Play” button or press F5
    92.
    93. Check the LEDs on your AM243x SubDevice, the test LEDs should be on/off based on the initial values we set earlier
    94.
    95. AM243x-LP test LEDs:
    a.
    i. AM243x-LP has only (4) physical test LEDs, but there are physical addresses for (8) LEDs
    ii. (2) test LEDs are turned on in this image
    96. AM243x-EVM & AM64x/AM243x-EVM test LEDs:
    a.
    i. All (8) test LEDs are turned on in this image
    97. Now we will set up the visualization to control the LEDs during a demonstration
    98. Press the “Stop” button, then click the “Logout” gear icon
    99. On the left-side meu, right-click “Application”, go to “Add Object”, then select “Visualization…”
    100.
    101. Check the box under “Active” in the “Add Visualization” window that pops up, then click “Add”
    102.
    103. On the left-side menu, double-click “Visualization”
    104.
    a. If you do not see any icons in the “Visualization Toolbox” tab, press the up arrow in the the window
    b.
    105. We will do two things:
    a. First, we will add a “Lamp” and assign it to an LED variable to show the current state of that LED
    i. In the “Visualization Toolbox”, click the button that says, “Lamps/Switches/Bitmaps”
    1. Icons will show in the lower half of the “Visualization Toolbox”
    2. Drag the “Lamp” into the Visualization tab
    3.
    4. In the “Properties” window, double-click the blank space to the right of “Variable” and click “…”
    5.
    6. “Input Assistant” window will pop up. Select the first LED variable (led1_1 in this example) and click OK
    7.
    8. The “Lamp” icon will now show the state of the first LED variable
    9. Repeat the process for the other eight LEDs, i.e., the second “Lamp” icon will be assigned to led1_2, the third led1_3, etc. until all variables are assigned to icons
    10.
    11. Repeat the process if there are additional SubDevices. The image below has eight LEDs in each horizontal row, and four total rows to represent four devices.
    12.
    a. If you want to change the icon theme, on the left-side menu, double-click “Visualization Manager”, in the tab that opens, click the drop-down for “Selected style” and choose a different style. This example uses “Flat style”
    b.
    13. CTRL + S to save
    14. Test that the Lamps reflect the correct state of the LEDs that was set in PLC_PRG by doing logging in by clicking the “Gear” icon and pressing the “Play” button
    15.
    a. If you receive a popup window that says, “The application changed since last download. What do you want to do?”, select “Login with online change” and click “OK”
    b.
    c. Switch to the “Visualization” tab (and hit the “Play” button if the program is not already running)
    d. The visualization will match the variable LED states set if set correctly
    e.
    f. Click the “Gear” icon to logout and continue with instructions for setting up button to toggle the LED states
    b. Second, we will add a “Rectangle” box, and assign it to toggle an LED variable that will turn that LED on/off
    i. In the top-half of the “Visualization Toolbox” select the “Basic” button
    ii.
    iii. Drag a “Rectangle” icon to the “Visualization” tab and resize the icon so you will be able to place a “Rectangle” under each “Lamp”
    iv. Click the center of the “Rectangle” icon you added and set its name
    v.
    vi. Select the “Rectangle” box and in the “Properties” window, scroll down and click the “+” to the left of “Input Configuration”, then click the “+” to the left of “Toggle”, in the “Variable” section, double-click the empty box until “…” icon shows up, click the “…” icon
    vii.
    viii. In the “Input Assistant” pop up window, select “led1_1” and click “OK”
    ix. CTRL + S to save
    x. Repeat the process for all LEDs, i.e., assign the second “Rectangle” to variable “led1_2”, etc.
    xi.
    xii. The image below is for a set up with four SubDevices
    xiii.
    xiv. CTRL + S to save
    xv. Now we will test the buttons
    xvi. First it is recommended to power cycle the AM243x SubDevice(s). You do not need to power cycle the AM62x-EVM Main Device. If you power cycle the AM62x-EVM, you will need to set the ethernet port IP address again on the AM62x-EVM
    xvii. Restart the CODESYS cfg on the AM62x terminal (if it is already running press CTRL + C to cancel the process, then run the command to restart CODESYS cfg
    1. /opt/codesys/bin/codesyscontrol.bin /etc/CODESYSControl.cfg
    2.
    xviii. Right-click “Device (CODESYS Control for Linux ARM64 SL)”, select “Reset Origin Device [Device]”
    xix.
    xx. Click “Yes” in the CODESYS popup
    xxi.
    xxii. In the “Device” tab, click “Scan Network”
    xxiii.
    xxiv. In the “Select Device” window, double-click “am62xx-evm”
    xxv.
    xxvi. Enter username and password, click “OK” then enter the username and password in the new popup window that opens
    xxvii.
    xxviii. Click the “Gear” icon to login to the device
    xxix.
    xxx. If you receive the “CODESYS” pop up window that says, “The application ‘Application’ does not exist on device ‘Device’. Do you want to create it and proceed with download?”, click “Yes”
    xxxi.
    xxxii. Press the “Play” and the buttons should be highlighted when the LED is on, you will not be able to control the states of the LEDs at this point. There is one more step that must be done before we can control the LEDs live
    xxxiii.
    xxxiv. Logout of the device by clicking the “Gear” icon
    xxxv. Go to the PLC_PRG tab (or double-click PLC_PRG on the left-side menu if the tab is not already open)
    xxxvi. CTRL + A to highlight all the initial LED states we set, right-click anywhere within the PLC_PRG window, select “Advanced”, then “Comment out selected lines”
    xxxvii.
    xxxviii. CTRL + S to save
    xxxix.
    xl. Login to the device by clicking on the “Gear” icon, click “OK” on the CODESYS popup to “Login with online change”
    xli.
    xlii. Go to the “Visualization” tab and push some buttons and see the test LEDs change on the AM243x SubDevice(s)
    xliii.
    xliv. When you are done, go to the PLC_PRG tab, press CTRL + A, then right-click, move the cursor “Advanced”, then select “Uncomment selected lines”
    xlv.
    xlvi. CTRL + S to save

    Congratulations, you have set up an EtherCAT system with an AM62x & one-or-more AM243x SubDevice!

    Return to top of page