cbus:protocol
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cbus:protocol [2019/06/24 08:14] – [E0 - FF - 7 Data bytes packets] rjversluis | cbus:protocol [2020/06/30 21:21] (current) – removed rjversluis | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== MERG CBUS 4.0 Specification ====== | ||
- | [[: | ||
- | [[: | ||
- | * [[: | ||
- | * [[: | ||
- | * [[: | ||
- | |||
- | \\ | ||
- | [[http:// | ||
- | |||
- | |||
- | \\ | ||
- | ^ © Mike Bolton & Gil Fuchs ^ | ||
- | * {{: | ||
- | \\ | ||
- | |||
- | =====General CAN message format===== | ||
- | < | ||
- | | ||
- | </ | ||
- | |||
- | |||
- | ===< | ||
- | bits 9 - 10 of the CAN header. Dynamic Priority, elevated by the node to gain access based on a transmit fail count. Values: | ||
- | | 0 | Emergency priority | | ||
- | | 1 | High priority | | ||
- | | 2 | Normal priority | | ||
- | | ||
- | |||
- | ===< | ||
- | bits 7 - 8 of the CAN header. Static priority based on message and node type. Values: | ||
- | | 0 | High access | | ||
- | | 1 | Above Normal access | | ||
- | | 2 | Normal access | | ||
- | | 3 | Low access | | ||
- | |||
- | ===< | ||
- | bits 0 – 6 of the CAN header, is a CAN segment-unique ID, assigned via enumeration. | ||
- | ===< | ||
- | the first data byte is the opcode which includes the length of the message in the upper 3 bits. | ||
- | \\ | ||
- | In some associated documents, the Opcode is also referred to as the ‘command’ byte. The abbreviation OPC may also be used. In this document the Opcodes are in hexadecimal. | ||
- | |||
- | |||
- | |||
- | \\ | ||
- | =====Sessions for Loco Control===== | ||
- | Messages for loco control include a session number (sometimes referred to a session, session handle or just handle). This is a unique identifier assigned by the command station when a cab (or throttle) first requests control of a loco. The session number is used in all further messages referring to that loco.\\ | ||
- | \\ | ||
- | Cabs that are capable of service mode programming must have a valid session, but this needn’t refer to the loco on the service mode programming track. The session is required for error handling, in case two or more cabs attempt overlapping service mode operations.\\ | ||
- | |||
- | \\ | ||
- | ===DCC Addresses=== | ||
- | When CBUS is used for DCC loco control, the DCC address is always sent as two bytes. For short addresses, the MSB will be zero. For long addresses the MSB will have bit 7 and 6 set.\\ | ||
- | |||
- | \\ | ||
- | ===DCC Programming=== | ||
- | DCC programming modes are selected by unique op-codes or mode bytes, depending upon the operation. For those operations that use a mode byte, the modes are defined as follows: | ||
- | | 0 | Direct Byte | | ||
- | | 1 | Direct Bit | | ||
- | | 2 | Page Mode# | | ||
- | | 3 | Register Mode | | ||
- | | 4 | Address Only Mode | | ||
- | |||
- | |||
- | Not all CBUS DCC command stations will support all modes.\\ | ||
- | |||
- | Programming operations, other than a successful service mode read, will return SSTAT when complete. The associated status byte is defined as follows: | ||
- | | 0 | Reserved | | ||
- | | 1 | No Acknowledge | | ||
- | | 2 | Overload on service mode programming track | | ||
- | | 3 | Write Acknowledge | | ||
- | | 4 | Busy | | ||
- | | 5 | CV out of range | | ||
- | |||
- | |||
- | Successful service mode read operations return the data with PCVS, rather than SSTAT.\\ | ||
- | |||
- | ===DCC Error Codes=== | ||
- | Error codes for OPC ERR are defined as follows: | ||
- | | 0 | Reserved | | ||
- | | 1 | Loco stack full | | ||
- | | 2 | Loco address taken by another cab | | ||
- | | 3 | Session not present | | ||
- | | 4 | No more engines | | ||
- | | 5 | Engine not found | | ||
- | \\ | ||
- | |||
- | \\ | ||
- | |||
- | =====00 - 1F - 0 Data bytes packets===== | ||
- | |||
- | ===00 General Ack (ACK)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Positive response to query/ request performed or report of availability on-line. | ||
- | |||
- | ===01 General No Ack (NAK)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Negative response to query/ request denied. | ||
- | |||
- | |||
- | ===02 Bus Halt (HLT)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Commonly broadcasted to all devices to indicate CBUS is not available and no further packets should be sent until a BON or ARST is received. | ||
- | Currently only sent by the command station when its input queue is full. Can be ignored by all modules other than those that need to send to the command station (e.g. cabs) | ||
- | |||
- | ===03 Bus ON (BON)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Commonly broadcasted to all devices to indicate CBUS is available. | ||
- | Currently only sent by the command station when it has space in its input queue again. | ||
- | |||
- | |||
- | ===04 Track OFF (TOF)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Commonly broadcasted to all devices by a command station to indicate track power is off and no further command packets should be sent, except inquiries. | ||
- | |||
- | ===05 Track ON (TON)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Commonly broadcasted to all devices by a command station to indicate track power is on. | ||
- | |||
- | |||
- | ===06 Track Stopped | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Commonly broadcasted to all devices by a command station to indicate all engines have been emergency stopped. | ||
- | |||
- | ===07 System Reset (ARST)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Commonly broadcasted to all devices to indicate a full system reset. | ||
- | |||
- | |||
- | ===08 Request Track OFF (RTOF)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by a device to request change of track power state to “off”. | ||
- | |||
- | ===09 Request Track ON (RTON)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by a device to request change of track power state to “on”. | ||
- | |||
- | ===0A Request Emergency Stop ALL (RESTP)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by a device to request an emergency stop of the entire layout. | ||
- | |||
- | ===0C Request node Status (RSTAT)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by a node to query the status of the command station or another device. See description of (STAT) for the response from the command station/ | ||
- | |||
- | |||
- | ===0D Query node number (QNN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by a node to elicit a NNACK reply from each node on the bus that has a node number. | ||
- | |||
- | |||
- | ===10 Request node parameters(RQNP)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by device to a node while in ‘setup’mode to read its parameter set. Used when initially configuring a node. | ||
- | |||
- | |||
- | ===11 Request module name (RQMN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by a node to request the name of the type of module that is in setup mode. The module in setup mode will reply with opcode NAME. | ||
- | |||
- | |||
- | |||
- | |||
- | \\ | ||
- | =====20 - 3F - 1 Data bytes packets===== | ||
- | |||
- | ===20 Command Station status report (STAT)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | < | ||
- | ^ bit ^ Description ^ | ||
- | | 0 | Hardware Error (self test) | | ||
- | | 1 | Track Error | | ||
- | | 2 | Track On/ Off | | ||
- | | 3 | Bus On/ Halted | | ||
- | | 4 | EM. Stop all performed | | ||
- | | 5 | Reset done | | ||
- | | 6 | Service mode (programming) On/ Off | | ||
- | | 7 | reserved | | ||
- | Sent by the command station in response to RSTAT. | ||
- | |||
- | ===21 Release Engine (KLOC)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | < | ||
- | Sent by a CAB to the Command Station. The engine with that Session number is removed from the active engine list. | ||
- | | ||
- | |||
- | ===22 Query engine (QLOC)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | < | ||
- | The command station responds with PLOC if the session is assigned. Otherwise responds with ERR: engine not found. | ||
- | |||
- | ===23 Session keep alive (DKEEP)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | < | ||
- | The cab sends a keep alive at regular intervals for the active session. The interval between keep alive messages must be less than the session timeout | ||
- | |||
- | |||
- | ===30 Debug with one data byte (DBG1)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | < | ||
- | |||
- | ===3F Extended op-code with no additional bytes (EXTC)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Used if the basic set of 32 OPCs is not enough. Allows an additional 256 OPCs | ||
- | |||
- | \\ | ||
- | =====40 - 5F - 2 Data bytes packets===== | ||
- | |||
- | ===40 Request engine session (RLOC)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | < | ||
- | * 7 bit addresses have (AddrH=0). | ||
- | * 14 bit addresses have bits 6,7 of AddrH set to 1. | ||
- | The command station responds with (PLOC) if engine is free and is being assigned. Otherwise responds with (ERR): engine in use or (ERR:) stack full.\\ | ||
- | This command is typically sent by a cab to the command station following a change of the controlled decoder address. | ||
- | |||
- | |||
- | ===41 Query Consist (QCON)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | Allows enumeration of a consist. Command station responds with PLOC if an engine exists at the specified index, otherwise responds with ERR: no more engines. | ||
- | |||
- | ===42 Set Node Number (SNN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | Sent by a device to assign a node number to a requesting node in response to a RQNN message. The target node must be in ‘setup’ mode. | ||
- | |||
- | ===44 Set CAB session mode (STMOD)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * 0 – 1: speed mode | ||
- | * 00 – 128 speed steps | ||
- | * 01 – 14 speed steps | ||
- | * 10 – 28 speed steps with interleave steps | ||
- | * 11 – 28 speed steps | ||
- | * 2: service mode | ||
- | * 3: sound control mode | ||
- | |||
- | ===45 Consist Engine (PCON)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | Adds a decoder to a consist.\\ | ||
- | Dat2 has bit 7 set if consist direction is reversed. If engine is consisted already, an error is reported: engine in use.??? | ||
- | |||
- | ===46 Remove Engine from consist (KCON)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | Removes a decoder from a consist.\\ | ||
- | If engine is not consisted, an error is reported: Engine not found. | ||
- | |||
- | ===47 Set Engine Speed/Dir (DSPD)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | |||
- | ===48 Set Engine Flags (DFLG)=== | ||
- | //Not supported by the CANCMD/ | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * Bits 0-1: Speed Mode | ||
- | * 00 – 128 speed steps | ||
- | * 01 – 14 speed steps | ||
- | * 10 – 28 speed steps with interleave steps | ||
- | * 11 – 28 speed steps | ||
- | * Bit 2: Lights On/OFF | ||
- | * Bit 3: Engine relative direction | ||
- | * Bits 4-5: Engine state (active =0 , consisted =1, consist master=2, inactive=3) | ||
- | * Bits 6-7: Reserved. | ||
- | Sent by a cab to notify the command station of a change in engine flags. | ||
- | |||
- | ===49 Set Engine function on (DFNON)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | Sent by a cab to turn on a specific loco function. This provides an alternative method to DFUN for controlling loco functions. A command station must implement both methods. | ||
- | |||
- | |||
- | |||
- | ===4A Set Engine function off (DFNOF)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | Sent by a cab to turn off a specific loco function. This provides an alternative method to DFUN for controlling loco functions. A command station must implement both methods. | ||
- | |||
- | |||
- | ===4C Service mode status. (SSTAT)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Status returned by command station/ | ||
- | |||
- | ===50 Request node number (RQNN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by a node that is in setup/ | ||
- | |||
- | ===51 Node number release (NNREL)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by node when taken out of service. e.g. when reverting to SLiM mode. | ||
- | |||
- | ===52 Node number acknowledge. (NNACK)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by a node to verify its presence and confirm its node id. This message is sent to acknowledge SNN and also in response to QNN. | ||
- | |||
- | ===53 Set node into learn mode (NNLRN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by device to put a specific node into learn mode. | ||
- | |||
- | ===54 Release node from learn mode (NNULN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by device to take node out of learn mode and revert to normal operation. | ||
- | |||
- | ===55 Clear all events from a node (NNCLR)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by device to clear all events from a specific node. Must be in learn mode first to safeguard against accidental erasure of all events. | ||
- | |||
- | ===56 Read number of events available in a node (NNEVN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by device to read the number of available event slots in a node. | ||
- | |||
- | ===57 Read back all stored events in a node (NERD)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by device to read all the stored events in a node. Response is 0xF2. | ||
- | |||
- | |||
- | ===58 Request to read number of stored events (RQEVN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by device to read the number of stored events in a node. Response is 0x74 (NNEVN). | ||
- | |||
- | ===59 Write acknowledge (WRACK)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by device to indicate the completion of a write to memory operation. Used when teaching nodes where the processing time may be slow. | ||
- | |||
- | ===5A Request node data event (RQDAT)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by device to read the node data event (eg: RFID data). Response is 0xE4 (ARDAT). | ||
- | |||
- | ===5B Request device data – short mode (RQDDS)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | To request a ‘data set’ from a device using the short event method. Where DN is the device number. Response is 0xE6 (DDSR) | ||
- | |||
- | ===5C Put node into bootload mode (BOOTM)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | For SliM nodes with no NN then the NN of the command is must be zero. For SliM nodes with an NN, and all FliM nodes the command must contain the NN of the target node. Sent by a device to prepare for loading a new program. | ||
- | |||
- | |||
- | ===5F Extended op-code with 1 additional byte (EXTC1)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Used if the basic set of 32 OPCs is not enough. Allows an additional 256 OPCs | ||
- | |||
- | |||
- | \\ | ||
- | |||
- | =====60 - 7F - 3 Data bytes packets===== | ||
- | |||
- | ===60 Set Engine functions (DFUN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * 1 is F0(FL) to F4 | ||
- | * 2 is F5 to F8 | ||
- | * 3 is F9 to F12 | ||
- | * 4 is F13 to F19 | ||
- | * 5 is F20 to F28 | ||
- | * < | ||
- | |||
- | ===63 Command Station Error report (ERR)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * Error 1. Loco stack full | ||
- | * Error 2. Loco address taken | ||
- | * Error 3. Session number not present. | ||
- | Sent in response to an error situation. | ||
- | |||
- | |||
- | |||
- | ===6F Error messages from nodes during configuration (CMDERR)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by node if there is an error when a configuration command is sent. Error numbers to be defined. | ||
- | |||
- | ===70 Event space left reply from node (EVNLF)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | EVSPC is a one byte value giving the number of available | ||
- | |||
- | ===71 Request read of a node variable (NVRD)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | NV# is the index for the node variable value requested. Response is NVANS. | ||
- | |||
- | ===72 Request read of stored events by event index (NENRD)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | EN# is the index for the stored event requested.\\ | ||
- | Response is 0xF2 (ENRSP) | ||
- | |||
- | ===73 Request read of a node parameter by index (RQNPN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Para# is the index for the parameter requested.\\ | ||
- | Response is 0x9B (PARAN) | ||
- | |||
- | ===74 Number of events stored in node (NUMEV)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Response to request 0x58 (RQEVN) | ||
- | |||
- | ===7F Extended op-code with 2 additional bytes (EXTC2)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Used if the basic set of 32 OPCs is not enough. Allows an additional 256 OPCs | ||
- | |||
- | |||
- | \\ | ||
- | =====80 - 9F - 4 Data bytes packets===== | ||
- | |||
- | ===80 Request 3-byte DCC Packet (RDCC3)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | Allows a device to request a 3 byte DCC packet to be sent to the track. The packet is sent <REP> times and is not refreshed on a regular basis.\\ | ||
- | Note: a 3 byte DCC packet is the minimum allowed. | ||
- | |||
- | ===82 Write CV (byte) in OPS mode (WCVO)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Sent to the command station to write a DCC CV byte in OPS mode to specific | ||
- | |||
- | ===83 Write CV (bit) in OPS mode (WCVB)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | The format for Dat4 is that specified in RP 9.2.1 for OTM bit manipulation in a DCC packet.\\ | ||
- | This is ‘111CDBBB’ where C is here is always 1 as only ‘writes’ are possible | ||
- | Sent to the command station to write a DCC CV in OPS mode to specific loco.(on | ||
- | |||
- | ===84 Read CV (QCVS)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | This command is used exclusively with service mode.\\ | ||
- | Sent by the cab to the command station in order to read a CV value. The command station shall respond with a PCVS message containing the value read, or SSTAT if the CV cannot be read. | ||
- | |||
- | ===85 Report CV (PCVS)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | This command is used exclusively with service mode.\\ | ||
- | Sent by the command station to report a read CV. | ||
- | |||
- | |||
- | ===90 Accessory ON (ACON)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ event using the full event number of 4 bytes. (long event) | ||
- | |||
- | ===91 Accessory OFF (ACOF)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ event using the full event number of 4 bytes. (long event) | ||
- | |||
- | |||
- | ===92 Accessory Request Event (AREQ)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates a ‘request’ event using the full event number of 4 bytes. (long event)\\ | ||
- | A request event is used to elicit a status response from a producer when it is required to know the ‘state’ of the producer without producing an ON or OFF event and to trigger an event from a ‘combi’ node. | ||
- | |||
- | |||
- | ===93 Accessory Response Event (ARSPO)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ | ||
- | |||
- | ===94 Accessory Response Event (ARSPN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ | ||
- | |||
- | |||
- | ===95 Unlearn an event in learn mode (EVULN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by device to remove an event from a node. | ||
- | |||
- | ===96 Set a node variable (NVSET)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by device to set a node variable. NV# is the NV index number. | ||
- | |||
- | ===97 Response to a request for a node variable value (NVANS)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by node in response to request. (NVRD) | ||
- | |||
- | |||
- | ====Short events.==== | ||
- | //Device addressing.// | ||
- | Although the producer will send the complete 4 byte event number, the consumer will ignore the producer’s node number bytes. This allows a “many to many” situation where producers like DCC handsets can activate the same accessories even though they will have unique node numbers. Clearly this limits the number of ‘short’ events to 64K-1. For short events, the lower two bytes define the ‘Device Number’ or DN. The DN can also be considered as a ‘device address’.\\ | ||
- | \\ | ||
- | For these short events, the full 4 byte event is still sent, both to keep the format the same and to allow identification of the producer when required. | ||
- | \\ | ||
- | |||
- | ===98 Accessory Short ON (ASON)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ event using the short event number of 2 LS bytes. | ||
- | |||
- | ===99 Accessory Short OFF (ASOF)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ event using the short event number of 2 LS bytes. | ||
- | |||
- | |||
- | ===9A Accessory Short Request Event (ASRQ)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates a ‘request’ event using the short event number of 2 LS bytes. A request event is used to elicit a response from a producer ‘device’ when it is required to know the ‘state’ of the device without producing an ON or OFF event and to trigger an event from a “combi” node. | ||
- | |||
- | ===9B Response to request for individual node parameter (PARAN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | NN is the node number of the sending node. Para# is the index of the parameter and Para val is the parameter value | ||
- | |||
- | ===9C Request for read of an event variable (REVAL)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | This request differs from B2 (REQEV) as it doesn’t need to be in learn mode but does require the knowledge of the event index to which the EV request is directed.\\ | ||
- | EN# is the event index. EV# is the event variable index. Response is B5 (NEVAL) | ||
- | |||
- | ===9D Accessory Short Response Event (ARSSO)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ | ||
- | |||
- | |||
- | ===9E Accessory Short Response Event (ARSSN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ | ||
- | |||
- | |||
- | ===9F Extended op-code with 3 additional bytes (EXTC3)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Used if the basic set of 32 OPCs is not enough. Allows an additional 256 OPCs | ||
- | |||
- | |||
- | \\ | ||
- | |||
- | =====A0 - BF - 5 Data bytes packets===== | ||
- | |||
- | ===A0 Request 4-byte DCC Packet (RDCC4)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | Allows a device to request a 4 byte DCC packet to be sent to the track. The packet is sent <REP> times and is not refreshed on a regular basis. | ||
- | |||
- | ===A2 Write CV in Service mode (WCVS)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Sent to the command station to write a DCC CV in service mode. | ||
- | |||
- | |||
- | ===B0 Accessory ON (ACON1)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ event using the full event number of 4 bytes with one additional data byte. | ||
- | |||
- | |||
- | ===B1 Accessory OFF (ACOF1)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ event using the full event number of 4 bytes with one additional data byte. | ||
- | |||
- | |||
- | ===B2 Read event variable in learn mode (REQEV)=== | ||
- | < | ||
- | [< | ||
- | < | ||
- | Allows a device to read stored event variables from a node. EV# is the EV index. Reply is (EVANS) | ||
- | |||
- | |||
- | ===B3 Accessory Response Event (ARSP1O)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ response event with one additional data byte. A response event is a reply to a status request (AREQ) without producing an ON or OFF event. | ||
- | |||
- | ===B4 Accessory Response Event (ARSP1N)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ | ||
- | |||
- | |||
- | ===B5 Response to request for read of EV value (NEVAL)=== | ||
- | < | ||
- | | ||
- | </ | ||
- | NN is the node replying. EN# is the index of the event in that node. EV# is the index of the event variable. EVval is the value of that EV. This is response to 9C (REVAL) | ||
- | |||
- | ===BD Accessory Short Response Event (ARSS1O) with one data byte=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ | ||
- | |||
- | |||
- | ===BE Accessory Short Response Event (ARSS1N) with one data byte=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ | ||
- | |||
- | |||
- | ===BF Extended op-code with 4 data bytes (EXTC4)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Used if the basic set of 32 OPCs is not enough. Allows an additional 256 OPCs | ||
- | |||
- | |||
- | \\ | ||
- | =====C0 - DF - 6 Data bytes packets===== | ||
- | |||
- | ===C0 Request 5-byte DCC Packet (RDCC5)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | Allows a device to request a 5 byte DCC packet to be sent to the track. The packet is sent <REP> times and is not refreshed on a regular basis. | ||
- | |||
- | ===C1 Write CV (byte) in OPS mode by address (WCVOA)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * 7 bit addresses have (AddrH=0). | ||
- | * 14 bit addresses have bits 7,8 of AddrH set to 1. | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Sent to the command station to write a DCC CV byte in OPS mode to specific loco (on the main). Used by computer based ops mode programmer that does not have a valid throttle handle. | ||
- | |||
- | ===D0 Accessory ON (ACON2)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ event using the full event number of 4 bytes with two additional | ||
- | |||
- | |||
- | ===D1 Accessory OFF (ACOF2)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ event using the full event number of 4 bytes with two additional data bytes. | ||
- | |||
- | |||
- | ===D2 Teach an event in learn mode (EVLRN)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by a device to a node in learn mode to teach it an event. Also teaches it the associated event variables (EVs) by the EV index (EV#). This command is repeated for each EV required. | ||
- | |||
- | ===D3 Response to a request for an EV value in a node in learn mode (EVANS)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | A node response to a request from a device for the EVs associated with an event (REQEV). For multiple EVs, there will be one response per request. | ||
- | |||
- | |||
- | ===D4 Accessory Response Event (ARSP2O)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ | ||
- | |||
- | |||
- | ===D5 Accessory Response Event (ARSP2N)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ | ||
- | |||
- | |||
- | ===DD Accessory Short Response Event (ARSS2O) with two data bytes=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ | ||
- | |||
- | |||
- | ===DE Accessory Short Response Event (ARSS2N) with two data bytes=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ | ||
- | |||
- | ===DF Extended op-code with 5 data bytes (EXTC5)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Used if the basic set of 32 OPCs is not enough. Allows an additional 256 OPCs | ||
- | |||
- | |||
- | |||
- | \\ | ||
- | =====E0 - FF - 7 Data bytes packets===== | ||
- | |||
- | ===E0 Request 6-byte DCC Packet (RDCC6)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | Allows a device to request a 6 byte DCC packet to be sent to the track. The packet is sent <REP> times and is not refreshed on a regular basis. | ||
- | |||
- | ===E1 Engine report (PLOC)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | A report of an engine entry sent by the command station. Sent in response to QLOC or as an acknowledgement of acquiring an engine requested by a cab (RLOC). | ||
- | |||
- | ===E3 Accessory node data event (ACDAT)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an event from this node with 5 bytes of data.\\ | ||
- | For example, this can be used to send the 40 bits of an RFID tag. There is no event number in order to allow space for 5 bytes of data in the packet, so there can only be one data event per node. | ||
- | |||
- | |||
- | ===E4 Accessory node data Response (ARDAT)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates a node data response. A response event is a reply to a status request (RQDAT) without producing a new data event. | ||
- | |||
- | ===E5 Device data event (short mode) (DDES)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Function is the same as E3 but uses device addressing so can relate data to a device attached to a node. e.g. one of several RFID readers attached to a single node. | ||
- | |||
- | ===E6 Device data response (short mode) (DDRS)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | The response to a request for data from a device. | ||
- | |||
- | ===E8 Accessory Short Response Event (ARSS3O) with three data bytes=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ | ||
- | |||
- | |||
- | ===E9 Accessory Short Response Event (ARSS3N) with three data bytes=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ | ||
- | |||
- | ===EE Response to request for node name string (NAME)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | A node response while in ‘setup’ mode for its name string. Reply to (RQMN). The string for the module type is returned in char1 to char7. All module types begin with “CAN”. | ||
- | |||
- | ===EF Response to request for node parameters (PARAMS)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | A node response while in ‘setup’ mode for its parameter string. Reply to (RQNP) | ||
- | |||
- | |||
- | ===F0 Accessory ON (ACON3)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ event using the full event number of 4 bytes with three additional data bytes. | ||
- | |||
- | |||
- | ===F1 Accessory OFF (ACOF3)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ event using the full event number of 4 bytes with three additional data bytes. | ||
- | |||
- | |||
- | ===F2 Response to request to read node events (ENRSP)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Where the NN is that of the sending node. EN3 to EN0 are the four bytes of the stored event. EN# is the index of the event within the sending node. This is a response to either 57 (NERD) or 72 (NENRD) | ||
- | |||
- | |||
- | |||
- | ===F3 Accessory Response Event (ARSP3O)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘ON’ | ||
- | |||
- | ===F4 Accessory Response Event (ARSP3N)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | * < | ||
- | Indicates an ‘OFF’ response event. A response event is a reply to a status | ||
- | |||
- | ===F5 Teach an event in learn mode using event indexing (EVLRNI)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Sent by a device to a node in learn mode to teach it an event. The event index must be known. Also teaches it the associated event variables (EVs). This command is repeated for each EV required. | ||
- | |||
- | ===FC Shutdown with password=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Password max. 7 bytes. Unused data bytes must be set to zero.\\ | ||
- | |||
- | |||
- | ===FF Extended op-code with 6 data bytes (EXTC6)=== | ||
- | < | ||
- | [< | ||
- | </ | ||
- | Used if the basic set of 32 OPCs is not enough. Allows an additional 256 OPCs | ||
- | |||
- | |||
- | |||
- | |||
- | \\ | ||
- | =====Node Parameter Defintions.===== | ||
- | There are eight Node Parameters defined, the first seven are returned by OPC RQNP during node setup. All parameters can be read by index using OPC RQNPN. All parameters are assumed to be numeric unless indicated otherwise. Node Parameters are read-only. | ||
- | ^ Param ^ Description ^ | ||
- | | 1 | Manufacturer Id | | ||
- | | 2 | Minor Version - char | | ||
- | | 3 | Module Id | | ||
- | | 4 | Number of Events supported by the module | | ||
- | | 5 | Number of Event Variables per Event | | ||
- | | 6 | Number of Node Variables supported by the module | | ||
- | | 7 | Major Version | | ||
- | | 8 | Flags | | ||
- | |||
- | Flags are defined as follows: | ||
- | ^ Bit ^ Description ^ | ||
- | | 0 | Consumer node | | ||
- | | 1 | Producer node | | ||
- | | 2 | FliM mode | | ||
- | | 3-7 | Reserved, set to zero. | | ||
- | |||
- | Note: both bits 0 & 1 set indicate a Combi node. | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | \\ | ||
- | |||
- | =====Error codes===== | ||
- | Error codes for CBUS accessory modules, these error codes are returned by OPC CMDERR 0x6F | ||
- | |||
- | ^ Code ^ Description ^ | ||
- | | 1 | Command Not Supported - see note 1. | | ||
- | | 2 | Not In Learn Mode | | ||
- | | 3 | Not in Setup Mode - see note 1 | | ||
- | | 4 | Too Many Events | | ||
- | | 5 | Reserved - see note 2 | | ||
- | | 6 | Invalid Event variable index | | ||
- | | 7 | Invalid Event | | ||
- | | 8 | Reserved - see note 3 | | ||
- | | 9 | Invalid Parameter Index | | ||
- | | 10 | Invalid Node Variable Index | | ||
- | | 11 | Invalid Event Variable Value | | ||
- | | 12 | Invalid Node Variable Value |0 | ||
- | \\ | ||
- | DCC Error codes, these code are returned by OPC ERR 0x63\ | ||
- | ^ Code ^ Description ^ | ||
- | | 1 | ERR_LOCO_STACK_FULL | ||
- | | 2 | ERR_LOCO_ADDR_TAKEN | ||
- | | 3 | ERR_SESSION_NOT_PRESENT - first byte session id, second byte not used | | ||
- | | 4 | ERR_NO_MORE_ENGINES | ||
- | | 5 | ERR_ENGINE_NOT_FOUND | ||
- | | 6 | ERR_CMD_RX_BUF_OFLOW | ||
- | |||
- | \\ | ||
- | Note 1: Accessory modules do not return this error.\\ | ||
- | Note 2: This value is defined as Invalid Event Value Index in the FCU but I cannot find any current use for it.\\ | ||
- | Note 3: Currently used by code that processes OPC REVAL 0x9C but this code should be updated to use codes 6 & 7.\\ | ||
- | |||
- | |||
- | |||
- | =====History===== | ||
- | * Draft 7c by Andrew Crosland, Mike Bolton and Roger Healey | ||
- | * Draft 7d | ||
- | * Draft 7e | ||
- | * Draft 7f | ||
- | * Draft 7g Added OPCs for short data events and requests. | ||
- | * MB. 02/07/11 Added OPCs for RQMN, | ||
- | * PNB 04/07/11 Updated definition of BOOTM (0x5C) | ||
- | * Added Appendix 1, Node Parameter Definitions RKH 04/07/11 | ||
- | |||