WAGO / pfc-firmware-sdk-G2

Firmware SDK for PFC200-G2 family
Mozilla Public License 2.0
13 stars 5 forks source link

All IO off/on when login to WBM #11

Closed sjoerdboerhout closed 10 months ago

sjoerdboerhout commented 12 months ago

Currently I'm experiencing an issue at a customer with 2 systems running on WAGO PFC200 750-8213/8214 PLC's. One system is running FW25 and the other one FW23. Each system has 5 PLC's and the issue occurs on all PLC's. The PLC's are daisy chained with their 2-port internal switch.

When I connect my laptop to the machine network, open a browser and login into the PLC all IO will quickly turn off and on at the moment I hit the login button. This is really annoying and dangerous behavior as the whole process on the system is interrupted and products are lost.

At this moment my only solution is to warn the users of the system to never open the WBM when the system is in use.

Note: The system is running on our own developed C-based software using the WAGO ADI/DAL-library (https://github.com/WAGO/pfc-howtos/blob/master/HowTo_ADI-MyKBusApplikation/a800010_en%20-%20ADI-DAL%20for%20PFC%20firmware%2011%20patch%202.pdf)

falk-werner commented 12 months ago

Hello @sjoerdboerhout,

please check the priority of your application. Therefore, you can use the chrp tool. The tool needs the process ID of your application, which can be obtained using ps or htop. In the following example, we assume a process ID of 1234:

> chrt -p 1234
pid 1234's current scheduling policy: SCHED_FIFO
pid 1234's current scheduling priority: 86

Your application should run with priority 86 and a SCHED_FIFO policy. When the priority of your application is too low, it can be interrupted by other tasks. I assume, this might have happend when you opened WBM.

Please contact WAGO support, if the priority of your application is correct but the error remains. In this case, we need further information to reproduce the error in our environment. Please refer to this Issue when contacting WAGO support.

sjoerdboerhout commented 11 months ago

Hi,

I'm no longer at the customer site and now trying to reproduce the issue on another system. The PLC's are running FW 23. Same as one of the systems of the customer, but (unfortunately) it does not occur on this system.

The results of the command you mentioned on this system:

appuser@MAHA:~ ps -aux | grep maha root 1513 4.7 11.0 77264 55320 pts/0 SLl+ Jul21 280:55 ./maha

appuser@MAHA:~ chrt -p 1513 pid 1513's current scheduling policy: SCHED_OTHER pid 1513's current scheduling priority: 0

Can you explain why it should be (exactly) 86 en SCHED_FIFO? End what does the WBM do causing the IO the turn off/on? The team who ported our software platform to WAGO spend some time to correctly configure it related to scheduling. I will ask the team how they ended up with the current configuration.

falk-werner commented 11 months ago

Hello @sjoerdboerhout,

K-Bus must be driven actively by your application. Therefore the function libpackbus_Push must be called regularly. An example is given in kbusdemo.c. If K-Bus is not driven for too long, the I/Os will turn off.

Since your application runs with background priority (SCHED_OTHER, priority 0), it can be interrupted by tasks of low priority. WBM is such a task. To prevent this, your application should be executed with a real time priority. The value of 86 is the prority of the KBUS_CYCLE_TASK we use in the CODESYS runtime. The kbusdemo uses a priority of 40, which is also valid. The critical point is to make sure that K-Bus is driven regularly.