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
Octet76543210
0:1Header (0xBB)
1:1OriginAddress
2:1Reply/ErrorEmbedDataCommandCode
3:1DataLength EmbedData=0
3:1Datum EmbedData=1
4:1HeaderCRC8
5:NData EmbedData=0
5+N:1DataCRC8 EmbedData=0, DataLength<=13
5+N:2DataCRC16 EmbedData=1, DataLength>13

More details available on GitHub.