Does CODESYS Visualization Affect Mobile Machinery Controllers Real-Time?
Table of Contents
In mobile machinery such as cranes, excavators, and agricultural equipment, CODESYS Visualization (Visu) is widely used to implement human-machine interfaces.
However, engineers often observe unexpected CAN packet loss, control latency, or even controller resets after integrating complex graphical interfaces.
The root cause is architectural:
Visualization tasks share CPU cores, memory bandwidth, interrupt lines, and communication stacks with real-time control logic.
In resource-constrained embedded controllers, if system architecture is not carefully designed, the visualization layer can become a hidden source of real-time interference.
Hardware Acceleration vs Software Rendering – The Hidden CPU Trap
In mobile machine controllers based on SoCs such as i.MX6 or i.MX8, TargetVisu rendering performance heavily depends on proper GPU driver configuration.
Ideal Rendering Path
Graphics are rendered using GPU acceleration (OpenGL / OpenVG).
CPU usage remains stable.
Rendering load is offloaded from the real-time core.
Software Rendering Fallback
If GPU libraries are not correctly loaded or configured, rendering may fall back to CPU-based software rendering.
In this case:
Vector scaling
Transparency blending
Bitmap rotation
Gradient effects
are computed in software using floating-point operations.
This can create temporary CPU load spikes during complex page transitions (for example, dashboards with gauges and trend charts). On some platforms, such spikes may exceed 70–80% CPU utilization.
These spikes reduce the available time slice for J1939 message parsing and control task execution.
On Cortex-A systems this often manifests as scheduling delay.
On Cortex-M systems it may directly lead to task overrun.
Interrupt Storms and CAN Packet Loss – The Failure Chain
WebVisu introduces TCP/IP traffic, which generates frequent Ethernet interrupts.
CAN Timing Characteristics
Typical CAN FIFO depth: 32–64 frames
J1939 frames at 250 kbps
Masking delay tolerance is limited
If CAN interrupts are blocked for too long, the hardware receive buffer may overflow.
The exact threshold depends on:
MCU clock frequency
CAN controller implementation
FIFO depth
Bus load
However, prolonged interrupt masking can quickly lead to dropped frames.
Interrupt Priority Grouping – Preemption vs Subpriority
On ARM Cortex-M and Cortex-A systems, interrupt priority must distinguish between:
Preemption priority
Subpriority
Critical risk scenario:
If Ethernet and CAN interrupts share the same preemption level, then while Ethernet ISR is executing, CAN ISR cannot preempt it — even if CAN has a lower subpriority value.
Under high TCP/IP activity:
Ethernet ISR occupies CPU
CAN ISR waits
FIFO fills
Frames are dropped
J1939 communication faults may occur
Recommended Practice
Assign CAN interrupt the highest preemption level among communication peripherals
Minimize Ethernet ISR critical sections
Separate interrupt priority groups
Task Scheduling and Jitter Amplification
CODESYS uses a multi-tasking model.
Visualization tasks are typically configured with lower priority than control logic.
However, during execution they still consume shared system resources.
Rendering Block Behavior
Certain rendering operations may execute as large uninterrupted blocks (depending on driver implementation).
This leads to:
Memory bus contention
Cache miss amplification
Increased execution time variability
For high-frequency control loops (e.g., 10 ms electro-hydraulic loops), even 1 ms of additional jitter can affect actuator stability.
Watchdog Margin and Dynamic Load Validation
If visualization or communication tasks overrun their allocated time, the watchdog mechanism may trigger.
Depending on implementation:
An exception hook may execute first
If unresolved, system reset may occur
In mobile machinery, a watchdog-triggered reset during operation can lead to safety fallback states.
Quantitative Guidelines
Steady-state CPU load should remain below 70%
Maximum peak load should not exceed 85%
Validation must include dynamic stress testing:
Multiple WebVisu clients
Full CAN bus load
Rapid page switching
Active logging
Testing should also consider:
High ambient temperature (CPU frequency throttling)
EMI-induced retransmissions
Memory Fragmentation and Long-Term Stability
Modern high-end mobile controllers often use multi-core architectures.
AMP (Asymmetric Multi-Processing) allows separation of real-time and non-real-time workloads.
Recommended Layout
Core 0 (Shielded Real-Time Core)
IEC 61131-3 logic
CAN ISR
Safety logic
Core 1 (System Core)
Linux / RTOS
WebVisu server
Ethernet stack
Physical isolation eliminates most visualization-induced real-time interference.
Zero-Copy IPC Strategy
Inter-core communication should use shared memory rather than protocol-based messaging.
Advantages:
Zero-copy synchronization
Reduced CPU overhead
Deterministic data exchange
Cache coherency mechanisms must be correctly configured to avoid stale data issues.
Hardcore Optimization Techniques
Bit-Packing
Combine multiple status bits into a single DWORD before exposing to Visu.
Benefits:
Up to 32× reduction in synchronization calls
Reduced communication overhead
Note: High-speed analog signals should remain separate variables.
Asynchronous Logging
Alarm and historical data:
First stored in RAM buffer
Written to Flash by low-priority task
Prevents file I/O from blocking the control loop.
Static Asset Preparation
Pre-render graphics
Avoid runtime scaling
Use resolution-matched assets
Conclusion
In mobile machinery digital cockpits, smooth frame rates define user experience.
Deterministic execution cycles define system survival.
Real-time stability must always outweigh graphical sophistication.
Visualization is the face of the machine —
but it must never become a burden on its heart.