PROFINET Device  v1.04.02
AM64x SITARA Processor

CODESYS Installation

For the CODESYS runtime on the AM64x SITARA Processor hardware, the CODESYS Control for Linux ARM64 SL is required.
Without a valid license, the CODESYS runtime including the fieldbus functionality will execute for two hours and then exit.
To install the runtime package the CODESYS development system must be started with administrative rights.
Installation is performed from within the CODESYS Package Manager.

After the package is installed, the CODESYS runtime system must be installed on the AM64x SITARA Processor evaluation hardware.
Therefore prepare an SD Card with latest AM64x Arago Yocto Standard Image.
Log in to the Device via UART COM Port using user and password "root".

_____ _____ _ _
| _ |___ ___ ___ ___ | _ |___ ___ |_|___ ___| |_
| | _| .'| . | . | | __| _| . | | | -_| _| _|
|__|__|_| |__,|_ |___| |__| |_| |___|_| |___|___|_|
|___| |___|
Arago Project http://arago-project.org am64xx-evm ttyS2
Arago 2020.09 am64xx-evm ttyS2
am64xx-evm login: root

Setup the network interface settings required for your system.
For example fix your IP address of eth0 interface to static IP 192.136.0.200 as shown below in /etc/systemd/network/10-eth.network.

[Match]
Name=eth0
KernelCommandLine=!root=/dev/nfs
[Network]
DHCP=no
Address=192.136.0.200

Open CODESYS Control for Linux ARM64 SL 4.2.0.0.package archive file and extract the files:
Dependancy/codemeter-lite_7.21.4611.501_arm64.deb
Delivery/codesyscontrol_linuxarm64_4.2.0.0_arm64.deb

Copy them over to the target and install:
scp Downloads/codemeter-lite_7.21.4611.501_arm64.deb root@.nosp@m.192..nosp@m.136.0.nosp@m..200:~
scp Downloads/codesyscontrol_linuxarm64_4.2.0.0_arm64.deb root@.nosp@m.192..nosp@m.136.0.nosp@m..200:~

Install 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
add-arch is to get by the arm64 vs aarch64 definition difference with Debian

This is one-time and once there is CODESYS package manager support the Windows GUI can be used instead.

Execute the 2 hours limited runtime by:

root@am64xx-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
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/ _/_/_/_/ _/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/ _/_/ _/_/ _/_/_/_/_/ _/
_/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/ _/_/ _/_/_/_/_/_/ _/_/_/
_/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/_/_/_/
_/_/ _/_/ _/_/ _/_/ _/_/ _/_/_/_/ _/_/_/_/ _/_/_/_/ _/_/_/_/ _/_/_/_/_/_/_/
_/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/_/_/_/
_/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/ _/_/_/_/_/_/ _/_/_/
_/_/_/_/ _/_/_/_/ _/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/ _/_/ _/_/_/_/_/ _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

Creating a CODESYS Project

Start the CODESYS development system and create a new standard project

Select CODESYS Control for Linux ARM64 SL (3S - Smart Software Solutions GmbH) as device and the programming language of your choice.

The development system creates the project structure and populates the structure of the device tree.

Before configuring the PROFINET network, the matching device description file must be installed to the CODESYS device repository.
Navigate to Tools → Device Repository in the menu system and install the file TI AM243X.R5F Simple.xml which is part of the distribution.

Setup a PROFINET Network

Scan for a Gateway Device and select connected AM64x SITARA Processor.

Add an Ethernet Interface and select the Port connected to the PROFINET Network.

Continue to add a PROFINET Controller to this Ethernet Interface.

Once complete you can enter Online mode and start your application.
This only starts the PROFINET Controller from where it is possible to scan for connected PROFINET devices.

Scan for Device and add to Project

Provided device description has been installed earlier, the scan process will identify the PROFINET device.

Set a Station Name and an IP Address, the device can now be copied to the project.

Finally exit Online mode, re-enter Online mode to download the new project structure, and start the application.

All devices should now be running.
Now you are free to implement your program.

NOTE:

The icon indicates that the PROFINET devices are running in trial mode for 30 minutes.

After this time has elapsed, the trial mode will expire and the fieldbus will terminate the data exchange.

Write your own PLC Program

The PROFINET Process Data LEDs can be addressed by mapping the first byte of Process Data Output Buffer to a BYTE variable in your Structured Text Program.
To control the LEDs individually, declare Boolean variables for each.
In your program, shift the Boolean variables to the corresponding bit within the first byte of Process Data Output Buffer.

PROGRAM {PROGRAM_NAME}
VAR
i2c_leds AT %QB0 : BYTE :=0;
i2c_led1 : BOOL :=0;
i2c_led2 : BOOL :=0;
i2c_led3 : BOOL :=0;
i2c_led4 : BOOL :=0;
i2c_led5 : BOOL :=0;
i2c_led6 : BOOL :=0;
i2c_led7 : BOOL :=0;
i2c_led8 : BOOL :=0;
END_VAR
i2c_leds := SHL(BOOL_TO_BYTE(i2c_led8),7) + SHL(BOOL_TO_BYTE(i2c_led7),6) + SHL(BOOL_TO_BYTE(i2c_led6),5) + SHL(BOOL_TO_BYTE(i2c_led5),4) + SHL(BOOL_TO_BYTE(i2c_led4),3) + SHL(BOOL_TO_BYTE(i2c_led3),2) + SHL(BOOL_TO_BYTE(i2c_led2),1) + SHL(BOOL_TO_BYTE(i2c_led1),0);

After the mapping is done, you can assign/manipulate the variables in your program.
For example, you can assign the variables within your program visualization.