Skip to content
SeaNergy Adaptive Sonar
Bench prototype
07 · Firmware

Two cores, one hard deadline

One of these jobs has a deadline and the others do not. That single asymmetry is what decides the whole firmware architecture — the split is not for throughput, it is so the thing that must not be late cannot be made late by anything else.

01

The split

Core 0 · decide Soft real time. Late is survivable.
  • Sensor sampling

    Temperature, salinity, turbidity and depth into the rolling average.

    Measured
  • Solver

    Scores the candidate set each tick and publishes the winner.

    Measured
  • Telemetry

    State out to the deck console. Droppable by design.

    Implemented
Core 1 · transmit Hard real time. Late is a corrupted pulse.
  • DDS synthesis

    Phase accumulator steps a Q15 sine table into the transmit buffer.

    Measured
  • DMA service

    Refills the buffer before it drains. This is the deadline.

    Measured
  • Echo capture

    ADC into the receive buffer, gated after the blanking interval.

    Implemented
02

Why a lookup table

A phase accumulator into a Q15 lookup costs a handful of cycles per sample. Calling sinf() per sample does not fit inside the sample period at these rates, which is why the table is a design constraint rather than a micro-optimisation.

It is worth being precise about this, because "we used a lookup table" sounds like a shortcut and is the opposite. The synthesis rate is what makes the bandwidth available, the bandwidth is what sets range resolution, and range resolution is the number the whole instrument is measured on.

Late on core 0 is survivable. Late on core 1 is a corrupted pulse.

Telemetry to the deck console is droppable by design — if the link is congested, the console goes stale and the payload carries on surveying. Nothing on core 1 has that property, which is why nothing else is allowed to run there.