Menu

CANprotocol

Mike Johnson

MERGCBUS Communication Protocol

Opcodes

Opcode - the first data byte is the opcode which includes the length of the message in the upper 3 bits. This is followed by up to 7 more data bytes.

[NumericIndex]

[General]
Node Number Protocol
Accessory Protocol
Node Variable Protocol
Event Teaching Protocol
Loader Protocol
Track and Command Station Control
Train Control
Direct DCC

CAN Header

General CAN message format: 11 bit CAN header, up to 8 data bytes.

11 bit CAN header, 4 bits priority, 7 bits CANID.

bits 9 - 10 of the CAN header. Major or Dynamic Priority, elevated by the node to gain access based on a transmit fail count.
bits 7 - 8 of the CAN header. Minor or Static priority based on message and node type.
bits 0 - 6 of the CAN header, CANID is a CAN segment-unique ID, assigned via enumeration.

Priority values:
0000 0 - High access, Emergency priority
0001 1 - Above Normal access, Emergency priority
0010 2 - Normal access, Emergency priority
0011 3 - Low access, Emergency priority
0100 4 - High access, High priority
0101 5 - Above Normal access, High priority
0110 6 - Normal access, High priority
0111 7 - Low access, High priority
1000 8 - High access, Normal priority
1001 9 - Above Normal access, Normal priority
1010 A - Normal access, Normal priority
1011 B - Low access, Normal priority
1100 C - spare
1101 D - spare
1110 E - spare
1111 F - Can't be used (First 7 bits cannot be 1's)

FLiM

FLiM nodes have a "setup mode", which is entered by pressing the pushbutton on the node. This can't be done over the CAN link because two identical nodes would both go into setup mode, the only way it could be done would be to have a worldwide unique node serial number.

Serial Protocol

This is used by CANRS and CANUSB modules and is based on the Gridconnect scheme.

The ASCII string start with :S to indicate a standard frame. The next character is the priority. The next 2 characters are the CANID. The next character is zero. The next character is N or R for Normal or RTR frame. This is followed by the data bytes in hex and a ;

Example.

:SB200N9000200007; This is a normal priority control packet from CANID 32(20 hex). The opc is ACON=90, the next 4 characters give the node number NN and the last 4 the event number.


Related

Wiki: Home

MongoDB Logo MongoDB