Platform Architecture

The Ruten middleware stack.

Four layers from electrode contact to stimulation pulse. Designed so device firmware engineers spend weeks integrating, not months. Each layer has a defined API surface and can be configured independently; the full stack deploys as a single static library.

PROTOCOL / APPLICATION LAYER therapy config · stimulation parameter sets · session management DECODE ENGINE spike sort · feature extract SAFETY MONITOR charge density · IPI · safe-state HARDWARE ABSTRACTION LAYER (HAL) electrode drivers · amplifier interfaces · stimulator drivers HARDWARE electrode arrays · amplifiers · neurostimulators rtn_acquire() → rtn_decode() → rtn_validate() → rtn_stim_dispatch()
Layer 1

Signal Acquisition

The HAL provides hardware-agnostic access to electrode arrays and amplifiers. Device-specific register maps are contained within the driver module; your protocol code calls the same acquisition API regardless of the underlying hardware.

Hardware Abstraction
SPI, I2C, and UART amplifier interfaces encapsulated in swappable driver modules. Switching hardware vendors does not require changes above the HAL boundary.
Multi-Channel Buffering
Circular buffer architecture for continuous multi-channel acquisition. Buffer depth and channel count configurable at compile time for the target processor's memory constraints.
Synchronization
Cross-channel timestamp alignment and inter-device synchronization primitives. Designed for setups where electrode array and stimulator are on separate MCUs.
Layer 2

Neural Decoding

The decode engine runs threshold-crossing detection, artifact rejection, and feature extraction on-device. Designed to operate within the memory and compute constraints of Cortex-M4 class processors at sub-10ms total decode latency.

Threshold Detection
Adaptive threshold crossing with configurable multiples of RMS noise floor. Refractory period enforcement and channel-independent threshold tracking per electrode.
Artifact Rejection
Stimulation artifact blanking with configurable pre- and post-stimulus windows. Common-mode rejection across channel groups to suppress motion and amplifier artifacts.
Feature Extraction
Waveform feature extraction optimized for embedded: energy, peak-to-peak amplitude, and principal component projections with pre-computed basis vectors loaded from config.
Layer 3

Safety Validation

Every stimulation command passes through the safety monitor before reaching the stimulator driver. The safety layer enforces the charge density, pulse width, and IPI limits defined in your device-specific configuration file.

Charge Density Limits
Per-channel charge density tracking against the Shannon-McCreery tissue safety limit. Commands that would exceed configured limits are blocked before dispatch, not after.
Safe-State Machine
Three-level fault response: soft limit (log warning), hard limit (inhibit channel), critical fault (cease all stimulation). State machine designed to align with IEC 60601 firmware safety requirements.
Config-Driven Limits
Safety limits loaded from device-specific config files at initialization. The same SDK binary can enforce different limits across device variants without firmware recompilation.
Layer 4

Stimulation Dispatch

Validated stimulation commands are dispatched to the stimulator driver layer with configurable timing precision. Closed-loop feedback integration allows decoded neural state to update stimulation parameters within the same acquisition cycle.

Closed-Loop Integration
Decoded intent vectors fed back into stimulation parameter selection within the same acquisition cycle. Feedback latency tracked and surfaced via the SDK monitoring API.
Parameter Scheduling
Frequency, pulse width, and current amplitude scheduling with per-channel override capability. Ramp-up and ramp-down profiles configurable to avoid abrupt stimulation transitions.
Multi-Vendor Drivers
Stimulator driver modules for multiple commercial neurostimulator platforms. New device support added through the HAL driver interface without changes to the dispatch or safety layers.

Review the full API documentation

Detailed API references, integration guides, and configuration schema documentation are available in the Ruten SDK docs.