011 - Using Codesys as Soft-SPS
Introduction
The following Chapters describe the Usage of a Raspberry Pi as Software SPS in combination with the SoM as Client.
Prerequisites and Topology
You’ll need:
“CODESYS”: https://de.codesys.com/
Raspberry Pi as Software SPS (minimum Model 3 recommended)
Installed Plugin “CODESYS Control for Raspberry Pi” (free, with a runtime limitation up to 2 hours): https://store.codesys.com/de/codesys-control-for-raspberry-pi-mc-sl.html
SoM EVAL Kit
Option 1 shows the usage of the Raspberry as Soft SPS and an seperate SoM Eval Kit as a device. Option 2 uses the Raspberry as Soft SPS and in Combination with a SoM-Adaptershield also as Application Controller.
Setup of a new Project
Create a new “Standard project” with the device “CODESYS Control for Raspberry Pi”.
Change to tab “Raspberry Pi” [1], choose the right Configuration [2] and Install CODESYS Runtime Package on the Raspberry Pi [3].
Choose the Tab “Devices” [4], double click “Device” [5] in the Explorer on the left side. “Scan Network” [6] and Choose the Raspberry Pi [7] as Gateway.
After a Reboot of the Raspberry Pi, the CODESYS Runtime Package will start automaticly.
SoM as Profinet Device
Open “Tools”->”Device Repository…” and select “Install”. Choose the appropriate GSD, e.g. GSDML-V2.4-portGmbH-irj45-20211007.xml. Select “Close” after installing succesfully.
Click Right on “Device” and Select “Add Device”, Choose “Fieldbusses”->”Profinet IO”->”Ethernet Adapter”->”Ethernet” [1], Apply with “Add Device”.
Click Right on “Ethernet (Ethernet)” and also add PN-Controller: “Fieldbusses”->”Profinet IO”->”Profinet IO Master”->”PN-Controller”.
Click Right on “PN_Controller (PN-Controller)” and also add Device: “Fieldbusses”->”Profinet IO”->”Profinet IO Slave”->”port”->”2-port Device” [2].
Double Click on the Device “Ethernet (Ethernet)” [3] and select the appropriate Network Interface [4] connected with the SoM on the Raspberry Pi.
Log into the Raspberry Pi [5] and start the application with “Start”.
Please make sure to apply a valid IP setup.
Start the appropriate application on the Application Controller (e.g. Raspberry Pi or STM32F429ZI connected per SPI to the SoM) and the device should be able to communicate per Profinet with the CODESYS Runtime on the Raspberry Pi.