Skip to content

Board controller

The board controller bridges a serial-attached microcontroller to NATS. It exposes the board's Modbus (or raw byte) registers as command endpoints and publishes configured registers as data channels.

Module id: bc.

Two roles, distinguished by Modbus unit id of the connector:

  • application (bcapp) - default unit 1
  • bootloader (bcbl) - default unit 2

The controller probes periodically to learn which role is currently reachable. Booting into application mode is driven externally (a helper script sending the bootloader's app-start command through the direct endpoint), not by an in-process auto-start.

Firmware updates are likewise external: read versions and write firmware through the generic command endpoints. The board controller has no firmware-specific logic of its own.

Channels are configured at runtime as channel configs. The module also publishes a dsource.

NATS endpoints

Command Request Description
bc.main.<id>.cmd JSON Executes one board-controller command - a register read or write by ref, or a direct read or write by unit and register id - and answers its result; the body is the command object, discriminated by its type field.
bc.main.<id>.cmds JSON Executes a batch of board-controller commands in order, with one default timeout, and answers every command's result; with continueOnError a failed command does not end the batch, and its error is in the result.

Two endpoints are not declared under RFC-040 yet and are addressed by subject:

Subject Purpose
local.bc.cmd.<connector>.reg.<register> Read (empty body) or write (ASCII uint16) a configured register
local.bc.cmd.<connector>.direct.reg_<id> Bypass register-ref indirection

The register component id is reg; legacy main is still accepted. The command union of main.cmd and main.cmds is the shared boardCommand definition in the commands reference. Details: Messaging.