RK3568搭建codesyscontrol(软PLC)

RK3568搭建codesyscontrol(软PLC)

参考:RK3568搭建codesyscontrol(软PLC)

说明

我的内核:5.10.198 ,文件系统是debian11,实时系统我用的是preempt_rt,直接用RK给的补丁即可。

安装

实际上就只安装3个deb包就可以了。

ii  codemeter-lite                              8.30.6885.501                      arm64        WIBU CodeMeter minimal runtime
ii  codesyscontrol                              4.17.0.0                           arm64        codesyscontrol based on SDK 3.5.21.20 , from Thu Aug 21 16:30:43 CEST 2025 [131], Release build
ii  codesysedge                                 4.17.0.0                           arm64        codesysedge based on SDK 3.5.21.20 , from Thu Aug 21 16:29:19 CEST 2025 [131], Release build

下载:codemeter-lite:https://www.wibu.com.cn/cn/技术支持-下载中心/supportforusers/usersoftware.html
wget https://www.wibu.com.cn/cn/%E6%8A%80%E6%9C%AF%E6%94%AF%E6%8C%81-%E4%B8%8B%E8%BD%BD%E4%B8%AD%E5%BF%83/supportforusers/usersoftware/file/download/15808.html?tx_wibudownloads_downloadlist%5BdirectDownload%5D=directDownload&cHash=888a5429f6b9c5e706792487431eda70

codemeter-lite 是许可管理
codesyscontrol 是PLC控制服务
codesysedge 是网关(可能?)连接PC机的
img

x86_PC上的IDE

codesys的官网:CODESYS

img

下载链接:CODESYS%2064%203.5.21.20.zip

双击安装:
img
安装之后,使用管理员权限启动:
给codesys安装插件包package:
img

搜索arm64,找一下就行:
img
img
img

可以直接让codesyscontrol安装,package实际上也是使用deb包,然后通过Deploy control SL安装上板子上,板子和PC机要在同一个局域网下。
img
链接之后会得到这些信息:
img
之前安装的package之后,这里就会多出来其兼容的产品,安装即可。
img
img
img
测试:telnet下板子的11740端口即可。

之后新建工程,添加设备,连接上板子的codesyscontrol:
img
img
img
双击设备:
img
img
有点不好用,扫描网络按钮加载一会儿才可以用:
img
连接:
img

PS:

任务栏从左到右是Gateway,PLC控制服务,许可管理
img
红色框这个是许可证管理,收钱的东西,打开如下,也可以打开web界面管理,
img
PLC Contrl和板子里面的那个PLC Contrl通讯,许可管理给板子下发许可。

之前给的说明:

How to install codesyscontrol to an ARM64 Linux board

  1. Download:
    (VPN may be required)

  2. You will have these files (versions may differ):

    • CODESYS Control for Linux ARM64 SL 4.16.0.0.package
    • CODESYS Edge Gateway for Linux 4.16.0.0.package
    • codemeter-lite_8.30.6885.501_arm64.deb

Board side (Linux):

3. Copy the files to your ARM64 device.

4. Extract `.package` files (as regular zip archives):
    7z x 'CODESYS Control for Linux ARM64 SL 4.16.0.0.package' -oControl
    7z x 'CODESYS Edge Gateway for Linux 4.16.0.0.package' -oGateway
    
5. Install the software:
    dpkg -i codemeter-lite_8.30.6885.501_arm64.deb
    dpkg -i Gateway/Delivery/edgearm64/codesysedge_edgearm64_4.16.0.0_arm64.deb
    dpkg -i Control/Delivery/linuxarm64/codesyscontrol_linuxarm64_4.16.0.0_arm64.deb
    
6. Run and enable the services
    Services should be up and enabled by default. In case if they're not run:
        systemctl daemon-reload
        systemctl enable --now codesyscontrol
        systemctl enable --now codesysedge

7. Check if services are running:
    ss -ltupn | grep code
    
    You should see table similar to this one:
   
    udp   UNCONN 0   0   192.168.85.255:1740    0.0.0.0:*  users:(("codesyscontrol.",pid=4394,fd=7)) 
    udp   UNCONN 0   0    192.168.85.58:1740    0.0.0.0:*  users:(("codesyscontrol.",pid=4394,fd=6)) 
    udp   UNCONN 0   0   192.168.85.255:1743    0.0.0.0:*  users:(("codesysedge.bin",pid=4667,fd=5)) 
    udp   UNCONN 0   0    192.168.85.58:1743    0.0.0.0:*  users:(("codesysedge.bin",pid=4667,fd=4)) 
    tcp   LISTEN 0   0        127.0.0.1:4840    0.0.0.0:*  users:(("codesyscontrol.",pid=4394,fd=17))
    tcp   LISTEN 0   0    192.168.85.58:4840    0.0.0.0:*  users:(("codesyscontrol.",pid=4394,fd=16))
    tcp   LISTEN 0   0          0.0.0.0:11740   0.0.0.0:*  users:(("codesyscontrol.",pid=4394,fd=15))
    tcp   LISTEN 0   0          0.0.0.0:1217    0.0.0.0:*  users:(("codesysedge.bin",pid=4667,fd=6)) 

CODESYS Development System side (Windows):

8. Copy 'CODESYS Control for Linux ARM64 SL 4.16.0.0.package' to your Windows machine.

9. (If not already installed)
   Install Microsoft Edge WebView2 runtime:
        - https://developer.microsoft.com/en-us/microsoft-edge/webview2/
  1. Launch "CODESYS installer" and

    • choose "From file..."
    • select the 'CODESYS Control for Linux ARM64 SL 4.16.0.0.package' file (or install it from CODESYS servers).
    • try to install the package no matter what the installer asks.
  2. Run CODESYS and:

    • Create a new project with a 'CODESYS Control for Linux ARM64 SL' device.
    • Build and "Login": it will propose to set up a connction, for it use:
      Gateway: <board's ip>:1217
      Device: <board's ip>:11740
      (ports may be omitted probably). IDE should show device's info and green marks near both:
      the gateway and the device.
    • Login, (create account maybe), and
12. Successfully flash the controller.

==========================================

Free CODESYS Control stops working after 2 hours. To make it restart automatically
you can edit its systemd service file. E.g.:

systemctl cat codesyscontrol > /etc/systemd/system/codesyscontrol_a.service
systemctl mask codesyscontrol

sed -i '/RemainAfterExit/ d' /etc/systemd/system/codesyscontrol_a.service
cat >> /etc/systemd/system/codesyscontrol_a.service
Restart=always
RestartSec=1
# optional:
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=98

[Install]
WantedBy=multi-user.target
^D

systemctl daemon-reload
systemctl enable --now codesyscontrol_a

Serial device config for CODESYS Control for Linux

To map a COM-port number to a serial Linux device, you
must edit /etc/codesyscontrol/CODESYSControl_User.cfg
or /etc/codesyscontrol/CODESYSControl.cfg.
A file should contain these lines:

[SysCom]
Linux.Devicefile.1=/dev/ttyS3

For other serial devices, like USB to RS232 converters,
add respective lines to the section, e.g.:

Linux.Devicefile.2=/dev/ttyUSB0

Restart the service: systemctl restart codesyscontrol_a.

posted @ 2025-09-17 16:09  潇汀  阅读(38)  评论(0)    收藏  举报