# Node and submaster firmware

MSCB firmware has two distinct roles:

- a **submaster** bridges host-side Ethernet/UDP requests to ninth-bit RS-485;
- a **node** implements address handling, commands, variables, persistence and
  application-specific I/O.

## Node responsibilities

A conforming node should:

1. recognize 8- and 16-bit node, group and broadcast address cycles;
2. answer ping quickly and never answer another node's address;
3. validate command CRC before changing state;
4. expose complete variable metadata;
5. serialize numeric variable values in the protocol byte order;
6. return the received CRC for acknowledged writes;
7. reserve slow timeout behavior for flash and upgrade work; and
8. avoid replies to group/broadcast commands.

Application firmware owns the variable table and the behavior of `MCMD_USER`.
Memory-access and upgrade commands must enforce the device's real memory map
and write restrictions.

## Submaster responsibilities

The Ethernet submaster validates the UDP header/version, correlates sequence
numbers, produces address characters with bit 9 set, forwards ordinary data
with bit 9 clear, observes timeout flags, and returns bus timeout separately
from a lost UDP packet. It also implements discovery, echo, token/password,
reset, and information commands used by host initialization.

## Firmware files

The C host library recognizes the supported firmware image formats. Use
`mscb_upload()`, `mscb_download()`, and
`mscb_verify()` rather than reimplementing flash packet details. Always verify
the exact image and target/subaddress before writing program memory.
