Strange behavior in the IEC application
Requirements
You are using a CODESYS runtime.
Troubleshooting
If you observe strange behavior, then you should check whether the runtime logger provides valuable hints or information. The CODESYS runtime logger has a mechanism for filtering messages by category. The Debug category is not enabled by default. Enable this category to find the cause of strange behavior or unexpected symptoms.
There are global and component-specific log filters. You can see a detailed list of all possible component-specific filters in the log file of the runtime. Use the filters as described below.
Symptoms related to | Possible component-based log filter |
---|---|
Licensing |
|
IEC tasks / timing (higher level) |
|
IEC tasks / timing (low level) |
|
IEC application (general) |
|
IEC application (memory) |
|
Socket communication |
|
Ethernet communication |
|
Files / folders |
|
Tip
Do not enable all debug categories at the same time because that would make it difficult to find the actual problem. Proceed step by step and disable "irrelevant" filters to get a better view of the problem.
Open your CODESYS project and connect it to the controller.
Open the PLC shell by double-clicking the controller in the device tree.
Enter "?" in the shell in order to see all possible commands.
Use the
logsetfilter
,loggetfilter
, andlogdelfilter
commands to write, read, and delete a filter. You can either use global debug filters for the entire runtime or filters for a specific component.To read the current log category globally:
loggetfilter
could return the following output:Logger.0.Filter : 0x0000000F
To set the current log category globally:
logsetfilter 0xffffffff
To read the current log category for a specific component (for example,
CmpCodeMeter
):loggetfilter CmpCodeMeter
To set the current log category for a specific component (for example, CmpCodeMeter):
logsetfilter CmpCodeMeter 0xffffffff
Example: Via an SSH connection and a text editor
Stop the runtime via the Deploy Tool.
Connect to your target system (for example, via
putty
or another SSH client).Open the user-specific configuration file of the runtime environment with a text editor (for example,
nano
):sudo nano /etc/codesyscontrol/CODESYSControl_User.cfg
Find the
CmpLog
section and set the filter.Example 1. Setting a global filterExample:
Logger.0.Filter=0xFFFFFFFFFF
to enable all debug messagesExample 2. Setting a component-specific filter[CmpLog] CmpCodeMeter.Filter=0xFFFFFFFF SysTask.Filter=0xFFFFFFFF
Save and close the file.
Restart the runtime with the Deploy Tool.