laruso - 2021-04-26

In the documentation of the Add-on "CODESYS Control for BeableBone SL", under point "Preparing the PLC", there is the hint to deactivate "Real-Time group scheduling"with this code segment:

CONFIG_RT_GROUP_SCHED=n

but I don't know were to put (very weak doku here). The only place I found it, was in the kernel configuration files, found in /boot/config-<kernel name="">. But these file must not be edited.</kernel>

In the default kernel configuration files (ti, non-rt, e.g. "config-4.19.94-ti-r42") there is an entry like this:

CONFIG_RT_GROUP_SCHED=y

In other kernel configuration files (bone, non-rt, e.g. "config-4.19.165-bone59" there is an entry like this:

# CONFIG_RT_GROUP_SCHED is not set

And in the kernel configuration files of the pre-compiled realtime kernels, there is no entry like this at all.

I followed the next hint to uninstall the package "libpam-systemd" by shell command "sudo apt-get remove libpam-systemd".

At least this recommendation is only for BeagleBone Black and not for Raspberry Pi. (confused)

Next point was to install a precompiled realtime kernel (e.g. 4.19.165-bone-rt-r59) like described at https://elinux.org/EBC_Exercise_36_PREEMPT_RT .

I did the main program in a freewheeling task with priority 16 (low linux default priority), and the time relevant program in a separate task with priority 0 (highest realtime priority) and interval 500 Β΅s.

In spite of definitely sawing a drop in jitter after doing this, I want to know if there are any other tweaks to enhance the performance.

On the other side, I found a post which claims (Edwin cited) to have these entries in the CODESYSControl_User.cfg file, when no realtime is needed. But I found these entries in the actual CODESYSControl.cfg file (in directory /etc/):

[CmpSchedule]
ProcessorLoad.Enable=1
ProcessorLoad.Maximum=95
ProcessorLoad.Interval=5000
DisableOmittedCycleWatchdog=1

Source: https://forge.codesys.com/forge/talk/Runtime/thread/e82256d0d8/#e81e

This information confuses me and implicates, that other values are necessary when realtime is needed.
Questions:
- Why these entries without realtime?
- Which entries with realtime?

With the library "CmpSchedule" and the function "SchedGetProcessorLoad" I can get the information about the CPU usage of the (realtime) kernel threads (60 % right now). But the total CPU usage out of "htop" is about 75 % (because of the additional normal threads). Is there a possibility to also get the CPU usage of non kernel/realtime tasks? Or the overall CPU usage? Or the CPU load averages?

I was a bit confused when it looked like the CPU is clocked with possibly higher frequency, if the value of parameter "_diMaxSpeed" from the SPI_master is set higher (than expected to be):
I've read that the BeagleBone Black should only have a SPI capability of 500 kHz. A lower values resulted in a CPU usage overload via watchdog. (After all it's a result of CPU seems to get slower.) So I decided to check higher values and saw the cycle time getting faster, till a threshold is reached. Now the SPI master works fine with 2 MHz for "SPI max speed" parameter. (Don't understand that after all)

 

Last edit: laruso 2022-03-23