Märklin Central Station 2

ContentCommand StationsMärklin CS2 cs2.jpg


Protocol

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.

Protcol description: cs2_can-protokoll_1-0.pdf
Firmware: http://medienpdb.maerklin.de/digital22008/files/GPL/

Tiago Lobo Dias has written a getting started with Rocrail and CS2 manual in Portuguese: rocrail_cs2_pt.pdf

Implementation

The first version has become available in svn4006 which only support the System Stop/Go commands.

In Rocrail development version 1.3, release 340 or higher the following commands have also been implemented and tested:

  • Turnouts
  • Outputs and signals
  • Loc speed, direction and functions f0 - f12 for MM decoders


In release 341 the support of mfx locdecoders is also implemented. 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 decoderaddress. To find the address to fill in the address field on the interface tab of the loc you must first check the locomotive.cs2 file (plain ascii) in the backup directory of the cs2. An mfx fitted loco will have an entry similar to this:
lokomotive
.sid=0×6
.name=my new loc
.adresse=0×53
.typ=mfx
The address you must enter into the loc properties dialog is the sid address. Pay attention, these are hexadecimal numbers, before entering them as address you need to convert them to decimal. For example, a loc has an sid of 0×11, which corresponds to decimal 17. Enter 17 in the address field in the locproperties.

For Rocrail to distinguish between MM and MFX decoders you need to set the protocol on the interface tab of the loc properties: choose motorola for a MM decoder, serverdefined for a mfx decoder.

In Rocrail Air 1.3 all 28 locdecoder functions that Rocrail currently supports can be used.


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.
The addressing is straightforward, the first input on the first unit gets address 1 in Rocrail and from there on counting upwards.


CS2 support under Rocrail Act 1.2
Although the CS2 support became available after the release of Rocrail Act 1.2 a version that does not require changes to the structure of Act 1.2 will be included in the next revision (229 or higher) of Act 1.2. This will have all the features mentioned above with the following exceptions:

Only functions F0 - F12 are implemented.
The command station setup is done with the Ecos dialog by entering the CS UDP broadcast address in the hostname field. the number of S88 feedback units has to be manually set by editing rocrail.ini:
<digint iid=“CS2” lib=“mcs2” fbmod=“0”
Add the fbmod parameter and set this to the appropriate number of 16 input S88 units attached to the CS2.

cs2-back.jpg


Setup

The only parameters to set are the UDP Broadcast address at which the CS2 is configured, CAN-UDP-Gateway, in the hostname field; the ports are fixed and predefined by Märklin:

CS2 Port Direction PC
send 15730 from CAN to Ethernet receive
receive 15731 from Ethernet to CAN send

and the number of 16 input S88 units in the sensors field.


Network settings

The hardest thing most users experience is getting all the network settings right. Especially the setup of subnetmask and broadcast address require some knowlegde 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 everytime 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.

DCC support

With newer firmware versions the CS2 is able to handle DCC decoders also. In Rocrail 1.4, revision 1040 (+) and in Rocrail 1.3 Air, patch 1, Rocrail supports this. To send commands in the proper format, the protocol setting of the object on the interface tab of its properties must be set correctly:
Loc decoder
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.
Accessory decoder
For MM1/2 the protocol must be set to default, for DCC the protocol must be set to NMRA-DCC.

Controlling objects on the CS2

In Rocrail 1.4, revision 1058 (or higher), the CS2 broadcast messages when a switch, a loc function, loc speed or loc 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.


Personal Tools