Codesys control service for Raspberry Pi randomly stops working

ivanmaltar
2023-03-06
2023-08-10
  • ivanmaltar - 2023-03-06

    Hello,

    I have a few RevPi PLC controllers licensed with 'CODESYS Control for Raspberry Pi SL'. CODESYS runtime randomly stops working on the controllers - Modbus server is stops being reachable and I don't see the controllers when I scan network with CODESYS.

    Controllers are working properly, and they are on the network. When I check the codesyscontrol.service on the controller, it says it is active (exited). In the codesys log files, I can't see any irregularity. After I restart the controller, everything works properly.

    Did anybody else had this problem? Is there anything I can check / fix for this to stop happening?

     

    Last edit: ivanmaltar 2023-03-07
  • ivanmaltar - 2023-03-07

    I edited the post, the systemctl status says the service is 'active (exited)'. The journalctl does not show any relevant informations.

    pi@TBreR2:~ $ sudo journalctl -u codesyscontrol.service
    -- Logs begin at Thu 2019-02-14 11:11:59 CET, end at Tue 2023-03-07 07:18:38 CET. --
    Mar 03 00:21:22 TBreR2 systemd[1]: Starting LSB: Prepares and starts codesyscontrol...
    Mar 03 00:21:24 TBreR2 codesyscontrol[1531]: codesyscontrol started
    Mar 03 00:21:24 TBreR2 systemd[1]: Started LSB: Prepares and starts codesyscontrol.
    

    The codesyscontrol log alwso doesn't show anything relevant. Is there something else I can check ??

    2023-03-02T23:21:29Z, 0x00008001, 1, 1, 1, *************************************************************************************
    2023-03-02T23:21:29Z, 0x000010f0, 2, 0, 4, !!!! Warning: <Network>eth0</Network><Comp>IoDrvEthernet</Comp>
    2023-03-02T23:21:29Z, 0x000010f0, 1, 0, 7, <Comp>IoDrvEthernet</Comp>
    2023-03-02T23:21:29Z, 0x00000002, 1, 0, 7, Retains matched to bootproject of application [<app>Application</app>]
    2023-03-02T23:21:29Z, 0x00000002, 1, 0, 6, Bootproject of application [<app>Application</app>] loaded
    2023-03-02T23:21:29Z, 0x00000018, 1, 0, 1, Setting router <instance>0</instance> address to <address>(0001)</address>
    2023-03-02T23:21:29Z, 0x00000018, 1, 0, 1, Setting router <instance>1</instance> address to <address>(2ddc:7f00:0001)</address>
    2023-03-02T23:21:29Z, 0x00000002, 1, 0, 10, Application [<app>Application</app>] started
    2023-03-02T23:21:29Z, 0x00008000, 1, 1, 1, Read Inputs: wConnectorTYPE: 40200, auiPar[0]: 315, dwPIoffset: 315, dwParameterID: 100
    2023-03-02T23:21:29Z, 0x00008000, 1, 1, 1, Write Outputs: wConnectorTYPE: 8103, auiPar[0]: 21, dwPIoffset: 0, dwParameterID: 3500
    2023-03-02T23:21:29Z, 0x00000001, 1, 0, 34, CODESYS Control ready
    2023-03-02T23:21:29Z, 0x00000001, 1, 0, 0, runtime licensed
    2023-03-02T23:21:30Z, 0x000010f0, 1, 0, 1, <Network>eth0</Network><IP>192.168.11.168</IP><Sub>255.255.255.0</Sub><Comp>IoDrvEthernet</Comp>
    2023-03-02T23:21:34Z, 0x00000018, 1, 0, 5, Network interface <interface>ether local</interface> unregistered
    2023-03-02T23:21:34Z, 0x00000007, 1, 0, 6, Network interface: <ipaddress>192.168.11.168</ipaddress>, subnetmask <subnetmask>255.255.255.0</subnetmask>
    2023-03-02T23:21:34Z, 0x00000018, 1, 0, 4, Network interface <interface>ether 1</interface> at router <instance>2</instance> registered
    2023-03-02T23:21:34Z, 0x00000018, 1, 0, 1, Setting router <instance>2</instance> address to <address>(00a8)</address>
    
     

    Related

    Talk.ru: 1

  • ivanmaltar - 2023-03-07

    When I restart the codesyscontrol.service it is not enough, I need to restart the whole controller for the Codesys runtime to start working again.

     
  • eschwellinger

    eschwellinger - 2023-03-07

    which versions are involved? (Runtime and CODESYS version is always needed as additional information):

    In such cases I would recommend the following:
    stop the plc runtime by login by ssh to the pi(or exceute this local):
    1.
    sudo /etc/init.d/codesyscontrol stop

    1. start the runtime manually by command line to have the debug output (for non multicore runtime)
      cd /var/opt/codesys
      sudo /opt/codesys/bin/codesyscontrol_armv6l_raspberry.bi -d /etc/CODESYSControl.cfg

    in case of multicore runtime use:
    cd /var/opt/codesys
    sudo /opt/codesys/bin/codesyscontrol_armv7l_raspberry.bin -d /etc/CODESYSControl.cfg

    1. open second CLI
      tail -f /tmp/codesyscontrol.log

    Now you should see more information why the runtime stops

     
  • ivanmaltar - 2023-03-08

    Hello,

    CODESYS version is V3.5 SP17 Patch 3 + (64 bit)

    The runtime version is 4.4.0.0 (raspberry, armhf)

     
  • ivanmaltar - 2023-03-08

    I executed the sudo /opt/codesys/bin/codesyscontrol_armv6l_raspberry.bin -d /etc/CODESYSControl.cfg command in the terminal, and got the output in the moment the PLC stoped, I don't see any irregularities:

    pi@TBreR2:/var/opt/codesys $ sudo /opt/codesys/bin/codesyscontrol_armv6l_raspberry.bin -d /etc/CODESYSControl.cfg
    CODESYS Control V3.5.17.30 for ARM-32Bit - build Feb 24 2022
    Device type: 4102 id: 0x00000010
    Device vendor: 3S - Smart Software Solutions GmbH
    Device name:   CODESYS Control for Raspberry Pi SL
    INFO: using /etc/CODESYSControl.cfg as config file
    machine: armv7l
    timer resolution: 1nsec
    Linux version 5.10.120-rt70-v7l (support@kunbus.com) (arm-linux-gnueabihf-gcc (Debian 8.3.0-2) 8.3.0, GNU ld (GNU Binutils for Debian) 2.31.1) #1 SMP PREEMPT_RT Thu, 28 Jul 2022 10:36:48 +0200
    
    SysTaskCreate[527]: create CMHooksTask(prio:128,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  CMHooksTask(tid:7429,OSprio:0) running
    SysExceptOSHookFunction[451]: setting fpu-exceptions failed
    SysDirOpen_[109]: opendir(./cmact_licenses):No such file or directory
    SysDirOpen_[109]: opendir(TBF/):No such file or directory
    SysDirOpen_[109]: opendir(TBF/):No such file or directory
    SysDirCreate_[258]: mkdir(.pki/own/cert/):File exists
    SysDirCreate_[258]: mkdir(.pki/quarantine/):File exists
    SysDirCreate_[258]: mkdir(.pki/trusted/cert/):File exists
    SysDirCreate_[258]: mkdir(.pki/trusted/crl/):File exists
    SysDirCreate_[258]: mkdir(.pki/untrusted/):File exists
    SysDirCreate_[258]: mkdir(cert/import/):File exists
    SysDirCreate_[258]: mkdir(cert/export/):File exists
    SysDirCreate_[258]: mkdir(.pki/own/key/):File exists
    SysDirCreate_[258]: mkdir(.pki/own/key_exportable/):File exists
    openRxSocket[595]: Opened socket for reading (can0)
    openRxSocket[601]: ioctl(SIOCGIFINDEX): No such device
    Socket_CanMiniDriver_Setup[1098]: interface can0 is not available
    SysFileDelete_[304]: unlink(.UserMgmtDB.csv):No such file or directory
    
     _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
            _/_/_/_/      _/_/_/_/    _/_/_/_/_/    _/_/_/_/_/_/    _/_/_/_/_/  _/_/    _/_/    _/_/_/_/_/          _/
         _/_/_/_/_/_/  _/_/_/_/_/_/  _/_/_/_/_/_/  _/_/_/_/_/_/  _/_/_/_/_/_/  _/_/    _/_/  _/_/_/_/_/_/        _/_/_/
        _/_/    _/_/  _/_/    _/_/  _/_/    _/_/  _/_/          _/_/          _/_/    _/_/  _/_/              _/_/_/_/_/
       _/_/          _/_/    _/_/  _/_/    _/_/  _/_/_/_/        _/_/_/_/      _/_/_/_/      _/_/_/_/      _/_/_/_/_/_/_/
      _/_/    _/_/  _/_/    _/_/  _/_/    _/_/  _/_/                  _/_/      _/_/              _/_/      _/_/_/_/_/
     _/_/_/_/_/_/  _/_/_/_/_/_/  _/_/_/_/_/_/  _/_/_/_/_/_/  _/_/_/_/_/_/      _/_/      _/_/_/_/_/_/        _/_/_/
      _/_/_/_/      _/_/_/_/    _/_/_/_/_/    _/_/_/_/_/_/  _/_/_/_/_/        _/_/      _/_/_/_/_/            _/
    
     _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    SysTaskCreate[527]: create CAAEventTask(prio:30,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  CAAEventTask(tid:7433,OSprio:58) running
    SysTaskCreate[527]: create SchedProcessorLoad0(prio:64,interval:0us,stacksize:131072)
    SysTaskCreate[527]: create SchedException(prio:10,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  SchedProcessorLoad0(tid:7434,OSprio:0) running
    SysTaskFrame[448]:  SchedException(tid:7435,OSprio:78) running
    SysTaskCreate[527]: create Schedule(prio:5,interval:1000us,stacksize:131072)
    SysTaskFrame[448]:  Schedule(tid:7436,OSprio:83) running
    SysTaskCreate[527]: create TaskGapTask(prio:15,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  TaskGapTask(tid:7437,OSprio:73) running
    SysDirCreate_[258]: mkdir(PlcLogic/Application):File exists
    SysFileDelete_[304]: unlink(PlcLogic/Application/Application.xml):No such file or directory
    SysTaskCreate[527]: create IoMgrDiagTask(prio:192,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  IoMgrDiagTask(tid:7439,OSprio:0) running
    SysTaskCreate[527]: create MainTask(prio:33,interval:4000us,stacksize:131072)
    SysTaskFrame[448]:  MainTask(tid:7440,OSprio:55) running
    SysFileGetSize_[394]: stat(PlcLogic/Application/Application.boot.xml):No such file or directory
    SysTaskCreate[527]: create EventMgrUnixBackend_ServerThread(prio:159,interval:0us,stacksize:131072)
    SysTaskCreate[527]: create OPCUAServerWorkerLowPrio0(prio:128,interval:1000us,stacksize:131072)
    SysTaskFrame[448]:  EventMgrUnixBackend_ServerThread(tid:7441,OSprio:0) running
    SysTaskCreate[527]: create OPCUAServerWorkerMethodCalls0(prio:128,interval:1000us,stacksize:131072)
    SysTaskFrame[448]:  OPCUAServerWorkerLowPrio0(tid:7442,OSprio:0) running
    SysTaskCreate[527]: create OPCUAServerScheduler(prio:64,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  OPCUAServerWorkerMethodCalls0(tid:7443,OSprio:0) running
    SysTaskCreate[527]: create PlcShellLinuxBackend_ServerThread(prio:159,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  OPCUAServerScheduler(tid:7444,OSprio:0) running
    SysTaskFrame[448]:  PlcShellLinuxBackend_ServerThread(tid:7445,OSprio:0) running
    SysTaskCreate[527]: create WebServerCloseChannelAfterTimeoutTask(prio:150,interval:0us,stacksize:131072)
    SysTaskCreate[527]: create BlkDrvTcp(prio:95,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  WebServerCloseChannelAfterTimeoutTask(tid:7446,OSprio:0) running
    SysTaskCreate[527]: create BlkDrvUdp(prio:95,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  BlkDrvTcp(tid:7447,OSprio:0) running
    SysTaskCreate[527]: create OPCUAClient_Network(prio:128,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  BlkDrvUdp(tid:7448,OSprio:0) running
    SysTaskFrame[448]:  OPCUAClient_Network(tid:7449,OSprio:0) running
    SysTaskCreate[527]: create OPCUAServer(prio:128,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  OPCUAServer(tid:7450,OSprio:0) running
    SysTaskCreate[527]: create CMCommCycleTask(prio:128,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  CMCommCycleTask(tid:7451,OSprio:0) running
    SysTaskCreate[527]: create CreateKeyPairTask(prio:255,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  CreateKeyPairTask(tid:7452,OSprio:0) running
    
     
  • eschwellinger

    eschwellinger - 2023-03-08

    anything here?
    /tmp/codesyscontrol.log
    open second CLI
    tail -f /tmp/codesyscontrol.log
    while it stops?

     
  • ivanmaltar - 2023-03-09

    Nothing in the log:

    tail -f /tmp/codesyscontrol.log
    2023-03-08T14:35:21Z, 0x00000002, 1, 0, 22, No retain area in bootproject of application [<app>Application</app>]
    2023-03-08T14:35:21Z, 0x00000002, 1, 0, 6, Bootproject of application [<app>Application</app>] loaded
    2023-03-08T14:35:21Z, 0x00000018, 1, 0, 1, Setting router <instance>0</instance> address to <address>(00b1)</address>
    2023-03-08T14:35:21Z, 0x00000018, 1, 0, 1, Setting router <instance>1</instance> address to <address>(2ddc:c0a8:0bb1)</address>
    2023-03-08T14:35:21Z, 0x00000002, 1, 0, 10, Application [<app>Application</app>] started
    2023-03-08T14:35:21Z, 0x00008000, 1, 1, 1, Read Inputs: wConnectorTYPE: 8097, auiPar[0]: 113, dwPIoffset: 0, dwParameterID: 1000, bitOffset: 0
    2023-03-08T14:35:21Z, 0x00008000, 1, 1, 1, Write Outputs: wConnectorTYPE: 40200, auiPar[0]: 232, dwPIoffset: 232, dwParameterID: 200
    2023-03-08T14:35:21Z, 0x00000001, 1, 0, 34, CODESYS Control ready
    2023-03-08T14:35:21Z, 0x00000001, 1, 0, 0, runtime licensed
    2023-03-08T14:35:22Z, 0x000010f0, 1, 0, 1, <Network>eth0</Network><IP>192.168.11.177</IP><Sub>255.255.255.0</Sub><Comp>IoDrvEthernet</Comp>
    

    Now after it stopped again on its own, I tried to start it with
    sudo /opt/codesys/bin/codesyscontrol_armv6l_raspberry.bin -d /etc/CODESYSControl.cfg

    But it does not start. It gets stuck here:

     sudo /opt/codesys/bin/codesyscontrol_armv6l_raspberry.bin -d /etc/CODESYSControl.cfg
    CODESYS Control V3.5.17.30 for ARM-32Bit - build Feb 24 2022
    Device type: 4102 id: 0x00000010
    Device vendor: 3S - Smart Software Solutions GmbH
    Device name:   CODESYS Control for Raspberry Pi SL
    INFO: using /etc/CODESYSControl.cfg as config file
    machine: armv7l
    timer resolution: 1nsec
    Linux version 5.10.152-rt75-v7l (support@kunbus.com) (arm-linux-gnueabihf-gcc (Debian 8.3.0-2) 8.3.0, GNU ld (GNU Binutils for Debian) 2.31.1) #1 SMP PREEMPT_RT Tue, 29 Nov 2022 07:34:25 +0000
    
    SysTaskCreate[527]: create CMHooksTask(prio:128,interval:0us,stacksize:131072)
    SysTaskFrame[448]:  CMHooksTask(tid:7297,OSprio:0) running
    

    In that moment, the tail -f /tmp/codesyscontrol.log gives the same output as before.

     
  • axbul - 2023-08-01

    Hello,
    We have the same issue.
    Codesys control stop working at some point.
    Did you find any solution ?

     
  • axbul - 2023-08-01

    Hello,
    We have the same issue.
    Codesys control stop working at some point.
    Did you find any solution ?

     

Log in to post a comment.