Home

Z21 LAN Protocol Specification

Z21 LAN Protocol Specification

Markdown transcription of the Z21 LAN protocol specification. Source: Z21 LAN Protocol Specification, Modelleisenbahn GmbH (Roco/Fleischmann), Document Version 1.13 en, 06.11.2023 (original: docs/z21.html).

Conventions: - All multi-byte values are little-endian unless stated otherwise. - Bytes are written in hexadecimal notation (0x..). - In bit field tables, letters denote individual bits (e.g. RVVVVVVV).

Basics

System, Status, Versions

Settings

Driving

Switching

Reading and writing Decoder CVs

Feedback – R-BUS

RailCom

LocoNet

CAN

Fast Clock

Appendix A – Command overview


1 Basics

1.1 Communication

Communication with the Z21 command station uses UDP on port 21105 or 21106. Client applications (PC, app, …) should primarily use port 21105.

Communication is always asynchronous, i.e. broadcast messages may appear between a request and the corresponding response.

Each client should communicate with the Z21 at least once per minute; otherwise it will be removed from the list of active participants. If possible, the client should log off using LAN_LOGOFF.

1.2 Z21 Dataset

1.2.1 Structure

A single Z21 data record (request or response) has the following structure:

DataLen (2 bytes) Header (2 bytes) Data (n bytes)

Unless stated otherwise, byte order is little-endian (low byte first, then high byte).

1.2.2 X-BUS Protocol tunneling

Requests and responses based on the X-BUS protocol are sent with the Z21-LAN header 0x40 (LAN_X_xxx). This applies only to the protocol — these commands have nothing in common with the physical X-BUS of the Z21; they are addressed exclusively to LAN clients or to the Z21.

The actual X-BUS command is in the Data field. The last byte is a checksum calculated as XOR over the entire X-BUS command. Example:

DataLen Header Data (X-BUS)
X-Header DB0 DB1 XOR-Byte
0x08 0x00 0x40 0x00 h x y h XOR x XOR y

1.2.3 LocoNet tunneling

From Z21 FW 1.20.

With Z21-LAN headers 0xA0 and 0xA1 (LAN_LOCONET_Z21_RX, LAN_LOCONET_Z21_TX), messages received or sent by the Z21 on the LocoNet bus are forwarded to the LAN client. The client subscribes via LAN_SET_BROADCASTFLAGS.

The LAN client can write messages to the LocoNet bus via header 0xA2 (LAN_LOCONET_FROM_LAN).

In this way the Z21 can act as an Ethernet/LocoNet gateway, while the Z21 is also the LocoNet master managing refresh slots and generating DCC packets.

Example — LocoNet message OPC_MOVE_SLOTS <0><0> (“DISPATCH_GET”) sent by the Z21:

DataLen Header OPC ARG1 ARG2 CKSUM
0x08 0x00 0xA0 0x00 0xBA 0x00 0x00 0x45

1.3 Combining datasets in one UDP packet

Several independent Z21 data records can be sent in one UDP packet to one recipient. Each recipient must be able to interpret these combined packets.

The UDP packet must fit within the Ethernet MTU; considering the IPv4 header and UDP header, at most 1500 - 20 - 8 = 1472 bytes of payload data are available.


2 System, Status, Versions

2.1 LAN_GET_SERIAL_NUMBER

Read the Z21 serial number.

Request to Z21:

DataLen Header Data
0x04 0x00 0x10 0x00

Reply from Z21:

DataLen Header Data
0x08 0x00 0x10 0x00 32-bit serial number (little-endian)

2.2 LAN_LOGOFF

Log off the client from the Z21.

Request to Z21:

DataLen Header Data
0x04 0x00 0x30 0x00

Reply from Z21: none.

Use the same port number when logging out as when logging in.

Note: login is implicit with the client’s first command (e.g. LAN_SYSTEMSTATE_GETDATA, …).

2.3 LAN_X_GET_VERSION

Read the Z21 X-Bus version.

Request to Z21:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x21 0x21 0x00

Reply from Z21:

DataLen Header X-Header DB0 DB1 DB2 XOR-Byte
0x09 0x00 0x40 0x00 0x63 0x21 XBUS_VER CMDST_ID 0x60

2.4 LAN_X_GET_STATUS

Request the Z21 status.

Request to Z21:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x21 0x24 0x05

Reply from Z21: see 2.12 LAN_X_STATUS_CHANGED.

The command station status is identical to CentralState in 2.18 LAN_SYSTEMSTATE_DATACHANGED.

2.5 LAN_X_SET_TRACK_POWER_OFF

Switch off track voltage.

Request to Z21:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x21 0x80 0xA1

Reply from Z21: see 2.7 LAN_X_BC_TRACK_POWER_OFF.

2.6 LAN_X_SET_TRACK_POWER_ON

Switch on track voltage, or end emergency stop / programming mode.

Request to Z21:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x21 0x81 0xA0

Reply from Z21: see 2.8 LAN_X_BC_TRACK_POWER_ON.

2.7 LAN_X_BC_TRACK_POWER_OFF

Packet sent by the Z21 to registered clients when: - a client sent 2.5 LAN_X_SET_TRACK_POWER_OFF, - or track voltage was switched off by an input device (multiMaus), - and the client has activated the corresponding broadcast (2.16, flag 0x00000001).

Z21 to Client:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x61 0x00 0x61

2.8 LAN_X_BC_TRACK_POWER_ON

Analogous to 2.7, when track voltage was switched on.

Z21 to Client:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x61 0x01 0x60

2.9 LAN_X_BC_PROGRAMMING_MODE

Packet sent when the Z21 enters CV programming mode via 6.1 LAN_X_CV_READ or 6.2 LAN_X_CV_WRITE (broadcast flag 0x00000001).

Z21 to Client:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x61 0x02 0x63

2.10 LAN_X_BC_TRACK_SHORT_CIRCUIT

Packet sent in case of a short circuit (broadcast flag 0x00000001).

Z21 to Client:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x61 0x08 0x69

2.11 LAN_X_UNKNOWN_COMMAND

Z21 response to an invalid request.

Z21 to Client:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x61 0x82 0xE3

2.12 LAN_X_STATUS_CHANGED

Sent when the client explicitly requests status via 2.4 LAN_X_GET_STATUS.

Z21 to Client:

DataLen Header X-Header DB0 DB1 XOR-Byte
0x08 0x00 0x40 0x00 0x62 0x22 Status XOR-Byte

DB1 = command station status. Bitmask:

#define csEmergencyStop          0x01  // The emergency stop is switched on
#define csTrackVoltageOff        0x02  // The track voltage is switched off
#define csShortCircuit           0x04  // Short-circuit
#define csProgrammingModeActive  0x20  // The programming mode is active

Status is identical to SystemState.CentralState (see 2.18).

2.13 LAN_X_SET_STOP

Activate emergency stop — locomotives are stopped, but track voltage remains on.

Request to Z21:

DataLen Header X-Header XOR-Byte
0x06 0x00 0x40 0x00 0x80 0x80

Reply from Z21: see 2.14 LAN_X_BC_STOPPED.

2.14 LAN_X_BC_STOPPED

Packet sent after 2.13 LAN_X_SET_STOP or after emergency stop triggered by an input device (broadcast flag 0x00000001).

Z21 to Client:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x81 0x00 0x81

2.15 LAN_X_GET_FIRMWARE_VERSION

Read the Z21 firmware version.

Request to Z21:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0xF1 0x0A 0xFB

Reply from Z21:

DataLen Header X-Header DB0 DB1 DB2 XOR-Byte
0x09 0x00 0x40 0x00 0xF3 0x0A V_MSB V_LSB XOR-Byte

2.16 LAN_SET_BROADCASTFLAGS

Set broadcast flags in the Z21. Flags are set per client (per IP + port) and must be set again on each subsequent login.

Request to Z21:

DataLen Header Data
0x08 0x00 0x50 0x00 32-bit Broadcast-Flags (little-endian)

Broadcast flags are an OR combination of the following values:

Flag Meaning
0x00000001 Driving and switching broadcasts and info: 2.7, 2.8, 2.9, 2.10, 2.14, 4.4 LAN_X_LOCO_INFO (loco address must also be subscribed), 5.3 LAN_X_TURNOUT_INFO
0x00000002 Feedback module changes on R-Bus (7.1 LAN_RMBUS_DATACHANGED)
0x00000004 RailCom data changes for subscribed locomotives (8.1 LAN_RAILCOM_DATACHANGED)
0x00000100 Z21 system status changes (2.18 LAN_SYSTEMSTATE_DATACHANGED)
0x00010000 (From FW 1.20) Extends 0x00000001: client receives LAN_X_LOCO_INFO for all controlled locomotives without subscription. PC software only, not for mobile controllers. From FW V1.24: only for all modified locomotives.
0x01000000 Forward LocoNet bus messages to LAN client (excluding locos and turnouts)
0x02000000 Forward LocoNet loco-specific messages: OPC_LOCO_SPD, OPC_LOCO_DIRF, OPC_LOCO_SND, OPC_LOCO_F912, OPC_EXP_CMD
0x04000000 Forward LocoNet turnout-specific messages: OPC_SW_REQ, OPC_SW_REP, OPC_SW_ACK, OPC_SW_STATE
0x08000000 (From FW 1.22) LocoNet occupancy detector status changes (9.5 LAN_LOCONET_DETECTOR)
0x00040000 (From FW 1.29) RailCom data changes for all locomotives without subscription. PC software only.
0x00080000 (From FW 1.30) CAN-Bus occupancy detector status changes (10.1 LAN_CAN_DETECTOR)
0x00020000 (From FW 1.41) CAN-Bus booster status forwarding (10.2.3 LAN_CAN_BOOSTER_SYSTEMSTATE_CHGD)
0x00000010 (From FW 1.43) Fast clock message transmission (12.2 LAN_FAST_CLOCK_DATA)

Reply from Z21: none.

Note: when configuring broadcast flags always consider the impact on network load. This applies especially to flags 0x00010000, 0x00040000, 0x02000000 and 0x04000000. IP packets may be dropped by the router under overload, and UDP offers no detection mechanisms.

2.17 LAN_GET_BROADCASTFLAGS

Read broadcast flags.

Request to Z21:

DataLen Header Data
0x04 0x00 0x51 0x00

Reply from Z21:

DataLen Header Data
0x08 0x00 0x51 0x00 Broadcast-Flags 32-bit (little-endian)

2.18 LAN_SYSTEMSTATE_DATACHANGED

System status change notification from Z21 to client. Sent asynchronously when the client has activated broadcast (flag 0x00000100) or explicitly requested status (2.19).

Z21 to Client:

DataLen Header Data
0x14 0x00 0x84 0x00 SystemState (16 bytes)

SystemState structure (16-bit values, little-endian):

Offset Typ Nazwa Jedn. Opis
0 INT16 MainCurrent mA main track current
2 INT16 ProgCurrent mA programming track current
4 INT16 FilteredMainCurrent mA filtered main track current
6 INT16 Temperature °C internal command station temperature
8 UINT16 SupplyVoltage mV supply voltage
10 UINT16 VCCVoltage mV internal voltage, identical to track voltage
12 UINT8 CentralState bitmask see below
13 UINT8 CentralStateEx bitmask see below
14 UINT8 reserved
15 UINT8 Capabilities bitmask see below, from FW 1.42

CentralState bitmask:

#define csEmergencyStop          0x01  // The emergency stop is switched on
#define csTrackVoltageOff        0x02  // The track voltage is switched off
#define csShortCircuit           0x04  // Short-circuit
#define csProgrammingModeActive  0x20  // The programming mode is active

CentralStateEx bitmask:

#define cseHighTemperature       0x01  // temperature too high
#define csePowerLost             0x02  // Input voltage too low
#define cseShortCircuitExternal  0x04  // S.C. at the external booster output
#define cseShortCircuitInternal  0x08  // S.C. at the main track or programming track
#define cseRCN213                0x20  // (from FW 1.42) turnout addresses according to RCN-213

Capabilities bitmask (from FW 1.42):

#define capDCC            0x01  // capable of DCC
#define capMM             0x02  // capable of MM
//#define capReserved     0x04  // reserved for future development
#define capRailCom        0x08  // RailCom is activated
#define capLocoCmds       0x10  // accepts LAN commands for locomotive decoders
#define capAccessoryCmds  0x20  // accepts LAN commands for accessory decoders
#define capDetectorCmds   0x40  // accepts LAN commands for detectors
#define capNeedsUnlockCode 0x80 // device needs activate code (z21start)

If Capabilities == 0, the device likely has an older firmware version — Capabilities should not be interpreted in that case.

2.19 LAN_SYSTEMSTATE_GETDATA

Request current system status.

Request to Z21:

DataLen Header Data
0x04 0x00 0x85 0x00

Reply from Z21: see 2.18 LAN_SYSTEMSTATE_DATACHANGED.

2.20 LAN_GET_HWINFO

From Z21 FW 1.20 and SmartRail FW V1.13.

Read hardware type and Z21 firmware version.

Request to Z21:

DataLen Header Data
0x04 0x00 0x1A 0x00

Reply from Z21:

DataLen Header Data
0x0C 0x00 0x1A 0x00 HwType 32-bit (LE), FW Version 32-bit (LE)

HwType:

#define D_HWT_Z21_OLD             0x00000200  // „black Z21” (variant from 2012)
#define D_HWT_Z21_NEW             0x00000201  // „black Z21” (variant from 2013)
#define D_HWT_SMARTRAIL           0x00000202  // SmartRail (from 2012)
#define D_HWT_z21_SMALL           0x00000203  // „white z21” starter set (from 2013)
#define D_HWT_z21_START           0x00000204  // „z21 start” starter set (from 2016)
#define D_HWT_SINGLE_BOOSTER      0x00000205  // 10806 „Z21 Single Booster” (zLink)
#define D_HWT_DUAL_BOOSTER        0x00000206  // 10807 „Z21 Dual Booster” (zLink)
#define D_HWT_Z21_XL              0x00000211  // 10870 „Z21 XL Series” (from 2020)
#define D_HWT_XL_BOOSTER          0x00000212  // 10869 „Z21 XL Booster” (from 2021, zLink)
#define D_HWT_Z21_SWITCH_DECODER  0x00000301  // 10836 „Z21 SwitchDecoder” (zLink)
#define D_HWT_Z21_SIGNAL_DECODER  0x00000302  // 10837 „Z21 SignalDecoder” (zLink)

FW version is in BCD format. Example: 0x0C 0x00 0x1A 0x00 0x00 0x02 0x00 0x00 0x20 0x01 0x00 0x00 → „Hardware Type 0x200, Firmware Version 1.20”.

For older firmware versions use 2.15 LAN_X_GET_FIRMWARE_VERSION: - V1.10 / V1.11 … Z21 (variant from 2012) - V1.12 … SmartRail (from 2012)

2.21 LAN_GET_CODE

Read Z21 software feature scope (especially relevant for the “z21 start” variant to check whether driving and switching over LAN are blocked or allowed).

Request to Z21:

DataLen Header Data
0x04 0x00 0x18 0x00

Reply from Z21:

DataLen Header Data
0x05 0x00 0x18 0x00 Code (8-bit)

Code:

#define Z21_NO_LOCK         0x00  // all features permitted
#define z21_START_LOCKED    0x01  // „z21 start”: driving and switching is blocked
#define z21_START_UNLOCKED  0x02  // „z21 start”: driving and switching is permitted

3 Settings

The following settings are stored permanently in the Z21. They can be reset to factory defaults by holding the STOP button on the Z21 until the LEDs start flashing purple.

3.1 LAN_GET_LOCOMODE

Read output format (DCC, MM) for a given locomotive address. In the Z21 the format is stored permanently for each loco address (max 256 addresses). Any address ≥ 256 is automatically DCC.

Request to Z21:

DataLen Header Data
0x06 0x00 0x60 0x00 16-bit loco address (big-endian)

Reply from Z21:

DataLen Header Data
0x07 0x00 0x60 0x00 16-bit loco address (big-endian), Mode 8-bit

3.2 LAN_SET_LOCOMODE

Set output format for a given locomotive address (persistent write).

Request to Z21:

DataLen Header Data
0x07 0x00 0x61 0x00 16-bit loco address (big-endian), Mode 8-bit

Reply from Z21: none.

Notes: any address ≥ 256 is and remains DCC format. The number of speed steps (14, 28, 128) is also stored permanently — this happens automatically with the drive command (4.2 LAN_X_SET_LOCO_DRIVE).

3.3 LAN_GET_TURNOUTMODE

Read settings (DCC, MM format) for a given accessory decoder address (“Accessory Decoder” RP-9.2.1). Max 256 addresses; any ≥ 256 is automatically DCC.

Request to Z21:

DataLen Header Data
0x06 0x00 0x70 0x00 16-bit accessory decoder address (big-endian)

Reply from Z21:

DataLen Header Data
0x07 0x00 0x70 0x00 16-bit accessory decoder address (big-endian), Mode 8-bit

On the LAN interface and in the Z21, accessory decoder addresses are numbered from 0, but in applications or on multiMaus visualization — from 1. Example: turnout #3 on multiMaus corresponds to address 2 on LAN and in the Z21.

3.4 LAN_SET_TURNOUTMODE

Set output format for a given accessory decoder address (persistent write).

Request to Z21:

DataLen Header Data
0x07 0x00 0x71 0x00 16-bit accessory decoder address (big-endian), Mode 8-bit

Reply from Z21: none.

MM accessory decoders are supported from Z21 FW 1.20. They are not supported by SmartRail. Any decoder ≥ 256 is and remains DCC.


4 Driving

The client can subscribe to locomotive information via 4.1 LAN_X_GET_LOCO_INFO to be automatically notified of changes to that locomotive address (including those triggered by other clients or controllers). Additionally the appropriate broadcast must be active (2.16, flag 0x00000001).

To keep network traffic within reasonable limits, a client can subscribe to at most 16 locomotive addresses (FIFO).

4.1 LAN_X_GET_LOCO_INFO

Query locomotive status. At the same time the client “subscribes” to information for this loco address (only in combination with broadcast flag 0x00000001).

Request to Z21:

DataLen Header X-Header DB0 DB1 DB2 XOR-Byte
0x09 0x00 0x40 0x00 0xE3 0xF0 Adr_MSB Adr_LSB XOR-Byte

Loco addressing: loco address = (Adr_MSB & 0x3F) << 8 + Adr_LSB. For addresses ≥ 128 the two highest bits in DB1 must be set to 1: DB1 = (0xC0 | Adr_MSB). For addresses < 128 these two bits are irrelevant.

Reply from Z21: see 4.4 LAN_X_LOCO_INFO.

4.2 LAN_X_SET_LOCO_DRIVE

Change locomotive speed and direction.

Request to Z21:

DataLen Header X-Header DB0 DB1 DB2 DB3 XOR-Byte
0x0A 0x00 0x40 0x00 0xE4 0x1S Adr_MSB Adr_LSB RVVVVVVV XOR-Byte

Loco addressing as in 4.1.

DB0 = 0x1S — number of speed steps depends on the configured format: - S=0: DCC 14 steps, or MMI with 14 steps and F0 - S=2: DCC 28 steps, or MMII with 14 actual steps and F0-F4 - S=3: DCC 128 steps (“126 steps” excluding stop steps), or MMII with 28 actual steps (light-trit) and F0-F4

DB3 = RVVVVVVV: - R — direction: 1 = forward - V — speed, encoding depends on speed steps S (see below)

If MM format is configured for the loco, conversion of the given DCC step to the actual MM step is performed automatically in the Z21.

Encoding per NMRA S 9.2 and S 9.2.1. “Stop” = “normal stop” / “step 0”. “E-Stop” = “immediate emergency stop”.

“DCC 14” speed encoding (R000 VVVV):

Code Speed Code Speed Code Speed Code Speed
R000 0000 Stop R000 0100 Step 3 R000 1000 Step 7 R000 1100 Step 11
R000 0001 E-Stop R000 0101 Step 4 R000 1001 Step 8 R000 1101 Step 12
R000 0010 Step 1 R000 0110 Step 5 R000 1010 Step 9 R000 1110 Step 13
R000 0011 Step 2 R000 0111 Step 6 R000 1011 Step 10 R000 1111 Step 14 max

“DCC 28” speed encoding (R00V5 VVVV — like DCC 14, but with an additional intermediate bit V5):

Code Speed Code Speed Code Speed Code Speed
R000 0000 Stop R000 0100 Step 5 R000 1000 Step 13 R000 1100 Step 21
R001 0000 Stop¹ R001 0100 Step 6 R001 1000 Step 14 R001 1100 Step 22
R000 0001 E-Stop R000 0101 Step 7 R000 1001 Step 15 R000 1101 Step 23
R001 0001 E-Stop¹ R001 0101 Step 8 R001 1001 Step 16 R001 1101 Step 24
R000 0010 Step 1 R000 0110 Step 9 R000 1010 Step 17 R000 1110 Step 25
R001 0010 Step 2 R001 0110 Step 10 R001 1010 Step 18 R001 1110 Step 26
R000 0011 Step 3 R000 0111 Step 11 R000 1011 Step 19 R000 1111 Step 27
R001 0011 Step 4 R001 0111 Step 12 R001 1011 Step 20 R001 1111 Step 28 max

¹ Use not recommended.

“DCC 128” speed encoding (RVVV VVVV):

Code Speed
R000 0000 Stop
R000 0001 E-Stop
R000 0010 Step 1
R000 0011 Step 2
R000 0100 Step 3
R000 0101 Step 4
R111 1110 Step 125
R111 1111 Step 126 max

Reply from Z21: no standard reply; 4.4 LAN_X_LOCO_INFO to subscribed clients.

Note: the number of speed steps (14/28/128) is automatically stored permanently for that loco address in the command station.

4.3 Functions for locomotive decoder

Function commands from F0 through F12 are sent periodically to the main track (depending on priority), similar to speed and direction.

Function commands F13 and above are sent three times after a change, then — per RCN-212 and available bandwidth — are no longer sent until the next function state change.

4.3.1 LAN_X_SET_LOCO_FUNCTION

Change a single locomotive function.

Request to Z21:

DataLen Header X-Header DB0 DB1 DB2 DB3 XOR-Byte
0x0A 0x00 0x40 0x00 0xE4 0xF8 Adr_MSB Adr_LSB TTNN NNNN XOR-Byte

Loco addressing as in 4.1.

DB3 = TTNN NNNN: - TT — switch type: 00 = off, 01 = on, 10 = toggle, 11 = not allowed - NNNNNN — function index: 0x00 = F0 (light), 0x01 = F1, etc.

With Motorola MMI only F0 can be switched. With MMII: F0–F4. With DCC: F0–F28. From FW 1.42 extended range F0–F31.

Reply from Z21: no standard reply; 4.4 LAN_X_LOCO_INFO to subscribed clients.

4.3.2 LAN_X_SET_LOCO_FUNCTION_GROUP

Switch an entire loco function group (up to 8 functions in one command). From FW 1.42 DCC functions up to F31, and with certain limitations up to F68.

The client should continuously monitor all functions of the controlled loco to avoid accidentally turning off a function enabled earlier by another client. The command is more suitable for PC automation software.

Request to Z21:

DataLen Header X-Header DB0 DB1 DB2 DB3 XOR-Byte
0x0A 0x00 0x40 0x00 0xE4 Group Adr_MSB Adr_LSB Functions XOR-Byte

Loco addressing as in 4.1.

Groups and functions:

No. Group (HEX) Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Notes
1 0x20 0 0 0 F0 F4 F3 F2 F1 (A)
2 0x21 0 0 0 0 F8 F7 F6 F5
3 0x22 0 0 0 0 F12 F11 F10 F9
4 0x23 F20 F19 F18 F17 F16 F15 F14 F13 (B)
5 0x28 F28 F27 F26 F25 F24 F23 F22 F21 (B)
6 0x29 F36 F35 F34 F33 F32 F31 F30 F29 (C)(D)(E)
7 0x2A F44 F43 F42 F41 F40 F39 F38 F37 (D)(E)
8 0x2B F52 F51 F50 F49 F48 F47 F46 F45 (D)(E)
9 0x50 F60 F59 F58 F57 F56 F55 F54 F53 (D)(E)
10 0x51 F68 F67 F66 F65 F64 F63 F62 F61 (D)(E)

Notes: - (A) Motorola MMI: only F0; MMII: F0–F4. - (B) DCC F13–F28 with this command only from FW V1.24. - (C) DCC F29–F31 from FW V1.42, including feedback to LAN clients. - (D) DCC F32–F68 from FW V1.42, but without feedback to LAN clients (commands sent to track only). - (E) It is not guaranteed that DCC function commands from F29 upward will be understood by all decoders.

Reply from Z21: no standard reply; for functions F0–F31, 4.4 LAN_X_LOCO_INFO to subscribed clients.

4.3.3 LAN_X_SET_LOCO_BINARY_STATE

From FW 1.42. Send a DCC “Binary State” command to the locomotive decoder.

Request to Z21:

DataLen Header X-Header DB0 DB1 DB2 DB3 DB4 XOR-Byte
0x0A 0x00 0x40 0x00 0xE5 0x5F AH AL FLLL LLLL HHHH HHHH XOR-Byte

Loco addressing: loco address = (AH & 0x3F) << 8 + AL; for addresses ≥ 128 DB1 = (0xC0 | Adr_MSB).

15-bit binary state address = (HHHHHHHH << 7) + (LLLLLLL & 0x7F). Allowed address range 29–32767. Addresses 1–28 reserved for special applications, address 0 as broadcast. Addresses < 128 (HHHHHHHH == 0) are sent as DCC “binary state control command short form” (RCN-212), ≥ 128 as “long form”. Commands sent three times to the main track, then not repeated.

Reply from Z21: none (no reply to caller and no notification to other clients).

4.4 LAN_X_LOCO_INFO

Sent from Z21 to clients in response to 4.1 LAN_X_GET_LOCO_INFO, and also without a request when another client/controller changed loco status, the client activated broadcast (flag 0x00000001) and subscribed to that address.

Z21 to Client:

DataLen Header X-Header DB0 … DBn XOR-Byte
7+n 0x00 0x40 0x00 0xEF Locomotive Information XOR-Byte

Packet length n variable: 7 ≤ n ≤ 14. From FW 1.42 DataLen ≥ 15 (n ≥ 8) to carry F29, F30 and F31 status.

Locomotive information structure:

Position Data Meaning
DB0 Adr_MSB The two highest bits in Adr_MSB should be ignored
DB1 Adr_LSB loco address = (Adr_MSB & 0x3F) << 8 + Adr_LSB
DB2 0000 MBKKK¹ M=1 (from FW 1.43) loco with MM format; B=1 loco controlled by another X-BUS controller (“busy”); KKK speed steps: 0=14, 2=28, 4=128
DB3 RVVVVVVV R direction (1=forward); V speed (encoding depends on KKK, see 4.2)
DB4 0DSLFGHJ D double traction (1=loco in double heading); S Smartsearch; L=F0 (light); F=F4; G=F3; H=F2; J=F1
DB5 F5–F12 F5 = bit0 (LSB)
DB6 F13–F20 F13 = bit0 (LSB)
DB7 F21–F28 F21 = bit0 (LSB)
DB8 F29–F31 from FW 1.42 and if DataLen ≥ 15; F29 = bit0 (LSB)
DBn optional, for future extensions

¹ In the original, DB2 is described as 0000 BKKK; the MM bit (M) was introduced from FW 1.43.

4.5 LAN_X_SET_LOCO_E_STOP

From FW 1.43. Stop locomotive. For a DCC loco the “E-STOP” speed step is sent (emergency stop per RCN-212); for an MM loco step 0 (“Stop”).

Request to Z21:

DataLen Header X-Header DB0 (Adr_MSB) DB1 (Adr_LSB) XOR-Byte
0x08 0x00 0x40 0x00 0x92 Adr_MSB Adr_LSB XOR-Byte

Loco addressing as in 4.1.

Reply from Z21: no standard reply; 4.4 LAN_X_LOCO_INFO to subscribed clients.

4.6 LAN_X_PURGE_LOCO

From FW 1.43. Remove locomotive from Z21 — stops sending loco commands to the track. Sending resumes after a new drive/function command is sent to the same address.

Request to Z21:

DataLen Header X-Header DB0 DB1 DB2 XOR-Byte
0x09 0x00 0x40 0x00 0xE3 0x44 Adr_MSB Adr_LSB XOR-Byte

Loco addressing as in 4.1.

Reply from Z21: none (no reply to caller and no notification to other clients).


5 Switching

This chapter covers messages required for switching accessory decoders (“Accessory Decoder” per RP-9.2.1, e.g. turnout decoders).

Turnout number visualization differs across DCC systems. Per DCC there are four ports with two outputs each per accessory decoder address. Conversion of input parameters (FAdr_MSB, FAdr_LSB, A, P) na polecenie DCC:

DCC basic accessory decoder packet: {preamble} 0 10AAAAAA 0 1aaaCDDd 0 EEEEEEEE 1

UINT16 FAdr     = (FAdr_MSB << 8) + FAdr_LSB;
UINT16 Dcc_Addr = FAdr >> 2;

aaaAAAAAA = (~Dcc_Addr & 0x1C0) | (Dcc_Addr & 0x003F);  // DCC Address
C  = A;            // Activate or deactivate output
DD = FAdr & 0x03;  // Port
d  = P;            // Switch to the left or to the right

Example: FAdr=0 → DCC-Addr=0 Port=0; FAdr=3 → DCC-Addr=0 Port=3; FAdr=4 → DCC-Addr=1 Port=0. For MM format: FAdr=0 → MM-Addr=1; FAdr=1 → MM-Addr=2; …

The client can subscribe to accessory info (broadcast flag 0x00000001). The description uses the terms “output 1” and “output 2” instead of “straight”/“branching”.

5.1 LAN_X_GET_TURNOUT_INFO

Query turnout status (or any accessory function).

Request to Z21:

DataLen Header X-Header DB0 DB1 XOR-Byte
0x08 0x00 0x40 0x00 0x43 FAdr_MSB FAdr_LSB XOR-Byte

Function address = (FAdr_MSB << 8) + FAdr_LSB.

Reply from Z21: see 5.3 LAN_X_TURNOUT_INFO.

5.2 LAN_X_SET_TURNOUT

Switch turnout (or any accessory function).

Request to Z21:

DataLen Header X-Header DB0 DB1 DB2 XOR-Byte
0x09 0x00 0x40 0x00 0x53 FAdr_MSB FAdr_LSB 10Q0A00P XOR-Byte

Function address = (FAdr_MSB << 8) + FAdr_LSB.

DB2 = 1000A00P / 10Q0A00P: - A=0 — deactivate turnout output; A=1 — activate - P=0 — select output 1; P=1 — select output 2 - Q=0 — execute command immediately - Q=1 — (from FW V1.24) queue command in Z21 and deliver to track as soon as possible

Reply from Z21: no standard reply; 5.3 LAN_X_TURNOUT_INFO to subscribed clients.

5.2.1 LAN_X_SET_TURNOUT with Q=0

With Q=0 the Z21 behaves compatibly with previous versions: the switch command is sent to the track immediately (mixed with current drive commands). Activate (A=1) is sent until the LAN client sends the corresponding Deactivate. Only one switch command can be active at a time. The LAN client is responsible for correct serialization and switching-time timing.

Wrong:

Activate #5/A2 (4,0x89); Activate #6/A2 (5,0x89);
Activate #3/A1 (2,0x88); Deactivate #3/A1 (2,0x80);
Deactivate #5/A2 (4,0x81); Deactivate #6/A2 (5,0x81);

Correct:

Activate #5/A2 (4,0x89); wait 100ms; Deactivate #5/A2 (4,0x81); wait 50ms;
Activate #6/A2 (5,0x89); wait 100ms; Deactivate #6/A2 (5,0x81); wait 50ms;
Activate #3/A1 (2,0x88); wait 100ms; Deactivate #3/A1 (2,0x80); wait 50ms;

5.2.2 LAN_X_SET_TURNOUT with Q=1

With Q=1 the command first enters the Z21 internal queue (FIFO), then is written to the track four times. The LAN client does not need to strictly serialize commands — it can send them mixed (useful for routes). The client is only responsible for Deactivate timing (for MM, Deactivate must not be skipped).

Activate #25/A2 (24,0xA9); Activate #5/A2 (4,0xA9);
Wait 150ms;
Deactivate #25/A2 (24,0xA1)

Never mix Q=0 and Q=1 commands in one application.

5.3 LAN_X_TURNOUT_INFO

Sent in response to 5.1, and also without a request when status was changed by another client/controller (broadcast flag 0x00000001).

Z21 to Client:

DataLen Header X-Header DB0 DB1 DB2 XOR-Byte
0x09 0x00 0x40 0x00 0x43 FAdr_MSB FAdr_LSB 000000ZZ XOR-Byte

Function address = (FAdr_MSB << 8) + FAdr_LSB.

DB2 = 000000ZZ: - ZZ=00 — turnout not yet switched - ZZ=01 — turnout in position per “P=0” (see 5.2) - ZZ=10 — turnout in position per “P=1” - ZZ=11 — invalid combination

5.4 LAN_X_SET_EXT_ACCESSORY

From FW V1.40. Send a DCC command in “extended accessory decoder package format” (DCCext) to an extended accessory decoder. Allows sending turnout switching times or complex signal aspects in one command. See RCN-213 (section 2.3).

Request to Z21:

DataLen Header X-Header DB0 DB1 DB2 DB3 XOR-Byte
0x0A 0x00 0x40 0x00 0x54 Adr_MSB Adr_LSB DDDDDDDD 0x00 XOR-Byte

RawAddress = (Adr_MSB << 8) + Adr_LSB. RawAddress of the first extended decoder = 4 per RCN-213 (usually displayed as “Address 1”).

Note (10836 Z21 switch DECODER): interprets DDDDDDDD as RZZZZZZZ: - ZZZZZZZ — on-time with 100 ms resolution. Value 0 = output off; 127 = output on permanently (until next command). - Bit 7 (R) — output selection in pair: R=1 “green” (straight), R=0 “red” (branched).

Note (10837 Z21 signal DECODER): interprets DDDDDDDD as one of 256 possible signal aspects. Example values: - 0 … Stop - 4 … Clear with max speed limit 40 km/h - 16 … Clear - 65 (0x41) … shunting allowed - 66 (0x42) … turn off all lights (e.g. for distant signals) - 69 (0x45) … substitution (permission to pass defective signal)

Reply from Z21: no standard reply or 5.6 LAN_X_EXT_ACCESSORY_INFO.

Examples:

0x0A 0x00 0x40 0x00 0x54 0x00 0x04 0x05 0x00 0x55
  → RawAddress=4 (displayed as address 1), DDDDDDDD value=5

0x0A 0x00 0x40 0x00 0x54 0x07 0xFF 0x00 0x00 0xAC
  → emergency stop for extended accessory decoders (RCN-213 2.4), RawAddress=2047, value 0

5.5 LAN_X_GET_EXT_ACCESSORY_INFO

From FW V1.40. Query the last command forwarded to an extended accessory decoder.

Request to Z21:

DataLen Header X-Header DB0 DB1 DB2 XOR-Byte
0x09 0x00 0x40 0x00 0x44 Adr_MSB Adr_LSB 0x00 XOR-Byte

RawAddress = (Adr_MSB << 8) + Adr_LSB (wg RCN-213). DB2 zarezerwowane, init 0.

Reply from Z21: see 5.6 LAN_X_EXT_ACCESSORY_INFO.

5.6 LAN_X_EXT_ACCESSORY_INFO

Sent in response to 5.5, and also without a request (broadcast flag 0x00000001).

Z21 to Client:

DataLen Header X-Header DB0 DB1 DB2 DB3 XOR-Byte
0x0A 0x00 0x40 0x00 0x44 Adr_MSB Adr_LSB DDDDDDDD Status XOR-Byte

RawAddress = (Adr_MSB << 8) + Adr_LSB. - DDDDDDDD — up to 256 states in extended accessory decoder package format (RCN-213, see 5.4). - Status: 0x00 = Data Valid, 0xFF = Data Unknown.


6 Reading and writing Decoder CVs

This chapter covers reading/writing decoder CVs (Configuration Variable, RP-9.2.2, RP-9.2.3). Whether access is bit-wise or byte-wise depends on Z21 settings.

6.1 LAN_X_CV_READ

Read CV in direct mode.

Request to Z21:

DataLen Header X-Header DB0 DB1 DB2 XOR-Byte
0x09 0x00 0x40 0x00 0x23 0x11 CVAdr_MSB CVAdr_LSB XOR-Byte

CV Address = (CVAdr_MSB << 8) + CVAdr_LSB, where 0=CV1, 1=CV2, 255=CV256, etc.

Reply from Z21: 2.9 LAN_X_BC_PROGRAMMING_MODE to subscribed clients and result: 6.3 LAN_X_CV_NACK_SC, 6.4 LAN_X_CV_NACK lub 6.5 LAN_X_CV_RESULT.

6.2 LAN_X_CV_WRITE

Write CV in direct mode.

Request to Z21:

DataLen Header DB0 DB1 DB2 DB3 XOR-Byte
0x0A 0x00 0x40 0x00 0x24 0x12 CVAdr_MSB CVAdr_LSB Value XOR-Byte

CV Address = (CVAdr_MSB << 8) + CVAdr_LSB (0=CV1, …).

Reply from Z21: as in 6.1.

6.3 LAN_X_CV_NACK_SC

If programming failed due to a short circuit, this message is sent to the client that initiated programming (6.1 / 6.2).

Z21 to Client:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x61 0x12 0x73

6.4 LAN_X_CV_NACK

If ACK is missing from the decoder. For byte read, time until LAN_X_CV_NACK can be long.

Z21 to Client:

DataLen Header X-Header DB0 XOR-Byte
0x07 0x00 0x40 0x00 0x61 0x13 0x72

6.5 LAN_X_CV_RESULT

“Positive ACK” — sent to the client that initiated programming. For byte read, time until LAN_X_CV_RESULT can be long.

Z21 to Client:

DataLen Header DB0 DB1 DB2 DB3 XOR-Byte
0x0A 0x00 0x40 0x00 0x64 0x14 CVAdr_MSB CVAdr_LSB Value XOR-Byte

CV Address = (CVAdr_MSB << 8) + CVAdr_LSB (0=CV1, …).

6.6 LAN_X_CV_POM_WRITE_BYTE

Write locomotive decoder CV on the main track (POM, “Programming on the Main”). In normal operating mode (track voltage on, service mode inactive). No feedback.

Request to Z21:

DataLen Header X-Header DB0 DB1…DB5 XOR-Byte
0x0C 0x00 0x40 0x00 0xE6 0x30 POM-Parameter XOR-Byte

POM parameters:

Position Data Meaning
DB1 Adr_MSB
DB2 Adr_LSB Loco Address = (Adr_MSB & 0x3F) << 8 + Adr_LSB
DB3 111011MM Option … 0xEC; MM … CVAdr_MSB
DB4 CVAdr_LSB CV Address = (MM << 8) + CVAdr_LSB (0=CV1, …)
DB5 Value new CV value

Reply from Z21: none.

6.7 LAN_X_CV_POM_WRITE_BIT

Write a single CV bit of a locomotive decoder on the main track (POM). No feedback.

Request to Z21:

DataLen Header X-Header DB0 DB1…DB5 XOR-Byte
0x0C 0x00 0x40 0x00 0xE6 0x30 POM-Parameter XOR-Byte

POM parameters:

Position Data Meaning
DB1 Adr_MSB
DB2 Adr_LSB Loco Address = (Adr_MSB & 0x3F) << 8 + Adr_LSB
DB3 111010MM Option … 0xE8; MM … CVAdr_MSB
DB4 CVAdr_LSB CV Address = (MM << 8) + CVAdr_LSB
DB5 0000 VPPP PPP … bit position in CV; V … new CV value

Reply from Z21: none.

6.8 LAN_X_CV_POM_READ_BYTE

From FW 1.22. Read locomotive decoder CV on the main track (POM). RailCom must be active in the Z21, and the decoder must support RailCom (CV28 bits 0 and 1 and CV29 bit 3 = 1).

Request to Z21:

DataLen Header X-Header DB0 DB1…DB5 XOR-Byte
0x0C 0x00 0x40 0x00 0xE6 0x30 POM-Parameter XOR-Byte

POM parameters:

Position Data Meaning
DB1 Adr_MSB
DB2 Adr_LSB Loco Address = (Adr_MSB & 0x3F) << 8 + Adr_LSB
DB3 111001MM Option … 0xE4; MM … CVAdr_MSB
DB4 CVAdr_LSB CV Address = (MM << 8) + CVAdr_LSB
DB5 0

Reply from Z21: 6.4 LAN_X_CV_NACK or 6.5 LAN_X_CV_RESULT.

6.9 LAN_X_CV_POM_ACCESSORY_WRITE_BYTE

From FW 1.22. Write accessory decoder CV on the main track (POM). No feedback.

Request to Z21:

DataLen Header X-Header DB0 DB1…DB5 XOR-Byte
0x0C 0x00 0x40 0x00 0xE6 0x31 POM-Parameter XOR-Byte

POM parameters:

Position Data Meaning
DB1 aaaaa Decoder_Address MSB
DB2 AAAACDDD aaaaaAAAACDDD = ((Decoder_Address & 0x1FF) << 4) \| CDDD. If CDDD=0000, CV applies to the entire decoder. If C=1, DDD is the output number.
DB3 111011MM Option … 0xEC; MM … CVAdr_MSB
DB4 CVAdr_LSB CV Address = (MM << 8) + CVAdr_LSB
DB5 Value new CV value

Reply from Z21: none.

6.10 LAN_X_CV_POM_ACCESSORY_WRITE_BIT

From FW 1.22. Write a single CV bit of an accessory decoder on the main track (POM). No feedback.

Request to Z21:

DataLen Header X-Header DB0 DB1…DB5 XOR-Byte
0x0C 0x00 0x40 0x00 0xE6 0x31 POM-Parameter XOR-Byte

POM parameters:

Position Data Meaning
DB1 aaaaa Decoder_Address MSB
DB2 AAAACDDD as in 6.9
DB3 111010MM Option … 0xE8; MM … CVAdr_MSB
DB4 CVAdr_LSB CV Address = (MM << 8) + CVAdr_LSB
DB5 0000 VPPP PPP … bit position in CV; V … new CV value

Reply from Z21: none.

6.11 LAN_X_CV_POM_ACCESSORY_READ_BYTE

From FW 1.22. Read accessory decoder CV on the main track (POM). RailCom must be active; decoder must support RailCom.

Request to Z21:

DataLen Header X-Header DB0 DB1…DB5 XOR-Byte
0x0C 0x00 0x40 0x00 0xE6 0x31 POM-Parameter XOR-Byte

POM parameters:

Position Data Meaning
DB1 aaaaa Decoder_Address MSB
DB2 AAAACDDD as in 6.9
DB3 111001MM Option … 0xE4; MM … CVAdr_MSB
DB4 CVAdr_LSB CV Address = (MM << 8) + CVAdr_LSB
DB5 0

Reply from Z21: 6.4 LAN_X_CV_NACK or 6.5 LAN_X_CV_RESULT.

6.12 LAN_X_MM_WRITE_BYTE

From FW 1.23. Write Motorola decoder register on the programming track.

Request to Z21:

DataLen Header X-Header DB0 DB1 DB2 DB3 XOR-Byte
0x0A 0x00 0x40 0x00 0x24 0xFF 0 RegAdr Value XOR-Byte

Reply from Z21: 2.9 LAN_X_BC_PROGRAMMING_MODE to subscribed clients and result 6.3 LAN_X_CV_NACK_SC or 6.5 LAN_X_CV_RESULT.

Note: there is no read for Motorola. LAN_X_CV_RESULT only means “MM programming process finished”, not “MM programming process successful”.

Example: 0x0A 0x00 0x40 0x00 0x24 0xFF 0x00 0x00 0x05 0xDE → “Change loco decoder address (register 1) to 5”.

6.13 LAN_X_DCC_READ_REGISTER

From FW 1.25. Read DCC decoder register in register mode (S-9.2.3) on the programming track.

Request to Z21:

DataLen Header X-Header DB0 DB1 XOR-Byte
0x08 0x00 0x40 0x00 0x22 0x11 REG XOR-Byte

Reply from Z21: 2.9 LAN_X_BC_PROGRAMMING_MODE + 6.3 LAN_X_CV_NACK_SC lub 6.5 LAN_X_CV_RESULT.

Register mode is only needed for very old DCC decoders. Direct CV is preferred.

6.14 LAN_X_DCC_WRITE_REGISTER

From FW 1.25. Write DCC decoder register in register mode on the programming track.

Request to Z21:

DataLen Header X-Header DB0 DB1 (REG) DB2 (Value) XOR-Byte
0x09 0x00 0x40 0x00 0x23 0x12 REG Value XOR-Byte

Reply from Z21: as in 6.13.


7 Feedback – R-BUS

Feedback modules (Roco 10787, 10808, 10819) on R-BUS.

7.1 LAN_RMBUS_DATACHANGED

Report changes on the feedback bus. Sent asynchronously when the client activated broadcast (flag 0x00000002) or explicitly requested status (7.2).

Z21 to Client:

DataLen Header Data
0x0F 0x00 0x80 0x00 Group index (1 byte), Feedback status (10 bytes)

Example: Group Index = 1, Feedback Status = 0x01 0x00 0xC5 0x00 … → “module #11, contact on input 1; module #13, contacts on inputs 8, 7, 3 and 1”.

7.2 LAN_RMBUS_GETDATA

Query current status of feedback modules.

Request to Z21:

DataLen Header Data
0x05 0x00 0x81 0x00 Group index (1 byte)

Reply from Z21: see 7.1 LAN_RMBUS_DATACHANGED.

7.3 LAN_RMBUS_PROGRAMMODULE

Change address of one feedback module.

Request to Z21:

DataLen Header Data
0x05 0x00 0x82 0x00 Address (1 byte)

Reply from Z21: none.

The programming sequence is broadcast on R-BUS until this command is sent again with address=0. During programming only one module should be connected to R-BUS.


8 RailCom

The Z21 supports RailCom: - Generating RailCom cutout in the track signal. - Global RailCom receiver in the Z21. - Local RailCom receivers (e.g. in 10808 detectors or 10806/10807 boosters) — data from channel 2 forwarded via CAN to Z21 (from FW V1.29). - Reading POM results (see 6.8, from FW V1.22). - Loco address recognition for occupancy detectors (CAN, LocoNet, X-BUS). - Decoder speed (from FW V1.29). - Decoder QoS (from FW V1.29).

Requires a RailCom-capable decoder, correct CV28/CV29 configuration, and active “RailCom” option in Z21 settings.

8.1 LAN_RAILCOM_DATACHANGED

From FW 1.29. Sent in response to 8.2, and also without a request when RailCom data actually changed and the client: activated broadcast 0x00000004 + subscribed to loco address (4.1), or subscribed to broadcast 0x00040000 (all locomotives, PC software only).

Z21 to Client:

DataLen Header Data
0x11 0x00 0x88 0x00 RailComData

RailComData structure (16/32-bit values, little-endian):

Offset Type Name Description
0 UINT16 LocoAddress detected decoder address
2 UINT32 ReceiveCounter receive counter in Z21
6 UINT16 ErrorCounter receive error counter in Z21
8 UINT8 reserved
9 UINT8 Options flag bitmask (see below)
10 UINT8 Speed speed 1 or 2 (if supported by decoder)
11 UINT8 QoS Quality of Service (if supported)
12 UINT8 reserved

Options bitmask:

#define rcoSpeed1  0x01  // CH7 subindex 0
#define rcoSpeed2  0x02  // CH7 subindex 1
#define rcoQoS     0x04  // CH7 subindex 7

Structure may be extended — consider DataLen when evaluating.

8.2 LAN_RAILCOM_GETDATA

From FW V1.29. Query RailCom data from Z21.

Request to Z21:

DataLen Header Data
0x07 0x00 0x89 0x00 Type 8-bit, LocoAddress 16-bit (LE)

Reply from Z21: see 8.1 LAN_RAILCOM_DATACHANGED.


9 LocoNet

From FW 1.20. The Z21 can act as an Ethernet/LocoNet gateway, while also being LocoNet master (refreshing slots, generating DCC packets).

Subscription via 2.16 LAN_SET_BROADCASTFLAGS. Consider carefully whether flags 0x02000000 (locos) and 0x04000000 (turnouts) are needed — for conventional driving and switching, commands from chapters 4, 5 and 6 are preferable. The LocoNet protocol itself is not described here.

9.1 LAN_LOCONET_Z21_RX

From FW 1.20. Message received by Z21 from LocoNet bus (broadcasts 0x01000000, 0x02000000 or 0x04000000).

Z21 to Client:

DataLen Header Data
0x04+n 0x00 0xA0 0x00 LocoNet message incl. CKSUM (n bytes)

9.2 LAN_LOCONET_Z21_TX

From FW 1.20. Message written by Z21 to LocoNet bus.

Z21 to Client:

DataLen Header Data
0x04+n 0x00 0xA1 0x00 LocoNet message incl. CKSUM (n bytes)

9.3 LAN_LOCONET_FROM_LAN

From FW 1.20. Allows the LAN client to write a message to LocoNet. Also sent asynchronously by Z21 when another LAN client wrote a message to LocoNet.

LAN client → Z21, or Z21 → LAN client:

DataLen Header Data
0x04+n 0x00 0xA2 0x00 LocoNet message incl. CKSUM (n bytes)

9.3.1 DCC Binary State Control Instruction via LocoNet OPC_IMM_PACKET

From FW 1.42 4.3.3 LAN_X_SET_LOCO_BINARY_STATE is recommended instead of the method below.

From FW V1.25 arbitrary DCC packets can be generated on track output using LAN_LOCONET_FROM_LAN and LocoNet command OPC_IMM_PACKET, including Binary State Control Instruction (“F29…F32767”). Also applies to white z21 (virtual LocoNet stack). For OPC_IMM_PACKET structure see LocoNet Spec; for Binary State Control Instruction — NMRA S-9.2.1 “Feature Expansion Instruction”.

9.4 LAN_LOCONET_DISPATCH_ADDR

From FW 1.20. Prepare loco address for LocoNet dispatch (“DISPATCH_PUT”).

Request to Z21:

DataLen Header Data
0x06 0x00 0xA3 0x00 16-bit loco address (little-endian)

Reply from Z21: - FW < 1.22: none. - FW ≥ 1.22:

DataLen Header Data
0x07 0x00 0xA3 0x00 16-bit loco address (LE), Result 8-bit

9.5 LAN_LOCONET_DETECTOR

From FW 1.22. Allows querying occupancy state and being asynchronously notified of changes without dealing with LocoNet protocol details.

Difference between 10787 module on R-BUS and LocoNet occupancy detectors: 10787 typically uses mechanical contacts (per axle), whereas LocoNet detectors rely on current measurement or advanced technologies (transponder, infrared, RailCom) and usually generate a message only on occupancy state change.

Request to Z21:

DataLen Header Data
0x07 0x00 0xA4 0x00 Type 8-bit, 16-bit report address (LE)

Type: - 0x80 — request via “Stationary Interrogate Request” (SIC) per Digitrax procedure (also Blücher-Elektronik). “Report address” parameter = 0 (irrelevant). - 0x81 — request via so-called report address for Uhlenbrock detector (user-configurable, e.g. UB63320 via LNCV 17, default 1017). Report address ≠ feedback address. On LocoNet bus implemented via turnout switch commands, so the LocoNet value is decremented by 1. Example: 0x07 0x00 0xA4 0x00 0x81 0xF8 0x03 → “detector status with report address 1017” (1017 = 0x03F8 + 1). - 0x82(from FW 1.23) request status for LISSY. For Uhlenbrock LISSY report address equals feedback address; message type depends on LISSY receiver operating mode.

A single request may be answered by several detectors, so expect multiple replies.

Reply from Z21:

DataLen Header Data
0x07+n 0x00 0xA4 0x00 Type 8-bit, Feedback address 16-bit (LE), Info[n]

Sent asynchronously when the client activated broadcast 0x08000000 and Z21 received a message from a detector (input state change or explicit query).

Type n Meaning
0x01 1 Input status (Uhlenbrock 63320, Blücher GBM16XL — only “occupied”/“free”, LocoNet OPC_INPUT_REP, X=1). Info[0]=0 → LOW (“free”); Info[0]=1 → HIGH (“occupied”).
0x02 2 Transponder Enters Block
0x03 2 Transponder Exits Block (Blücher GBM16XN — transponder address = loco address determined by RailCom). Info[0] = low byte, Info[1] = high byte (16-bit LE). GBM16XN note: add +1 to feedback address; bit under mask 0x1000 may encode direction (not recommended — conflicts with long addresses).
0x10 3 LISSY Loco address (from FW 1.23) — when LISSY receiver reports a vehicle with LISSY transmitter in “Transfer format (ÜF) Uhlenbrock” (LNCV 15=1). Info[0]/Info[1] = loco address 16-bit LE (locos 1..9999, cars 10000..16382). Info[2] = 0 DIR1 DIR0 0 K3 K2 K1 K0: if DIR1=0 ignore DIR0; DIR1=1: DIR0=0 forward, DIR0=1 reverse; K3..K0 = 4-bit “class information”.
0x11 1 LISSY block status (from FW 1.23)Info[0]=0 block free, Info[0]=1 block occupied.
0x12 2 LISSY Speed (from FW 1.23)Info[0]/Info[1] = speed 16-bit LE.

Type may be extended with additional IDs in the future.


10 CAN

10.1 LAN_CAN_DETECTOR

From FW 1.30. Roco CAN occupancy detector 10808. Can be used in four ways:

  1. R-BUS emulation — CAN detector forwarded as R-BUS detector (chapter 7).
  2. LocoNet emulation — forwarded as LocoNet detector (chapter 9.5, types 0x01, 0x02, 0x03).
  3. LISSY emulation — emulated via LISSY/Marco messages (chapter 9.5, types 0x10, 0x11).
  4. Direct access via LAN_CAN_DETECTOR command (fastest, most bandwidth-efficient method).

Emulation type configurable via Z21 Maintenance Tool. Factory default: R-BUS emulation = on, LocoNet emulation = on, LISSY emulation = off.

Request to Z21:

DataLen Header Data
0x07 0x00 0xC4 0x00 Type 8-bit, CAN-NetworkID 16-bit (LE)

Reply from Z21:

DataLen Header NId Addr Port Type Value1 Value2
0x0E 0x00 0xC4 0x00 16-bit 16-bit 8-bit 8-bit 16-bit 16-bit

Sent asynchronously with broadcast 0x00080000. All 16-bit values are little-endian.

If Type = 0x01 (occupancy status):

Value1 Meaning
0x0000 Free, without voltage
0x0100 Free, with voltage
0x1000 Occupied, without voltage
0x1100 Occupied, with voltage
0x1201 Occupied, Overload 1
0x1202 Occupied, Overload 2
0x1203 Occupied, Overload 3

If Type = 0x11..0x1F (RailCom Loco address): Type 0x11..0x1F form a list of loco addresses terminated by address 0. - Value1 — first detected loco address in section with direction. 0 = none / end of list. - Value2 — second detected loco address. 0 = none / end of list.

Direction encoded in the two highest bits of Value1/Value2: - 0 x — direction not detected - 1 0 — vehicle facing forward - 1 1 — vehicle facing reverse

Lower 14 bits contain the loco address.

10.2 CAN Booster

From FW 1.41. Manage Roco CAN boosters (10806, 10807, 10869) — works only when boosters are connected to Z21 via CAN-Bus (not B-BUS).

10.2.1 LAN_CAN_DEVICE_GET_DESCRIPTION

Read booster name (free text stored by user).

Request to Z21:

DataLen Header Data
0x06 0x00 0xC8 0x00 NId 16-bit

NId — CAN-NetworkID adresowanego boostera (16-bit LE, 0xC1010xC1FF).

Z21 to Client:

DataLen Header Data
0x16 0x00 0xC8 0x00 NId 16-bit, UINT8 Name[16]

Tips: do not send two GET_DESCRIPTION requests back-to-back — wait for the reply. NetworkIDs of all CAN boosters available via 10.2.3.

10.2.2 LAN_CAN_DEVICE_SET_DESCRIPTION

Overwrite booster name.

Request to Z21:

DataLen Header Data
0x16 0x00 0xC9 0x00 NId 16-bit, UINT8 Name[16]

Reply from Z21: none.

10.2.3 LAN_CAN_BOOSTER_SYSTEMSTATE_CHGD

Report CAN booster status to client. Message appears approx. once per second per booster and output. Sent with broadcast 0x00020000 and at least one booster connected via CAN.

Z21 to Client:

DataLen Header Data
0x0E 0x00 0xCA 0x00 CANBoosterSystemState (10 bytes)

Struktura CANBoosterSystemState (16-bit little-endian):

Offset Type Name Description
0 UINT16 NId CAN-NetworkID boostera (0xC1010xC1FF)
2 UINT16 Booster_OutputPort 1 = 1st track output; 2 = 2nd track output (10807 only)
4 UINT16 Booster_State bitmask (see below)
6 UINT16 Booster_VCCVoltage mV — track output voltage
8 UINT16 Booster_Current mA — track output current

Booster_State bitmask:

#define bsBgActive         0x0001  // brake generator active (ZCAN SSP)
#define bsShortCircuit     0x0020  // short circuit on track (ZCAN UES)
#define bsTrackVoltageOff  0x0080  // track is switched off (OFF)
#define bsRailComActive    0x0800  // RailCom-Cutout active
// From Booster FW V1.11 (Booster Management):
#define bsOutputDisabled   0x0100  // track is deactivated (by user)

10.2.4 LAN_CAN_BOOSTER_SET_TRACKPOWER

Manage booster: deactivate and reactivate CAN booster track outputs.

Request to Z21:

DataLen Header Data
0x07 0x00 0xCB 0x00 NId 16-bit, Power 8-bit

Outputs can be turned on again only when the Z21 is on and sending a valid track signal. Booster management settings are not stored permanently.

Reply from Z21: on change 10.2.3 LAN_CAN_BOOSTER_SYSTEMSTATE_CHGD to subscribed clients.


The zLink interface allows integrating devices with smaller microcontrollers into the network (without their own LAN/Wi-Fi). zLink devices (01/2021): - 10806 Z21 single BOOSTER - 10807 Z21 dual BOOSTER - 10869 Z21 XL BOOSTER - 10836 Z21 switch DECODER - 10837 Z21 signal DECODER

11.1 Adapter

10838 Z21 pro LINK connects the zLink interface to Wi-Fi as a gateway: 1. Configuration of the end device (buttons/display, Z21 App, Z21 Maintenance Tool). 2. Firmware update of the end device. 3. Control of the device by Wi-Fi clients using the Z21 LAN protocol.

A reduced Z21 protocol stack is implemented in the end device (see tables in Appendix A). Tips: - Limited bandwidth: effective transfer < 1024 bytes/s per device. - Pause ≥ 50 ms between two requests. - Use Z21 pro LINK preferably in client mode. - Preferably only one Wi-Fi client per Z21 pro LINK, max 4.

Query Z21 pro LINK properties. Sent as UDP broadcast to discover devices on the network. This command is handled by Z21 pro LINK itself (not forwarded to the end device).

Request to Z21 pro LINK:

DataLen Header Data
0x05 0x00 0xE8 0x00 0x06

Reply from Z21 pro LINK:

DataLen Header Data
0x3F 0x00 0xE8 0x00 0x06, Z_Hw_Info (58 bytes)

Struktura Z_Hw_Info (16-bit little-endian):

Offset Type Name Example
0 UINT16 HwID 401 (0x191)
2 UINT8 FW_Version_Major 1
3 UINT8 FW_Version_Minor 1
4 UINT16 FW_Version_Build 3217 (0xC91)
6 UINT8[18] MAC_Address (string) „EC FA BC 4F 04 C6”
24 UINT8[33] Name (string) „this_is_a_quite_long_device_name”
57 UINT8 Reserved 0x00

11.2 Booster 10806, 10807 und 10869

Commands available for boosters — see Appendix A. Additionally, new commands were introduced that apply only to boosters.

11.2.1 LAN_BOOSTER_GET_DESCRIPTION

Request to BOOSTER:

DataLen Header Data
0x04 0x00 0xB8 0x00

Reply from BOOSTER:

DataLen Header Data
0x24 0x00 0xB8 0x00 UINT8 Name[32]

11.2.2 LAN_BOOSTER_SET_DESCRIPTION

Request to BOOSTER:

DataLen Header Data
0x24 0x00 0xB9 0x00 UINT8 Name[32]

Reply from BOOSTER: none.

11.2.3 LAN_BOOSTER_SYSTEMSTATE_GETDATA

Request to BOOSTER:

DataLen Header Data
0x04 0x00 0xBB 0x00

Reply from BOOSTER: see 11.2.4.

11.2.4 LAN_BOOSTER_SYSTEMSTATE_DATACHANGED

Reported asynchronously with broadcast 0x00000100 or after explicit request 11.2.3.

BOOSTER to Client:

DataLen Header Data
0x1C 0x00 0xBA 0x00 BoosterSystemState (24 bytes)

BoosterSystemState structure (16-bit little-endian):

Offset Type Name Description
0 INT16 Booster_1_MainCurrent mA — 1st output current
2 INT16 Booster_2_MainCurrent mA — 2nd output current
4 INT16 Booster_1_FilteredMainCurrent mA — filtered 1st output current
6 INT16 Booster_2_FilteredMainCurrent mA — filtered 2nd output current
8 INT16 Booster_1_Temperature °C — 1st amplifier temperature
10 INT16 Booster_2_Temperature °C — 2nd amplifier temperature
12 UINT16 SupplyVoltage mV — supply voltage
14 UINT16 Booster_1_VCCVoltage mV — 1st output voltage
16 UINT16 Booster_2_VCCVoltage mV — 2nd output voltage
18 UINT8 CentralState bitmask
19 UINT8 CentralStateEx bitmask
20 UINT8 CentralStateEx2 bitmask
21 UINT8 Reserved1
22 UINT8 CentralStateEx3 bitmask
23 UINT8 Reserved2

CentralState bitmask:

#define csTrackVoltageOff  0x02  // track is switched off
#define csConfigMode       0x10  // configuration mode is active
#define csCanConnected     0x20  // CAN connection with Z21 is Ok

CentralStateEx bitmask:

#define cseHighTemperature         0x01  // over temperature
#define csePowerLost               0x02  // supply voltage too low
#define cseBooster_1_ShortCircuit  0x04  // short circuit on 1st track output
#define cseBooster_2_ShortCircuit  0x08  // short circuit on 2nd output
#define cseRevPol                  0x10  // supply voltage error
#define cseNoDCCInput              0x80  // no DCC input signal

CentralStateEx2 bitmask:

#define cse2Booster_1_RailComActive   0x01  // RailCom active 1st track output
#define cse2Booster_2_RailComActive   0x02  // RailCom active 2nd track output
#define cse2Booster_1_MasterSettings  0x04  // CAN autosettings Ok 1st track output
#define cse2Booster_2_MasterSettings  0x08  // CAN autosettings Ok 2nd track output
#define cse2Booster_1_BgActive        0x10  // brake generator active 1st track output
#define cse2Booster_2_BgActive        0x20  // brake generator active 2nd track output
#define cse2Booster_1_RailComFwd      0x40  // RailCom forwarding active 1st track output
#define cse2Booster_2_RailComFwd      0x80  // RailCom forwarding active 2nd track output

CentralStateEx3 bitmask:

#define cse3Booster_1_OutputInverted  0x01  // 1st track output inverted (autoinvert)
#define cse3Booster_2_OutputInverted  0x02  // 2nd track output inverted (autoinvert)
// From Booster FW V1.11:
#define cse3Booster_1_OutputDisabled  0x10  // Track output 1 deactivated (by user)
#define cse3Booster_2_OutputDisabled  0x20  // Track output 2 deactivated (by user)

11.2.5 LAN_BOOSTER_SET_POWER

From Booster FW V1.11. User booster management. Allows turning off/on dedicated track output on 10807 Z21 dual BOOSTER.

Request to BOOSTER:

DataLen Header Data
0x06 0x00 0xB2 0x00 BoosterPort 8-bit, BoosterPortState 8-bit

Reply from BOOSTER: on change 11.2.4 to subscribed clients.

11.3 Decoder 10836 und 10837

Commands available for decoders — see Appendix A.

11.3.1 LAN_DECODER_GET_DESCRIPTION

Request to DECODER:

DataLen Header Data
0x04 0x00 0xD8 0x00

Reply from DECODER:

DataLen Header Data
0x24 0x00 0xD8 0x00 UINT8 Name[32]

Name encoding as in 11.2.1.

11.3.2 LAN_DECODER_SET_DESCRIPTION

Request to DECODER:

DataLen Header Data
0x24 0x00 0xD9 0x00 UINT8 Name[32]

Name encoding as in 11.2.2. Reply: none.

11.3.3 LAN_DECODER_SYSTEMSTATE_GETDATA

Request to DECODER:

DataLen Header Data
0x04 0x00 0xDB 0x00

Reply from DECODER: see 11.3.4.

11.3.4 LAN_DECODER_SYSTEMSTATE_DATACHANGED

Reported asynchronously with broadcast 0x00000100 or after explicit request 11.3.3. If signal decoder does not report within 4 s despite subscription, it can be queried. Replies from 10836 and 10837 differ in structure and content — distinguished by DataLen.

11.3.4.1 SwitchDecoderSystemState

10836 Z21 switch DECODER to client:

DataLen Header Data
0x30 0x00 0xDA 0x00 SwitchDecoderSystemState (44 bytes)

SwitchDecoderSystemState structure (16-bit little-endian):

Offset Type Name Description
0 INT16 Current mA — current
2 INT16 FilteredCurrent mA — filtered current (sum of internal + terminal current)
4 UINT16 Voltage mV — internal voltage (3.3V)
6 UINT8 CentralState bitmask
7 UINT8 CentralStateEx bitmask
8 UINT8[8] OutputStates[0..7] status per output
16 UINT8[8] OutputConfig[0..7] operating mode per output
24 UINT8[4] OutputDimm[0..7] dimming value per output
32 UINT16 Address first decoder address
34 UINT16 Address2 second decoder address
36 UINT8[6] Reserved1
42 UINT8 Dimmed 1 bit per output
43 UINT8 Reserved2

CentralState bitmask:

#define csEmergencyStop    0x01  // The emergency stop for decoder
#define csTrackVoltageOff  0x02  // The track voltage is switched off
#define csShortCircuit     0x04  // Short-circuit
#define csConfigMode       0x10  // configuration mode is active

CentralStateEx bitmask:

#define csePowerLost   0x02  // Input voltage too low
#define cseRCN213      0x20  // addressing conform with RCN213
#define cseNoDCCInput  0x80  // no DCC input signal

OutputState (enumeration):

#define oUnknown        0x00
#define oRedActive      0x11
#define oRedInactive    0x01
#define oGreenActive    0x12
#define oGreenInactive  0x02

OutputConfig (enumeration, output operating mode):

#define ocfgNormal   0  // impulse operation (default)
#define ocfgBlinker  1  // alternating flasher
#define ocfgBlinkSm  2  // alternating flasher with fade in/out
#define ocfg10775    3  // momentary operation like 10775
#define ocfgK84      4  // continuous operation (e.g. for lighting)
#define ocfgK84Sm    5  // continuous operation with fade in/out
11.3.4.2 SignalDecoderSystemState

10837 Z21 signal DECODER to client:

DataLen Header Data
0x2E 0x00 0xDA 0x00 SignalDecoderSystemState (42 bytes)

SignalDecoderSystemState structure (16-bit little-endian):

Offset Type Name Description
0 INT16 Current mA — 0 / Reserved
2 INT16 FilteredCurrent mA — 0 / Reserved
4 UINT16 Voltage mV — voltage at terminals
6 UINT8 CentralState bitmask
7 UINT8 CentralStateEx bitmask
8 UINT8[2] OutputStates[0..1] on/off for outputs A1…B8
10 UINT8[2] BlinkStates[0..1] blink status for outputs A1…B8
12 UINT8[4] SignalDccExt[0..3] DCCext — current aspect of signals 1–4
16 UINT8[4] SignalCurrAsp[0..3] index — current aspect of signals 1–4
20 UINT8[3] Reserved1
23 UINT8 SignalCount number of signals used (2, 3, 4)
24 UINT8[4] SignalConfig[0..3] Signal-ID — configuration of signals 1–4
28 UINT8[4] SignalInitAsp[0..3] index — initialization of signals 1–4
32 UINT16 Address first decoder address
34 UINT16[4] Reserved2

CentralState bitmask:

#define csEmergencyStop    0x01  // The emergency stop for decoder
#define csTrackVoltageOff  0x02  // The track voltage is switched off
#define csShortCircuit     0x04  // Short-circuit
#define csConfigMode       0x10  // configuration mode is active

CentralStateEx bitmask:

#define csePowerLost   0x02  // Input voltage too low
#define cseEEPromError 0x10  // EEPROM write / read error
#define cseRCN213      0x20  // addressing conform with RCN213
#define cseNoDCCInput  0x80  // no DCC input signal

12 Fast Clock

From FW 1.43. Accelerated Z21 fast clock time is available for devices on the main track, X-BUS and LAN. Rate can be accelerated up to ≤ 63.

The Z21 has no real-time clock — fast clock always starts from the same default start time (configurable). Behavior on emergency stop/short circuit and output to track, LocoNet, X-BUS and IP Multicast can be configured.

12.1 LAN_FAST_CLOCK_CONTROL

12.1.1 Get Fast Clock Time

Request to Z21:

DataLen Header Data
0x07 0x00 0xCC 0x00 0x21 0x2A 0x0B

Reply from Z21: see 12.2 LAN_FAST_CLOCK_DATA.

12.1.2 Set Fast Clock Time

Sets current rate and fast clock time.

Request to Z21:

DataLen Header Data
0x0A 0x00 0xCC 0x00 0x24 0x2B DDDhhhhh 00mmmmmm 00rrrrrr XOR-Byte

Rate is stored permanently in the Z21.

Reply from Z21: 12.2 LAN_FAST_CLOCK_DATA to subscribed clients.

12.1.3 Start Fast Clock Time

Request to Z21:

DataLen Header Data
0x07 0x00 0xCC 0x00 0x21 0x2C 0x0D

Reply from Z21: 12.2 LAN_FAST_CLOCK_DATA. Stan “fcFastClockEnabled” stored permanently.

12.1.4 Stop Fast Clock Time

Request to Z21:

DataLen Header Data
0x07 0x00 0xCC 0x00 0x21 0x2D 0x0C

Reply from Z21: 12.2 LAN_FAST_CLOCK_DATA. Stan “fcFastClockEnabled” stored permanently.

12.2 LAN_FAST_CLOCK_DATA

Reports current fast clock time. Sent asynchronously with broadcast 0x00000010 or after explicit request 12.1.1. When fast clock is running, message appears approx. once per model minute, and on start/pause/change. Z21 may skip messages — clients must tolerate this and optionally compute time themselves.

Z21 to Client:

DataLen Header Data
0x0C 0x00 0xCD 0x00 FastClockTime (8 bytes)

Struktura FastClockTime:

Offset Type Name Value
0 UINT8 0x66
1 UINT8 0x25
2 UINT8 DDDh hhhh day of week + hour
3 UINT8 00mm mmmm minute
4 UINT8 SHss ssss second + STOP and HALT flags
5 UINT8 00rr rrrr rate
6 UINT8 FcSettings fast clock settings flags
7 UINT8 XOR-Byte XOR sum over Data

12.3 LAN_FAST_CLOCK_SETTINGS_GET

Read persistent fast clock settings.

Request to Z21:

DataLen Header Data
0x05 0x00 0xCE 0x00 0x04

Reply from Z21:

DataLen Header Data
0x08 0x00 0xCE 0x00 FcSettings, Rate, StartDDDhhhhh, StartMMMMMM

Each field in Data is 8 bits. - FcSettings — settings flags (see below). - Rate — rate (0–63). - StartDDDhhhhh — default start time: DDD day (0=Mon..6=Sun), hhhhh hour (0–23). - StartMMMMMM — default start minute (0–59).

FcSettings bitmask:

#define fcFastClockLocoNetEn       0x01  // activate output on LocoNet (polled)
#define fcFastClockXBUSEn          0x02  // activate broadcast on XBUS
//                                 0x04  // reserved
#define fcFastClockDCCEn           0x08  // activate DCC broadcast on main track
#define fcFastClockMRclockEn       0x10  // enable sending MRclock multicasts
//                                 0x20  // reserved
#define fcFastClockEmergenyHaltEn  0x40  // halt fast clock on emergency stop automatically
#define fcFastClockEnabled         0x80  // activate fast clock

12.4 LAN_FAST_CLOCK_SETTINGS_SET

Overwrite persistent fast clock settings. Each field in Data is 8 bits. Three variants available depending on number of fields:

Variant 1 — FcSettings only:

DataLen Header Data
0x05 0x00 0xCF 0x00 FcSettings

Variant 2 — FcSettings + Rate:

DataLen Header Data
0x06 0x00 0xCF 0x00 FcSettings, Rate

Variant 3 — FcSettings + Rate + default start time:

DataLen Header Data
0x08 0x00 0xCF 0x00 FcSettings, Rate, StartDDDhhhhh, StartMMMMMM

Field description — see 12.3 LAN_FAST_CLOCK_SETTINGS_GET.

Reply from Z21: none.


Appendix A – Command overview

Client to Z21

Messages sent from client to Z21 or zLink device.

Header DB0 Parameters Name
0x10 LAN_GET_SERIAL_NUMBER
0x18 LAN_GET_CODE
0x1A LAN_GET_HWINFO
0x30 LAN_LOGOFF
0x40 (0x21) 0x21 LAN_X_GET_VERSION
0x40 (0x21) 0x24 LAN_X_GET_STATUS
0x40 (0x21) 0x80 LAN_X_SET_TRACK_POWER_OFF
0x40 (0x21) 0x81 LAN_X_SET_TRACK_POWER_ON
0x40 (0x22) 0x11 Register LAN_X_DCC_READ_REGISTER
0x40 (0x23) 0x11 CV-Address LAN_X_CV_READ
0x40 (0x23) 0x12 Register, Value LAN_X_DCC_WRITE_REGISTER
0x40 (0x24) 0x12 CV-Address, Value LAN_X_CV_WRITE
0x40 (0x24) 0xFF Register, Value LAN_X_MM_WRITE_BYTE
0x40 0x43 Turnout address LAN_X_GET_TURNOUT_INFO
0x40 0x44 Accessory decoder address LAN_X_GET_EXT_ACCESSORY_INFO
0x40 0x53 Turnout address, command LAN_X_SET_TURNOUT
0x40 0x54 Accessory decoder address, State LAN_X_SET_EXT_ACCESSORY
0x40 0x80 LAN_X_SET_STOP
0x40 0x92 Loco address LAN_X_SET_LOCO_E_STOP
0x40 (0xE3) 0x44 Loco address LAN_X_PURGE_LOCO
0x40 (0xE3) 0xF0 Loco address LAN_X_GET_LOCO_INFO
0x40 (0xE4) 0x1s Loco address, Speed LAN_X_SET_LOCO_DRIVE
0x40 (0xE4) 0xF8 Loco address, Function LAN_X_SET_LOCO_FUNCTION
0x40 (0xE4) Group Loco address, Function group LAN_X_SET_LOCO_FUNCTION_GROUP
0x40 (0xE5) 0x5F Loco address, Binary state LAN_X_SET_LOCO_BINARY_STATE
0x40 (0xE6) 0x30 POM-Param, Option 0xEC LAN_X_CV_POM_WRITE_BYTE
0x40 (0xE6) 0x30 POM-Param, Option 0xE8 LAN_X_CV_POM_WRITE_BIT
0x40 (0xE6) 0x30 POM-Param, Option 0xE4 LAN_X_CV_POM_READ_BYTE
0x40 (0xE6) 0x31 POM-Param, Option 0xEC LAN_X_CV_POM_ACCESSORY_WRITE_BYTE
0x40 (0xE6) 0x31 POM-Param, Option 0xE8 LAN_X_CV_POM_ACCESSORY_WRITE_BIT
0x40 (0xE6) 0x31 POM-Param, Option 0xE4 LAN_X_CV_POM_ACCESSORY_READ_BYTE
0x40 (0xF1) 0x0A LAN_X_GET_FIRMWARE_VERSION
0x50 Broadcast-Flags LAN_SET_BROADCASTFLAGS
0x51 LAN_GET_BROADCASTFLAGS
0x60 Loco address LAN_GET_LOCOMODE
0x61 Loco address, Mode LAN_SET_LOCOMODE
0x70 Accessory decoder address LAN_GET_TURNOUTMODE
0x71 Accessory decoder address, Mode LAN_SET_TURNOUTMODE
0x81 Group index LAN_RMBUS_GETDATA
0x82 Address LAN_RMBUS_PROGRAMMODULE
0x85 LAN_SYSTEMSTATE_GETDATA
0x89 Address LAN_RAILCOM_GETDATA
0xA2 LocoNet message LAN_LOCONET_FROM_LAN
0xA3 Loco address LAN_LOCONET_DISPATCH_ADDR
0xA4 Type, Report address LAN_LOCONET_DETECTOR
0xC4 Type, NId LAN_CAN_DETECTOR
0xC8 NetID LAN_CAN_DEVICE_GET_DESCRIPTION
0xC9 NetID, Name LAN_CAN_DEVICE_SET_DESCRIPTION
0xCB NetID, PowerState LAN_CAN_BOOSTER_SET_TRACKPOWER
0xCC Fastclock Start/Stop/Get/Set Command LAN_FAST_CLOCK_CONTROL
0xCE Len LAN_FAST_CLOCK_SETTINGS_GET
0xCF Fastclock Settings LAN_FAST_CLOCK_SETTINGS_SET
0xB2 BoosterPort, BoosterPowerState LAN_BOOSTER_SET_POWER
0xB8 LAN_BOOSTER_GET_DESCRIPTION
0xB9 String LAN_BOOSTER_SET_DESCRIPTION
0xBB LAN_BOOSTER_SYSTEMSTATE_GETDATA
0xD8 LAN_DECODER_GET_DESCRIPTION
0xD9 String LAN_DECODER_SET_DESCRIPTION
0xDB LAN_DECODER_SYSTEMSTATE_GETDATA
0xE8 0x06 LAN_ZLINK_GET_HWINFO

Table 1: Messages from Client to Z21.

Z21 to Client

Messages sent from Z21 or zLink device to client.

Header DB0 Data Name
0x10 Serialnumber Reply to LAN_GET_SERIAL_NUMBER
0x18 Code Reply to LAN_GET_CODE
0x1A HWType, FW Version (BCD) Reply to LAN_GET_HWINFO
0x40 0x43 Turnout information LAN_X_TURNOUT_INFO
0x40 0x44 Accessory state information LAN_X_EXT_ACCESSORY_INFO
0x40 (0x61) 0x00 LAN_X_BC_TRACK_POWER_OFF
0x40 (0x61) 0x01 LAN_X_BC_TRACK_POWER_ON
0x40 (0x61) 0x02 LAN_X_BC_PROGRAMMING_MODE
0x40 (0x61) 0x08 LAN_X_BC_TRACK_SHORT_CIRCUIT
0x40 (0x61) 0x12 LAN_X_CV_NACK_SC
0x40 (0x61) 0x13 LAN_X_CV_NACK
0x40 (0x61) 0x82 LAN_X_UNKNOWN_COMMAND
0x40 (0x62) 0x22 State LAN_X_STATUS_CHANGED
0x40 (0x63) 0x21 XBus Version, ID Reply to LAN_X_GET_VERSION
0x40 (0x64) 0x14 CV-Result LAN_X_CV_RESULT
0x40 (0x81) LAN_X_BC_STOPPED
0x40 0xEF Loco information LAN_X_LOCO_INFO
0x40 (0xF3) 0x0A Version (BCD) Reply to LAN_X_GET_FIRMWARE_VERSION
0x51 Broadcast-Flags Reply to LAN_GET_BROADCASTFLAGS
0x60 Loco address, Mode Reply to LAN_GET_LOCOMODE
0x70 Accessory decoder address, Mode Reply to LAN_GET_TURNOUTMODE
0x80 Group index, Feedback status LAN_RMBUS_DATACHANGED
0x84 SystemState LAN_SYSTEMSTATE_DATACHANGED
0x88 RailCom data LAN_RAILCOM_DATACHANGED
0xA0 LocoNet message LAN_LOCONET_Z21_RX
0xA1 LocoNet message LAN_LOCONET_Z21_TX
0xA2 LocoNet message LAN_LOCONET_FROM_LAN
0xA3 Loco address, Result LAN_LOCONET_DISPATCH_ADDR
0xA4 Type, Feedback address, Info LAN_LOCONET_DETECTOR
0xC4 Occupancy message LAN_CAN_DETECTOR
0xC8 NetID, Name Reply to LAN_CAN_DEVICE_GET_DESCRIPTION
0xCA CANBoosterSystemState LAN_CAN_BOOSTER_SYSTEMSTATE_CHGD
0xCD Fastclock Time LAN_FAST_CLOCK_DATA
0xCE Fastclock Settings LAN_FAST_CLOCK_SETTINGS_GET
0xB8 String Reply to LAN_BOOSTER_GET_DESCRIPTION
0xBA BoosterSystemState LAN_BOOSTER_SYSTEMSTATE_DATACHANGED
0xD8 String Reply to LAN_DECODER_GET_DESCRIPTION
0xDA DecoderSystemState LAN_DECODER_SYSTEMSTATE_DATACHANGED
0xE8 0x06 Z_Hw_Info Reply to LAN_ZLINK_GET_HWINFO

Table 2: Messages from Z21 to Clients.

Table footnotes:

  1. z21start: fully functional only with activation code (catalog no. 10814 or 10818).
  2. z21, z21start: virtual LocoNet stack (e.g. GBM16XN with XPN interface).
  3. From decoder FW V1.11.
  4. Z21 → Client: short circuit reported in the appropriate booster/decoder system state. Client → Z21: decoder shows stop aspect if the second bit (0x02) is set in CV38 (10837 only).
  5. Answered by 10838 Z21 pro LINK, not its end device (booster or decoder).
  6. Decoder (LAN_X_SET_TRACK_POWER_ON): turn signal lamps back on (10837 only).