Applications › Audio & USB
Streaming audio and USB traffic fail audibly when a deadline slips: a click, a dropout, a stalled endpoint. STK keeps scheduling predictable and out of the way.
Audio buffers must be refilled on time, every time. A late refill is heard.
Endpoints must be serviced on the host's schedule while the rest of the firmware keeps running.
Fixed-size frames move between DMA, interrupts and tasks, and allocation delays are not acceptable.
KERNEL_HRT mode with monitored deadlines, EDF, RM and DM schedulers, and miss callbacks, so you can mute or fade the output instead of glitching.
See the Cortex-M4 jitter and CPU-time figures in our benchmarks, and verify your own timing with SEGGER SystemView.
A third-party port lets the TinyUSB stack run on STK.
BlockMemoryPool for fixed-size audio frames and USB packets, BytePool for byte-granular needs. No fragmentation.
Pipe, MessageQueue, EventFlags and Semaphore in stk::sync hand data and events between tasks.
One STK instance per physical core, for example audio processing on one core and USB and control on the other.
Driver and peripheral integration for I2S/TDM audio, USB and DMA engines is available as an engineering service.
Run the audio processing task at the highest urgency (EDF or fixed priority), with its period matched to the DMA buffer period.
Double-buffer DMA transfers using BlockMemoryPool, so the CPU always works on a buffer the DMA is not touching.
Run the TinyUSB task and control logic at lower urgency, passing data between tasks with a MessageQueue or Pipe.
On dual-core MCUs, assign audio to one core and USB and control to the other, with one STK instance per core.
Register a deadline-miss callback that mutes or fades the output, and trace the system with SystemView.
STK does not include audio codecs, DSP libraries or USB class drivers. It provides the deterministic foundation: TinyUSB and your DSP code sit on top.
Porting, real-time tuning, certification support and commercial components are available. See services.