Architecture specification

Embedded peripheral drivers and a closed-loop thermal controller

Embedded systems and firmware · Hardware abstraction layers and deterministic control loops

Firmware for the embedded controllers in industrial machinery that drives the operator displays and regulates enclosure temperature through closed-loop fan control.

The challenge

Embedded controllers inside industrial equipment must drive local OLED and TFT operator displays over serial board buses while regulating internal enclosure temperatures through closed-loop fan control—interfacing directly with kernel device interfaces rather than heavy user-space wrapper libraries.

Because these units operate unattended for years, all memory must be allocated statically at build or boot time so the heap can never fragment, and the hardware watchdog timer must be refreshed only when acquisition and rendering threads meet strict timing deadlines.

Display bus
Differential updates transmitting only modified screen regions
Memory model
100% static allocation at boot with zero heap fragmentation
Thermal control
Closed-loop 32-bit fixed-point PID fan governance
Supervision
Hardware watchdog gated by thread deadline verification

Architecture

Direct kernel and register interface

The hardware abstraction layer communicates directly with Linux character device interfaces for SPI, I²C, and GPIO lines via raw system control calls and memory-mapped peripheral registers, eliminating third-party wrapper overhead.

Compile-time static memory allocation

Display framebuffers, direct-memory-access (DMA) transfer descriptors, and control-loop state vectors are statically allocated at startup, guaranteeing zero dynamic memory fragmentation across multi-year uptimes.

Architecture

The hardware layer reads the die and enclosure thermistors for a fixed-point PID loop that sets the fan’s duty cycle, sends only the changed windows of a static framebuffer to the display over SPI, and feeds the watchdog only while its threads meet their deadlines.

Hardware and protocols

Differential XOR display updates

Industrial OLED and TFT displays over SPI and I²C buses are driven from a contiguous monochrome or RGB565 buffer. Each frame is compared via bitwise XOR against the prior frame to isolate mutated bounding boxes, transmitting only modified page and column windows in burst transfers and reducing bus traffic by over 75%.

Fixed-point PID thermal loop

Die and enclosure thermistors are sampled on a strictly monotonic clock. A proportional-integral-derivative (PID) loop written in 32-bit signed Q16.16 fixed-point arithmetic—avoiding floating-point context switches—modulates hardware PWM fan duty cycles with integral anti-windup clamping.

Deadline-gated hardware watchdog

A supervisor thread verifies that both sensor acquisition and display rendering loops complete within their scheduled cycle budgets before issuing keep-alive signals to the hardware watchdog timer.

Verification

A virtual device-interface shim, compiled in at build time, intercepts the firmware's calls to the kernel's device interfaces and routes them to an in-memory model of the hardware.

Automated tests check the exact SPI initialisation byte sequences, dirty-rectangle geometry, and PID duty-cycle settling across simulated thermal load curves, on standard x86-64 and ARM64 build servers.

Verification readout
embedded-hal-thermal-controller / verification
StatusConstraintResultMethod
Met Bus traffic > 75% less Automated tests check dirty-rectangle geometry
Met SPI initialisation Exact byte sequences Tests against an in-memory model of the hardware
Met Thermal loop Duty cycle settles Simulated thermal load curves, on x86-64 and ARM64 build servers
Proof delta
device / display bus
Display bus traffic
Every frame sent in full
Only the page and column windows that changed

> 75%less bus traffic to industrial displays

Next specification

Energy Field operations for critical infrastructure, with offline-first sync Read specification