Skip to main content

DCCP

GitHub: https://github.com/adom-inc/dccp_proto

The Dynamic CAN Configuration Protocol, or DCCP for short (and implemented by the dccp_proto crate), is a protocol used within the workcell CAN buses to dynamically assign device CAN IDs based on serial number. It is inspired by DHCP which is used in computer networking to dynamically assign device IP addresses on a particular IP subnet. The protocol also supports dynamically switching device drivers based on the connecting device's firmware version. For information about how message arbitration IDs are structured within the workcell CAN bus, see the CAN Bus Architecture page.

Overview

This protocol is designed to be as robust as possible in the case where communication over the bus becomes unreliable or a client temporarily loses connectivity (be it due to power loss or other circumstances).

It is generally assumed that the CAN Master is ready and listening before devices on the network begin communication (under normal circumstances this should be the case), but this is not a requirement.

When the client (bus slave) device finishes booting, it starts in the AwaitingDccpAssignment state. In this state the slave will send out S2MDccpAnnouncement frames no faster than every 250 milliseconds with device ID 0 (device independent protocol) and a protocol message ID of 1. These frames contain the serial number of the slave device (which encodes the device type), and the device's protocol version. With this information the Workcell Controller is able to determine what CAN device ID should be assigned to the slave as well as what protocol and protocol version it should use in all further communication

Note

Since CAN dislikes multiple devices sending frames with the same message ID, clients are encouraged to add a random 10-50ms delay to each transmission interval to minimize interference.

After the Workcell Controller receives a valid S2MDccpAnnouncement frame it responds with a M2SDccpAssignment frame with a protocol message ID 1. This frame contains the serial number of the device which should listen to the assignment as well as a device ID to use on the bus. All future communication between the master and slave will happen with this ID and will uniquely identify that slave. No slave devices should respond to (or act on) any messages with a device ID that is different than the one assigned to them, and no slave devices should transmit any CAN frames with a message ID corresponding to any device ID that is not the one assigned to them. The only exception to this of course is the transmission and reception of device independent Broadcast Frames.

Note

Slave devices should ignore any M2SDccpAssignment frames with a serial number other than their own.

Once assigned, the slave should transition out of the AwaitingDccpAssignment and continue with its device specific behavior.

Communication Loss

If the Workcell Controller receives a S2MDccpAnnouncement frame with a serial number corresponding to a device that has already had an ID assigned, it can be assumed that the device rebooted and has forgotten any previous assignments. In this case it is possible to reuse the same previously assigned CAN device ID, but this is not required. The Workcell Controller may infer that any previously unacknowledged application level commands were not received and should handle this correctly as to not break anything.

CAN Frames

S2M DCCP Announcement

ByteSizeTypeFieldDescription
16 Bytes (48 bits)u48Slave Serial NumberUnique 48-bit serial number that identifies the slave. This value is hardcoded into the firmware on each device and contains information about what kind of device it is.
2
3
4
5
6
72 Bytes (16 bits)u16Slave Protocol VersionThe version of the application level protocol that the slave device will continue communication with. The specific protocol can be inferred from the device's serial number, but the version is required for handling breaking changes within a device protocol over time.
8

M2S DCCP Assignment

ByteSizeTypeFieldDescription
16 Bytes (48 bits)u48Slave Serial NumberUnique 48-bit serial number that identifies the slave. This value is hardcoded into the firmware on each device and contains information about what kind of device it is.
2
3
4
5
6
72 Bytes (16 bits)u10Device IDThe new CAN device ID the slave should transmit and receive on.
8