Real-time constraint for DSP: you must process each sample (or block of samples) before the next one arrives. Miss the deadline and you have a buffer overrun — samples are lost, the pipeline breaks.
The basic loop:
- Interrupt fires at sample rate (e.g., 44.1 kHz)
- DMA transfers new sample to buffer
- Processing task wakes
- Filter / transform / detect
- Output result
- Must complete before next interrupt (22.7μs at 44.1 kHz)
Timing budget for PulsarSync-Core (RP2040, 125 MHz):
- Sample rate: 1 MSPS (from ADC)
- Budget per sample: 1μs
- At 125 MHz: 125 cycles per sample
- Dispersion measure correction: ~80 cycles (FIR filter, 8 taps, Q15)
- Pulse period accumulator: ~20 cycles
- Total: ~100 cycles — fits with 25-cycle margin
The dual-core split in PulsarSync gives Core 0 the FIR filter (80 cycles, tight) and Core 1 the feature extraction (can accumulate over multiple samples, latency-tolerant).
Double buffering: While Core 0 processes buffer A, the DMA fills buffer B. When DMA completes buffer B, Core 0 switches to processing B while DMA refills A. This eliminates the race between DMA writes and CPU reads.