|
CanCommunicationProtocol
CAN Communication Protocol
1. IntroductionThe cable based communication is using CAN with following configuration:
To make the communication easy and efficient a CAN Communication Protocol is defined. The 29 bit identifier contains some communication data, like MessageType, SenderNodeId or ReceiverNodeId. The following chapters describe the protocol parts. 2. Protocol content of 29 bit CAN IDThe following table shows the structure of 29 bit CAN ID.
3. Protocol content of 8 CAN data bytesThe following table shows the structure of CAN data bytes.
4. Parts of CAN Communication Protocol4.1. MessageType
4.1.1. MessageType: EventThis MessageType is used to send an Event. Events are the most used messages. For each event like an PushButton or an update of an temperature value an Event is sent. Normaly the BroadcastMessage (ReceiverNodeID = 0) is used for Events. The ID of the Event is defined by the !EventID in the first two CAN data bytes. This MessageType has the highest priority. 4.1.2. MessageType: StartRoutineThis MessageType is used to start a routine. If the request is send with a PeerToPeerMessage only the ReceiverNode start the routine and send a response by using the MessageType RoutineResult to the SenderNode. If sending with a BroadcastMessage all nodes start the routine an send the response. 4.1.3. MessageType: WriteDataThis MessageType is used to write data into nodes. If the request is send with a PeerToPeerMessage the data will be written only into the ReceiverNode. If sending with a BroadcastMessage the data can be written to all nodes at one time. After written the data the ReceiverNodes send a response. 4.1.4. MessageType: ReadDataThis MessageType is used to read data from nodes. If the request is send with a PeerToPeerMessage only the ReceiverNode send a response to the SenderNode. If sending with a BroadcastMessage all nodes send a response. 4.1.5. MessageType: RoutineResultThis MessageType is used as the answer of a StartRoutine request. It is only used with PeerToPeerMessages back to the node which starts the routine. 4.1.6. MessageType: DataResponseThis MessageType is used as the answer of WriteData or ReadData request. It is only used with PeerToPeerMessages back to the node which start the writing or reading data. 4.1.7. MessageType: LogThis MessageType is used to send a Log information. This can be a Error Message or some other stuff for logging, it can be also a alive message or the temperature of the Node. The receiver is normaly a central node which trace all the log messages to a mass storage like an SD card. 4.1.8. MessageType: TransferDataThis MessageType is used to transfer huge amount of payload. This is needed by example for reprogramming. To initiate the transfer data it is needed to send a StartRoutine message befor sending the TransferData message. For more information look the TransferData Wiki page. For this MessageType all the CAN data bytes can be used for the application, no ContentID is needed. This MessageType has the lowest priority. 4.2. SenderNodeID
4.3. ReceiverNodeID
If the ReceiverNodeID is 0 then message is marked as an BroadcastMessage. BroadcastMessages are used for the normal communication like PressButtonEvents. Furthermore the BroadcastMessages are used to reprogramming more than one nodes at the same time by using the TransferData MessageType. 4.4. ContentIDRegarding the MessageType the first two bytes of CAN data are used to describe the content of the message. Following the different !ContentIDs will be describe: 4.4.1 EventID
4.4.2 !DataID
4.4.3 !RoutineID
4.4.4 !LogID
4.6. Payload4.5.1. Payload for TransferDataContent:
Description:
4.5.3. Payload for MessageType Event / LogContent:
Description:
Hier gehts weiter... 4.5.2. Payload for Request of WriteData / ReadDataContent:
Description:
4.5.4. Payload for Response of ReadData / WriteData / StartRoutineContent for positive response:
Description:
Content for negative response:
Description:
| |||||||||||||||||||||||