Skip to content

Deciphering Low Level BiDiB Messages

Eugene edited this page Mar 19, 2019 · 13 revisions
  1. For a given BiDiB message, check its message type.
  2. Each message type has a particular message encoding.

Example 1

A servo is connected to address 0x0a of a OneControl board (address 0x01) and the command 0x01 is sent to set the servo into the "normal" position. Suppose we receive the following BiDiB error message:

SWTbahn error message queue: 0x09 0x01 0x00 0x0f 0xb8 0x0a 0x01 0x02 0x80 0x06

We can break the message down:

  • MSG_LENGTH: 0x09 (9 bytes long, excluding this MSG_LENGTH byte)
  • MSG_ADDR: 0x01 0x00 (OneControl board; last byte of MSG_ADDR is always 0x00)
  • MSG_NUM: 0x0f (monotonically increasing message index to check for lost messages)
  • MSG_TYPE: 0xb8 (MSG_ACCESSORY_STATE)
  • DATA: 0x0a 0x01 0x02 0x80 0x06 (to be decoded)

The data can be decoded by looking at Accessory Control (4.6.4. Uplink: Messages for accessory functions):

  • ANUM: 0x0a (servo is at address 0x0a)
  • ASPECT: 0x01 ("normal" position)
  • TOTAL: 0x02 (servo has 2 possible positions)
  • EXECUTE: 0x80 (bit 7 is 1, so an error has occurred; WAIT provides the cause)
  • WAIT: 0x06 (feedback error)

Example 2

The occupancy of a track output (address 0x06) has changed. Suppose the following BiDiB notification message is received:

0x08 0x00 0xda 0xa3 0x06 0x02 0x00 0x01 0x80

We can break this message down:

  • MSG_LENGTH: 0x08 (8 bytes long, excluding this MSG_LENGTH byte)
  • MSG_ADDR: 0x00 (GBMboost Master board)
  • MSG_NUM: 0xda (monotonically increasing message index to check for lost messages)
  • MSG_TYPE: 0xa3 (MSG_BM_ADDRESS)
  • DATA: 0x06 0x02 0x00 0x01 0x80 (to be decoded)

The data can be decoded by looking at Occupancy Detection (4.7.4. Uplink: Messages for occupancy detectors):

  • MNUM: 0x06 (track segment with address 0x06)
  • ADDR_L ADDR_H: 0x02 0x00 (address of first train is 0x02; left side towards detector)
  • ADDR_L ADDR_H: 0x01 0x80 (address of second train is 0x01; right side towards detector)