- andRoc Android
- Rocweb Browser
- WIO-Control ESP32
- Rocview Tablet
Content → Command Stations → Märklin CS2, CS3
|This library ist deprecated and no longer maintained. Use MBUS instead.|
If not stated otherwise, CS2 settings apply to the CS3 likewise
|2.1.7 - 2.2.0||Problem||Delayed sensor reporting.|
|3.6.2||Problem|| The Sensors are only reported if the Model-time is set to off.
On the CS2 Menu → SETUP → Model-time → Off.
From the menu File → Rocrail properties… is selected and in the following dialogue tab Controller is selected. If the CS2 should be the only command station other command stations possibly listed have to be deleted first. Afterwards from the drop down field New the command station mcs2 is selected and subsequently added by pressing Add. The command station
NEW - mcs2 is highlighted and Properties is pressed. The dialogue CS2 opens:
This dialog is also used for other command stations and contains options which are not used by the MCS2 library.
The name the command station is addressed by. The Interface ID
NEW is overwritten by an appropriate name, e. g. mcs2 in the example above.
The IP-address of the CS2 is entered here. See also Network Settings and Configuring the CS2 below.
If the UDP Ports are set to zero the default will be used:
|send||15730||from CAN to Ethernet||receive|
|receive||15731||from Ethernet to CAN||send|
The number of 16-port feedback modules connected to the CS2.
The device ID used for "Start of Day".
Read also: S88 Feedback Support
This sensor address range is used for query the state at "Start of Day" in case of a CC-Schnitte. Set to zero in case of a CS2.
(CAN command 0x11 with DLC=7.)
For version 2 or higher.
The version must be set to 3 for activating sensor event handling for firmware version 2.0 and higher.
The "Sensors" field will be used once on startup to get the current S88 status.
Direct communication with the CS2. (Default)
Alternative communication using a serial interface like the CC-Schnitte.
The SLCAN option will translate the CAN messages to the Lawicel ASCII format to use with common serial to CAN interfaces like USBTin.
Send every 5 seconds a discover command.
Default disabled for CS2, but can be useful for the unmanaged 'Gleisbox' in combination with a USB-CAN interface.
Binds the UID with a SID and inform the Rocrail server.
A verify will also report a UID/SID to the server.
If no loco is found with set the Identifier equal to the UID a guest loco is created in case the "Create guest on BiDi" is enabled.
Report the power and sensor to the server.
This option is only of interest if more then one CS2 compatible device is defined.
The default activation time for switches and outputs.
Should be left to the default of 10ms.
This is for special CS2 compatible Command Stations like the "Gleisbox" which can not handle high data traffic.
This sleep value will also be used for waiting on the next byte in case of a Serial Type. (CC-Schnitte)
Switch commands are reported back by default.
Disable this option if the switch decoder reports the new switch state back to enable field events.
The CAN based binary protocol over Ethernet is easy to understand and very fast to be evaluated.
The UDP solution makes it possible to connect multiple CS2s and PCs in the same network.
Unfortunately the document below does not describe the message format which are generated by sensors or other field events. Märklin reports that this is all the available documentation.
Tiago Lobo Dias has written a getting started with Rocrail and CS2 manual in Portuguese: rocrail_cs2_pt.pdf
On tab setup of the CS2 the wrench symbol is selected in order to be able to change values. In section IP it has to be chosen whether IP-adresses are assigned automatically by a DHCP-server in the network or if they are set-up manually.
If no DHCP-server is available and generally in case of a manual setup all fields have to completed. The IP-address alone is not sufficient for communication!
In section CAN the gateway has to be set to broadcast. The gateway address (broadcast address) is either set to the broadcast address of the particular network (see Network Settings below). Alternatively, if IP-addresses are set up manually it can be set to the IP-address of the computer on which the Rocrail server is running, .
Note: With some firmware versions if IP-addresses are set up manually it was observed that in some cases the addresses had changed by themselves after restarting the CS2. This should be double-checked.
with manual IP configuration. IP addresses are meant as an example only. Of course other valid (see Network Settings below) combinations are possible.
The IP address of the computer on which the Rocrail server is running is 192.168.178.48 in case of this example.
| IP configuration |
IP-Address: IP-Address of the CS2
IP-Netmask: Subnet mask of the network
IP-Gateway: Address of the gateway, commonly address of the router
DNS-Server: Address of the DNS-server, commonly address of the router
| CAN configuration
Start CAN-Gateway: broadcast
Address: Address of the computer, alternatively broadcast address
of the network (here: 192.168.178.255)
Screen-shots of CS2 with German user interface
Note: This example is based on CS2 software version 2.0.1
The hardest thing most users experience is getting all the network settings right. Especially the setup of subnetmask and broadcast address require some knowledge of TCP/IP. The subnetmask determines which part of the TCP/IP address range belongs to your local network and which part belongs to the host network. The broadcast address is the highest TCP/IP address in your local network.
When you use an TCP/IP(4) address of 192.168.1.100 with a subnetmask of 255.255.255.000 the TCP/IP address range of your local network ranges from 192.168.1.0 to 192.168.1.255, which means that in this case the broadcast address is 192.168.1.255. If you use the same TCP/IP address with a subnetmask of 255.255.0.0 your local network TCP/IP range starts at 192.168.0.0 and ends at 192.168.255.255 (which is then the broadcast address).
Both the network card in your computer and the network settings in the CS2 must be done keeping these rules in mind. They each must have a TCP/IP address that lies in the range of your local network TCP/IP range, they must have identical subnetmasks and the broadcast address set in the CS2 must be the highest TCP/IP address in your local network, based upon the subnetmask set.
More information on TCP/IP addresses and subnetmasks can be found here: http://en.wikipedia.org/wiki/Broadcast_address. In addition there are many network calculators available on the net, one of them is the IP Subnet Calculator.
All this can be forgotten when you use a DHCP server that is able to assign the same TCP\IP address to the same device every time the device asks for a TCP/IP address. If you have a DHCP server that does not have this functionality you run the risk that the CS2 gets a different TCP/IP address from the DHCP server every time it is powered on/connected to the pc, meaning that you have to change the settings in Rocrail accordingly.
MFX decoders require special attention when defining them in Rocrail. The address the CS2 assigns to a new mfx decoder is not based upon the decoder address (Motorola address). To find out the address to fill in the address field on the interface tab of the loco the following steps are needed:
CS2 with current (Dec. 2014) firmware version
CS2 with older firmware
An mfx fitted loco will show an entry similar to this:
lokomotive .sid=0x6 .name=my new loc .adresse=0x53 .typ=mfx
The address to be entered into the loco properties dialog is the sid address. Attention has to be payed as these are hexadecimal numbers. Hence before entering them as address they have to be converted to decimal.
Example: A loco with the sid of 0x11. As 0x11 corresponds to decimal 17, the value to be entered into the address field of the loco properties is 17.
Tip: Conversion of hexadecimal to decimal numbers is fast using Google: If
0x11 to decimalis entered into the search field the first result is
0x11 = 17.
For Rocrail to distinguish between MM and MFX decoders the protocol on the interface tab of the loco properties has to be set as follows: motorola for a MM decoders, serverdefined for a mfx decoders. If manual created, always assign a mfx address > 1.
S88 polling has been implemented in revision 342, using the unofficial polling command. It is working with firmware version 1.05 of the CS2, but since the command is not officially published by Märklin it may change or disappear with another firmware version.
To enable S88 polling the number of 16 input S88 units needs to be set in the controller properties dialog. With a value of 0, the S88 polling is disabled.
Starting with firmware version 2.0 feedback event handling has changed: Polling is no longer supported. Instead the CS2 will broadcast such events, provided "2" is selected in the Version field of the command station properties of Rocrail and
|In the CS2-settings under CAN-Gateway "broadcast" is chosen instead of auto.|
The addressing itself is straightforward, the first input on the first unit gets address 1 in Rocrail and from there on counting upwards.
The device ID reported in sensor events is mapped in the Bus field of the Rocrail sensor addressing; The Bus field must match to activate the sensor event in Rocrail.
See for more information: Can-Digital-Bahn "GleisReporter deLuxe"
Addressing of switches, signals, etc. may be carried out in different ways with Rocrail. For the CS2 the PADA addressing scheme (see also Addressing Accessory Decoders) is recommended.
This is, the address of, e.g. a switch is entered into the field “Port” while the field “Address” remains at 0 (zero). Thus for a switch with address 5 shown on the CS2 in Rocrail Address 0 and Port 5 are entered. Or generally spoken:
Address = 0 and Port = <Address as shown on CS2>
With newer firmware versions the CS2 is able to handle DCC decoders also. To send commands in the proper format, the protocol setting of the object on the interface tab of its properties must be set correctly:
For MM the protcol must be set to motorola, for DCC the protcol must be set to NMRA-DCC, NOT to NMRA-DCC long and for MFX the protcol must be set to Server defined.
For MM1/2 the protocol must be set to default, for DCC the protocol must be set to NMRA-DCC. \
In Rocrail 1.4, revision 1058 (or higher), the CS2 broadcast messages when a switch, a loco function (see advice below), loco speed or loco direction are changed from the CS2 user interface are evaluated and reflected in Rocview. This means that for example when a switch is set from straight to turnout on the CS2, the switch will also change from straight to turnout in Rocrail and Rocview, provided that the switch has been defined in Rocrail.
Note: In order to show changes of loco functions in Rocview option Allow Zero Throttle ID has to be activated.