CAN Bus Architecture
This page is still a WIP as we finalize a lot of important decisions to be made here.
Message Arbitration ID Structure
Devices on the workcell CAN bus have the ability to communicate in 2 different domains. The first domain uses non-device-specific protocols such as DCCP and CESP. The second domain uses device-specific protocols such as the Riden CAN protocol (riden_proto). In order to logically separate these and remove the need for every device on the bus to understand the protocols of all other devices on the bus, the 29-bit extended CAN identifiers used in CAN FD are broken up into several different parts.
The most significant bit (index 28) is used to denote the direction of communication. If this bit is cleared (0), this implies that the frame originated from the workcell controller. If this bit is set (1), then this means that the frame originated from one of the devices on the bus. From here on out, the most significant bit will be referred to as the "Direction" bit.
The 10 second most significant bits (indexes 27-18 inclusive) are used to denote the communication domain. If these bits are all cleared, this denotes that the frame is using a globally understood protocol and not a device-specific protocol. If any of these bits are set, then this indicates that the frame is using a device specific protocol and the 10 second most significant bits represent the device ID of the sender or intended recipient. From here on out, the 10 second most significant bits are referred to as the "Device ID" bits.
When the direction is cleared (0) and the device ID is 0, then the frame is intended to be seen by all devices on the bus as part of a device independent protocol (a broadcast message). If the device ID is non-zero, then the frame is intended to be received by the device with the corresponding ID, and the communication is part of a device-specific protocol.
When the direction bit is set (1) anf the device ID is 0, then the frame is part of a device independent protocol. If the device ID is non-zero then it indicates the sender of the message and that the frame is part of a device-specific protocol.
The remaining 18 bits of the CAN message ID are interpreted differently depending on the protocol being used. If the device ID is 0 (indicating the use of device independent protocol), then the remaining bits signify the type of message being sent. If the device ID is non-zero, no assumptions can be made about the remaining bits and it is up to the device specific protocol to define their meaning and interpretation.
This structure ensures that messages from the workcell controller always have higher priority than messages from devices on this bus since the most significant bit will be cleared. Additionally, messages using device-independent protocols will always have higher priority since their device ID is 0.
| Name | Direction | Device ID | Protocol Message ID | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Bit Index | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |