# HAL Settings

The HAL is the driver loaded on the SLM-RP4 responsible for communication with the base controller. The HAL Settings screen exposes a few parameters that may need adjustment for a specific process.

Open it from **Device → HAL Settings**.

```{image} ../../images/editor/hal-settings.png
:alt: The HAL Driver Settings screen
:width: 750px
:align: center
```

The defaults are suitable for most installations. Change them only in response to a specific requirement.

## Bus Scan Cycle

**Default: 10 ms. Range: 1-1000 ms.**

How often the driver reads inputs and writes outputs on the backplane. This is the I/O update rate; it is independent of the PLC task interval.

Lower the cycle when the process requires faster I/O updates. This is viable when few modules are installed. Raise it to free CPU time on installations where fast I/O is not required.

The minimum achievable cycle depends on the number and type of modules installed. Setting a cycle too close to the measured scan time may produce overruns and trigger a bus fault. Monitor the current scan time reported by the runtime against the configured cycle, and keep a margin between the two.

```{admonition} Scan cycle and task interval are different things
:class: note

The bus scan cycle governs how fresh the I/O image is. The PLC **task interval** governs how often the logic runs against that image. Setting the task to 5 ms while the bus scans at 50 ms does not produce 5 ms inputs; the logic re-runs against data that has not changed.

As a rule, configure the bus scan to be at least as fast as the fastest task. Task configuration is covered in the [OpenPLC documentation](https://edge.autonomylogic.com/docs/openplc-editor/task-configuration/understanding-tasks).
```

## Enable Bus Fault Detection

**Default: on.**

When enabled, the driver counts consecutive failed backplane transfers per slot and takes action once the count crosses the threshold. Disabling it removes all bus supervision; the driver continues to retry, silently, under any condition.

Leave it enabled. Running a machine with an unsupervised I/O bus is not recommended.

## Fault Threshold

**Default: 10 consecutive cycles. Range: 1-1000.**

Number of consecutive failed transfers on the same slot before the fault action fires. Counting *consecutive* failures is deliberate: a transient glitch from electrical noise should not stop the machine, while a module that has lost power or come loose fails every cycle.

At the default settings (10 ms scan, threshold 10) a fault trips after approximately 100 ms of continuous failure.

Lower the threshold for faster detection, at the cost of higher sensitivity to transients. Raise it in electrically hostile environments to reduce nuisance trips, at the cost of a longer window of stale I/O before the fault action fires.

## Fault Action

**Default: Zero outputs and stop PLC.**

Action taken when the threshold is reached.

**Zero outputs and stop PLC:** every output on every module is driven to zero, the I/O loop halts, and the PLC remains stopped until it is restarted. This is the safe default.

**Log warning only:** a warning is written to the runtime log each time the threshold is reached; the I/O loop continues to run and outputs are left untouched.

```{admonition} Choose "Log warning only" deliberately
:class: danger

With this setting the machine continues to run on I/O the driver knows it cannot trust. Outputs hold their last commanded state while inputs may be stale.

This option is intended for non-critical applications such as data logging or environmental monitoring. For any controller driving motors, valves, heaters or other equipment capable of causing injury or damage, leave it on **Zero outputs and stop PLC**.

Neither setting is a substitute for a hardwired safety circuit. Bus fault detection is a diagnostic, not a safety function.
```

Both settings also apply to **cycle overruns**, which occur when the driver cannot complete a scan within its configured cycle time. The same threshold and action apply.
