Skip to content

Add Net Amps 500 (GES 500) support - #18

Open
cboulay wants to merge 1 commit into
masterfrom
cboulay/na500_support
Open

cboulay wants to merge 1 commit into
masterfrom
cboulay/na500_support

Conversation

@cboulay

@cboulay cboulay commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Adds support for the Net Amps 500 amplifier (GES 500), verified against real hardware (firmware 0.4.9) and cross-checked against Net Station 6.0.0.60960 behavior. NA400 support is unchanged — all model-specific behavior is gated on the amplifier type reported by cmd_GetAmpDetails, and both models were regression-tested against the mock server.

Protocol robustness (all models)

  • Single-write commands. The NA500's AmpServer parses each TCP segment as a complete message; commands split across segments (possible with multiple stream insertions) desynced its request/response pairing — responses were replayed for the wrong requests. Commands are now built into one string and written in a single insertion, with a resync that skips stale non-response lines.
  • Bounded command timeout (10 s). A crashed-but-listening AmpServer used to hang the client forever (spinning beach ball in the GUI). Timeouts now surface as clean errors.
  • GUI links on a worker thread. The connect/query/start sequence can legitimately take 15+ s on an NA500 cold start; the UI now stays responsive throughout, with progress in the status pane and completion via queued signals.

NA500 specifics

  • Scaling: 0.044703 µV/bit (0.75 V range / 2²⁴). Confirmed three ways: the GES 500 datasheet (±375 mV, 24-bit), Net Station 6's NA500ScaleFactor(), and measurement of the amp's own ±1900 µV square-wave calibration signal end-to-end through the LSL stream.
  • Power-on wait: the NA500 silently drops commands sent while powering up (~10 s from cold); initialization now powers on first and waits for ntn_AmpPowerOn.
  • Persistent data connection: the NA500's AmpServer stops serving data to new listeners once any listener disconnects (until the amp restarts), and cmd_StopListeningToAmp wedges the client session entirely. The client now keeps one listening data connection for the whole session and never sends StopListening to an NA500.
  • Recovery via polling: the NA500 emits no ntn_AmpStarted, so passive recovery polls the data port instead of waiting for a notification.
  • Rates: decimated 250/500/1000/2000 Hz and native 250–16000 Hz, all verified streaming; no duplicate packets at low rates (unlike NA400). Rate auto-detection extended to 16 kHz, bounded by measured duration, and hardened against stale buffered samples.
  • Filter delays: zero compensation in all modes, matching Net Station 6 (its calculateShift() applies no anti-alias shift for the NA500).

GUI

  • Sample-rate dropdown expanded to the NA400+NA500 union (adds 250 Hz low-latency, a 2000 Hz decimated/low-latency split, and 16000 Hz), with "NA500 only" labels. Since the model is only knowable after connecting, the client validates the selection right after the amp identifies itself (supportsSampleRate()) and refuses unsupported combinations with a clear error before any state-changing command — the CLI gets the same guard.
  • LSL stream names now derive from the address's last octet (.51/.52 keep their historic names; e.g. an amp at .62 becomes EGINetAmp_62).

Known NA500 limitations (documented in README)

  • The NA500 serves a single client: while Net Station is linked, this app's connections are accepted but not serviced (and vice versa). Concurrent monitoring, which worked on the NA400, is not possible.
  • Firmware 0.4.9's AmpServer can crash after abrupt client disconnects (requires amp power-cycle); the client now fails gracefully when that happens.
  • DIN input polarity on the NA500 (raw idle is 0 vs the NA400's 0xFFFF) is not yet verified with a real TTL trigger source.

🤖 Generated with Claude Code

Verified against real NA500 hardware (fw 0.4.9, serial 0007) and Net
Station 6.0.0.60960. NA400 behavior is unchanged: model-specific logic is
gated on the amplifier type reported by cmd_GetAmpDetails.

Protocol fixes (benefit all models):
- Send each command in a single TCP write. The NA500's AmpServer parses
  every TCP segment as a complete message, so commands split across
  segments (which multiple stream insertions could produce) desynced its
  request/response handling. Also resync by skipping stale non-response
  lines, and bound the response wait at 10 s so a hung AmpServer can no
  longer freeze the client forever.
- GUI links on a background thread with progress via queued signals; the
  UI stays responsive through the NA500's ~10 s cold power-on wait and
  shows a clean error if the server is unresponsive.

NA500-specific handling:
- Identify NA500 from amp_type; scaling factor 0.044703 uV/bit
  (0.75 V / 2^24), confirmed by the GES 500 datasheet, Net Station 6's
  NA500ScaleFactor(), and a square-wave calibration measurement.
- Wait for ntn_AmpPowerOn before configuring: the NA500 silently drops
  commands issued during power-up.
- Keep one persistent listening data connection per session and never
  send cmd_StopListeningToAmp: the NA500's AmpServer stops serving new
  listeners after any listener drop (until amp restart) and wedges the
  session outright on StopListening.
- Poll the data port for passive recovery: the NA500 emits no
  ntn_AmpStarted notification.
- Rate tables: decimated 250-2000 Hz, native 250-16000 Hz, no duplicate
  packets at low rates (all verified streaming). Rate detection and
  rate-change snapping extended to 16 kHz; detection bounded by measured
  duration and robust to stale buffered samples.
- Zero anti-alias filter delay compensation, matching Net Station 6
  (its calculateShift() applies no shift for the NA500).

GUI:
- Sample-rate dropdown now offers the NA400+NA500 union (adds 250 Hz
  low-latency, 2000 Hz decimated/low-latency split, 16000 Hz) with
  "NA500 only" labels; selections are validated against the identified
  model at link time (supportsSampleRate) and refused with a clear error
  before any command touches the amp.
- LSL stream names derive from the address's last octet (.51/.52 keep
  their historic names).

Mock server emulates NA500 rate validation and details response.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant