5.1. CODESYS Industrial Communications Controller¶
The AM62X can be used as a PLC to program and control connected devices using industrial protocols like EtherCAT and Profinet using the CODESYS runtime running on top of Linux.
AM62X can act as a master in both protocols despite lacking the ICSSG hardware.
Note that to get the best performance, use the Real-Time version of our Linux SDK.
These instructions are based on a similar guide for the AM64X to assume the runtime system controller role. Additionally, the AM64X contains ICSSG hardware that allows it to act as a slave device. For further reference, view the MCU+ Academy pages for EtherCAT Slave and AM64X Setup. For other protocols, please see the Industrial Communications Toolkit.
5.1.1. Host Machine CODESYS Installation¶
After a simple registration process, the CODESYS development is available for download free of charge from the CODESYS Store. Please consult the system requirements in the CODESYS Store for the development PC.
It is recommended to install the full package. Specific protocol implementations and packages may require purchase and licensing.
To get the CODESYS runtime packages for the target (SITARA AM62X Processor), CODESYS Control for Linux ARM64 SL must be set up in the “Development System” software running on the host machine. Note that ARM64 here is a reference to the CPU architecture, and is not AM64x specific.
The CODESYS Development System must be started as administrator. Installation is performed from within the CODESYS Package Manager.
Once installed, the .DEB packages for the runtime will be placed on the
host machine under \\Users\\USERNAME\\CODESYS Control for Linux ARM64 SL
.
Copy the files below onto your AM62X using scp
:
Dependancy\\codemeter-lite_7.21.4611.501_arm64.deb
Delivery\\codesyscontrol_linuxarm64_4.2.0.0_arm64.deb
The exact names of the .DEB files are dependent on the version of the Linux ARM64 SL package – those shown are for version 4.2.0.0 of Linux ARM64 SL.
5.1.2. PLC Controller (AM62X) Runtime Installation¶
After the package is installed on the host computer, the CODESYS runtime system must be installed on the AM62x EVM. Therefore prepare an SD Card with latest AM62x Processor SDK Linux; please visit the Quick Start Guide. Log in to the device via UART COM port using user “root”.
_____ _____ _ _
| _ |___ ___ ___ ___ | _ |___ ___ |_|___ ___| |_
| | _| .'| . | . | | __| _| . | | | -_| _| _|
|__|__|_| |__,|_ |___| |__| |_| |___|_| |___|___|_|
|___| |___|
Arago Project http://arago-project.org am62xx-evm ttyS2
Arago 2021.09 am62xx-evm ttyS2
am62xx-evm login: root
root@am62xx-evm:~#
Install the .deb files copied over with scp from the host machine:
opkg -V2 install --nodeps --offline-root / --add-arch arm64:13 ./codemeter-lite_7.21.4611.501_arm64.deb
opkg -V2 install --offline-root / --add-arch arm64:13 ./codesyscontrol_linuxarm64_4.2.0.0_arm64.deb
5.1.3. Running the PLC Controller¶
To start the runtime, navigate to /var/opt/codesys and execute the codesyscontrol binary. Note that without a license, this software may only run for 2 hours before it will automatically close.
root@am62xx-evm:/var/opt/codesys# /opt/codesys/bin/codesyscontrol.bin /etc/CODESYSControl.cfg
CoDeSysControl DEMO VERSION - runs 2 hours*********
[ 143.262292] can: controller area network core
[ 143.262393] NET: Registered protocol family 29
[ 143.276112] can: raw protocol
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/ _/_/_/_/ _/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/ _/_/ _/_/ _/_/_/_/_/ _/
_/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/ _/_/ _/_/_/_/_/_/ _/_/_/
_/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/_/_/_/
_/_/ _/_/ _/_/ _/_/ _/_/ _/_/_/_/ _/_/_/_/ _/_/_/_/ _/_/_/_/ _/_/_/_/_/_/_/
_/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/_/_/_/
_/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/ _/_/_/_/_/_/ _/_/_/
_/_/_/_/ _/_/_/_/ _/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/ _/_/ _/_/_/_/_/ _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
To create and run a program, please visit the examples in the MCU+ Academy Industrial Communications Toolkit. These examples use AM64X or AM243X EVMs as client/slave devices, but the AM64X PLC controller is interchangable with a AM62X, as set up in this reference design.
Instructions for connecting to a SITARA AM64x Processor running as a PLC will work for an AM62x (as set up here) running as the PLC; this page will show how to create a CODESYS project from the host PC. There are several code examples available on the Quickstate - EtherCAT Device page for the client/slave devices, which are assumed to be AM64/AM243.