Skip to main content

CBRT Realtime Codec

CBRT (CycBox Realtime) is a compact binary protocol for streaming multi-channel sample data from a microcontroller. Each frame has three parts:

  • the CBRT sync word;
  • a header: the data type, the channel count (1–64), and an optional sequence number, timestamp, sample period and CRC-16/MODBUS;
  • the samples, interleaved by channel. One frame can carry many samples for every channel.

The data type is one of: 8- to 64-bit integers, 32- or 64-bit floats, half floats (f16, bf16), Q15/Q31 fixed point, or packed booleans.

The codec finds frames in the byte stream, validates them, and turns each one into one message:

  • Values ch0, ch1, …, one per channel per sample, ready for dashboard charts. Each sample gets its own timestamp. When the frame carries a timestamp and a sample period, those are used. Otherwise CycBox uses the arrival time and estimates the period from how often frames arrive.
  • Metadata: datatype, samples, period_us, plus seq_dropped / seq_duplicate when the sequence number shows lost or repeated frames.

Invalid frames (bad CRC, impossible channel count or length) are skipped, and decoding resumes at the next CBRT sync word. Sending is raw: the payload goes out unchanged, so commands to the device can use any format.

Use it on byte-stream transports such as the serial port, TCP or BLE UART. Where each message already holds one frame (MQTT, WebSocket), use the CBRT Realtime transformer.

To produce frames on the device, use the C encoder in the open-source CycBox repository: crates/cbrt/lib is one .c and one .h file and needs no malloc. The full wire format is in protocol.md.

Configuration reference​

Config IDcbrt_codec
Selected byapp_codec = "cbrt_codec"
PlatformsLinux, Windows, Android
LicenseFree

Decode-only codec for the CBRT (CycBox Realtime) streaming sensor protocol. Parses multi-channel, optionally timestamped sample frames. TX is raw passthrough — bytes are sent as-is, with no header added.

This codec has no settings of its own.

Example config​

Default values as they appear in a saved configuration (for example the JSON block at the end of a cycbox/examples/*.lua file). Settings detected at runtime are omitted.

{
"app": {
"app_codec": "cbrt_codec"
}
}