BearBus

BearBus is a message protocol intended for use on UART and similar interfaces. It allows for communication between a single host and up to 127 devices using
up to 60 command codes.

Messages can contain up to 240 bytes of extra data which is either CRC-8 (up
to 13 bytes of data) or CRC-16 verified (14-240 bytes). The total message
length is thus between 5 bytes (a single data byte) and 247 bytes (5 byte
header, 240 bytes data, 2 bytes CRC-16).

All commands either originate from host or have host as their destination.
There is no inter-device communication.

There are three distinct versions of packet:

  • Short (only 5-byte header with a single byte of embedded data)
  • Basic (up to 13 bytes of data are supported)
  • Long (up to 240 bytes of data are supported)

Packet is defined as follows:

Bit
Octet 7 6 5 4 3 2 1 0
0:1 Header (0xBB)
1:1 Origin Address
2:1 Reply/Error EmbedData CommandCode
3:1 DataLength EmbedData=0
3:1 Datum EmbedData=1
4:1 HeaderCRC8
5:N Data EmbedData=0
5+N:1 DataCRC8 EmbedData=0, DataLength<=13
5+N:2 DataCRC16 EmbedData=1, DataLength>13

More details available on GitHub.