User Tools

Site Tools


Märklin Gleisbox

ContentCommand StationsMärklin Gleisbox


The MGBOX is a user defined library based on the MCS2.
No official support.


The MGBOX and MCS2 library are mainly the same. The MGBOX library is primary developed to get easily the used SID for a fresh registered loco when using a Gleisbox and MS2. Rocrail with MGBOX is able to complete a registration for different controlling configurations even without a GUI device.
Configuring the MGBOX library is also nearly the same as configuring the MCS2 library. There are some small differences which are described later.

The MGBOX library is tested with the following different configurations:

  • Gleisbox only (firmware 1.39),
  • Gleisbox MS2 (firmware 1.8* or newer) combination,
  • CS2 with firmware 3.8.1 or newer,
  • CS2 MS2 combination.

In case the MGBOX library does not behave well, create a report on the English CS2 forum and/or simply switch back to the MCS2 library.

Main operating differences:

  • The controlling CS2/MS2 throttle is displayed when operating a loco.
  • The operating values (Volt/Amp/Temp) of the control station are displayed on the statusbar.
  • Basic commandpacket integrity checks, preventing corrupted commands executed.
  • Multiple MS2 support for throttles.
  • Named loco registration. Changed names by MS2 or CS2 during operation are displayed in Rocview after restart.
  • Providing unique names during mfx/m4 registration. Base is the name stored in the decoder. If the name is not unique, the SID number is attached to the stored name. I.e. name (SID)
  • In combination with CS2/CS3 only:
    • CS3 & Link S88 tested → Ok
    • CS3 plus; embedded S88 support.
    • Multiple Link S88 support.
    • PT load monitor in Rocview controller panel.

The only way of removing mfx capable locomotives is by removing them from rocrail.ini first.


Beside the default DCC-28 protocol, support for

  • DCC-14
  • DCC-128
  • DCC-28 long address
  • DCC-128 long address


The Gleisbox has to be connected to Rocrail by an Ethernet-CAN bridge (prefered) or a Serial/USB CAN bridge.
For the correct functioning of the mfx/m4 recognition feature, it is necessary that the option "Create guest on BiDi" is enabled.

To prevent duplicated SID assignments, let all registrations been done by the CS2 or MS2. If only a Gleisbox is used or the MS2 is used in slave mode, Rocrail takes care about the SID assignments.


From the menu File → Rocrail properties… is selected and in the following dialogue tab Controller is selected. Afterwards from the drop down field New the command station mgbox is selected and subsequently added by pressing Add. The command station NEW - mgbox is highlighted and Properties is pressed. The dialogue MGBOX opens:

Options which differ from MCS2 controller library


If enabled, the embedded firmware of the Gleisbox or CS2 is forced to execute a mfx discover at Rocrail startup. A reregistering procedure for all registrated locomotives is enforced.
If disabled a discovery is only performed by the embedded Gleisbox firmware when a new product is detected by the Gleisbox.
Loco discoveries are handled by Rocrail if no MS2 is attached. The main part of the registration process is applying a SID and reading the loco name. If a CS2 is present or MS2 is attached, the procedure is handled by the CS2 or MS2.
When a booster without mfx/m4 feedback capabilities is connected to the Gleisbox, let this option disabled. If disabled the verification part of the registration is not executed by Rocrail. It is still possible to drive the loco's contrary to a failed verification request.
If no mfx feedback is received from the loco on a verify command, the registration will be wiped in the Gleisbox/CS2 firmware and a loco will not respond to any command.
In case of a Gleisbox only or Gleisbox/MS2 configuration with an attached booster without the mfx feedback capabilities, it is possible to register a new loco by placing it on a piece of track directly connected to the Gleisbox. Rocrail detects the new equipment and takes care of the complete registration.
For normal operation let this option unchecked.


Deselected: the bind procedure is followed and processed by Rocrail. Rocrail is passive in the binding process.
Selected: The Bind command will be executed and the product is registered in case of a Gleisbox only configuration. If a CS2/MS2 is connected, the assigned SID is registered. During registration controlled by the CS2/MS2, the procedure is monitored by Rocrail. The product is registered and a loco will be created if the verification is successful.
In case of a CS2 or MS2-Gleisbox configuration it is important not to enable power on the track before Rocrail has been started. Otherwise the registration procedure is finished before Rocrail was able to monitor the loco data.
If no MS2 is connected, Rocrail controls the registration procedure and assigns a SID and request the name of the loco. After a successful registration the Rocrail server is informed and the loco is created in the locolist with the addres of the assigned SID and the stored name as the  Id  for the guest loco.
If no name is found during registration, Rocrail assigns the name mfx-SIDnr.
If a GUI device (ie MS2 or CS2) is used, Rocrail is monitoring the procedure. The product is registered and a loco will be created if the verification is successful.

Report state

Reports the status of the graphical indicators shown in the display on the CS2 or MS2. The information is presented on the right side in the Rocview status bar and displays voltage, current and temperature in tabular format.
Works for both Gleisbox and CS2 (3.8.1 tested or newer). The information is derived from the GFP software, an MS2 is not necessary.
Select only one controller for Report state.


Forces an attached MS2 to slave mode to operate as a throttle with a convenient way to select a locomotive from Rocrail. This operates in the same way as a MS2 is attached to a CS2. Locomotives option must also been checked in the controller dialog.

The registered loco should be saved in a prior Rocrail session to make it visible in the MS2 loco list. Although the entire locomotive list is seen in the MS2, it is only possible to control a locomotive whose interface id corresponds in the locomotive characteristics. In the case of a locomotive without or another defined interface id no data will be received. A newly registered locomotive can be saved by requesting the properties of the locomotive via the right click context menu in Rocview locomotive tab. If necessary add some data and store by selecting Apply and Ok. Don't change the protocol and address settings. Restart Rocrail, the loco is now visible in the list on the MS2.

On the MS2 a locomotive is selected from Rocrail's locolist by the MS2 menu:
<shift> <locosymbol> : New Loco : From Loco List

It is recommended to have the number of functions and the functions for the locomotives correct defined. If not defined the Fn symbol is shown. If the locomotive engine type is correctly defined in Rocrail, the according type symbol for locomotive is automatic displayed on the MS2.

If this option is checked and a CS2 is detected on the CAN bus, this option is denied during program execution.

Hint: If CS2 alike named and numbered icons are used in Rocrail then the icons are (re)mapped to the MS2 icon library. These icons use a nomenclature of FktIcon_%_%%_nn.png where % are characters and nn a consecutive number. These icon names are configured in Rocrail locomotives function tab. If the icons are present and correctly defined, the icon symbols are also shown in the Rocview locomotive throttle function buttons.

The content of the Icon fields:
f0: FktIcon_a_sw_01.png
f1: FktIcon_a_sw_51.png
f2: FktIcon_a_sw_52.png
f3: FktIcon_a_sw_08.png
f4: Fkticon_a_sw_18.png

These configuration shows the throttle:

Note: Scrolling and adding a loco causes heavy traffic on the CAN bus. So it might be a good idea to use a reliable gateway between Rocrail and the MS2/Gleisbox.
If receiving invalid packets on a serial connection, especially when using a CC-schnitte, try to increase the "Command pause" in the controller interface dialog. Or better use an ethernet based gateway. Use the forum to search for experiences. Search with key words: Gleisbox Ethernet.

Note2: If the MS2 is in slave mode, and no CS2 is present, mfx registering/handling must be handled by Rocrail.


Select this when SID assignment is processed by Rocrail i.e. no MS2 or CS2 is used for registering, or the MS2 is used as a slave throttle. This informs the registration process which sids are free. The first free SID is used when registering a new loco.
NB SID 1 is reserved by the protocol for the registration process. Numbering is started at 4.

Feedback unit configuration

Feedback configuration for Version 1 to 3 is the same as for MCS2. Additional is feedback Version 4, an option to enable Link S88 support. Support is limited to 32 Link S88 units each configured with local contacts and the additional feedback units attached to the three external buses. The configuration is taken from the CS2/CS3, therefore a CS2/CS3 has to be present at Rocrail startup. CS3 plus S88 support requires also feedback version 4.
Units represents the number of 16 contacts units direct attached to the S88 bus of the CS2.

cs2/gbox-en.txt · Last modified: 2018/11/12 08:56 (external edit)