JMRI Hardware Support - MERG Main Support
Author: Andrew Crosland Oct 2020
Keywords: MERG supports JMRI help support

# JMRI Hardware Support: MERG Main Support Page

- Introduction
- Connecting MERG Hardware
- DCC over CBUS
- Further Support

## Introduction

MERG (Model Electronic Railway Group) hardware supported by JMRI is currently centred around the range of CBUS® kits designed by and for members of MERG.

This page is aimed at helping users of MERG hardware and JMRI to setup their system.

For an overview of CBUS see the separate CBUS help topic.

For JMRI installation issues, see Debugging Your Installation.

## Connecting

### Typical first-time Connection Steps

Launch JMRI and create a new system connection for MERG as the System Manufacturer.

JMRI's general approach is to support as many hardware combinations as possible. By supporting as many people and their hardware desires as possible, we can create a growing community of developers, hence more code. As part of this, the JMRI CAN support is designed to use as many CAN adapter types as possible. Not many PCs have a RS232 serial port now, however is still supported.

Choose the System connection appropriate to your hardware.

Save / Restart JMRI

If you are using DCC over the MERG connection, check that JMRI Preferences > Defaults are set correctly, see DCC over CBUS.

A new menu item MERG appears in the PanelPro or DecoderPro window, containing the MERG tools.
Help > Window Help will show relevant info in the tools and any JMRI window.

Test events can be sent from the Send CAN Frame tool.
Set the test event, eg Frame packets "+1" and / or "-2" (without the quotation marks), waiting 500 msec and click Start Sending to generate steady CBUS network traffic.
Check that these events are actually being sent over the CBUS network by using a module such as a CANACT.

Use an external producer module to test connectivity receiving events, confirming they appear in the CBUS console.

The JMRI System Console is a good tool for diagnosing issues during setup and operation.

## DCC over CBUS with MERG hardware

You do not need to have a DCC layout to use MERG hardware with JMRI. Many DC layouts use MERG hardware for route setting, signalling and track occupancy purposes.

If you are using DCC, JMRI will send and receive the DCC packets over the CBUS network and can be monitored within the CBUS console

Loco sessions are best viewed with the CBUS Command Station Monitor, which displays the sessions in a table format.

There are also a number of DC Command Stations which have been designed by MERG members which use the standard CBUS protocol for requesting and controlling loco sessions.

### Throttles

All of the programs within the JMRI suite (including the JMRI WiThrottle server) internally share the same command station slot for a given loco address, so all of JMRI appears to the command station as a single CANCAB for any single address.

JMRI (via the CBUS Node Manager) can tell if a command station is available which supports the CBUS steal or share feature (eg. supported with CANCMD v4 +).

The Steal / Share features are for when throttles are requested which are already in use by something external to JMRI.

When a JMRI application requests a loco (which is already in a CBUS session), JMRI will check the main Throttles Preferences.

If Silent Steal or Silent Share has been selected, this will be the default action.

If neither have been checked and you are using the main JMRI Throttle, you will be asked if you want to Steal, Share, or cancel.

If you are using an automation script and neither option is checked, the system will attempt to acquire a Share on the session.

The command station may disable or enable steal / share at any point, so even if you have a preferred option, an automation script may attempt to use the non-preferred option to obtain the session.

#### Throttles Stolen from JMRI

When a Throttle session has been stolen / cancelled from outside of JMRI, any open JMRI throttle window for that loco will cease to accept commands, ie throttle slider and function keys greyed out.

If Silent Share is enabled in the Throttle Preferences, and share is available on the Command Station, after a short delay JMRI will attempt to share the throttle.

For most users, silent sharing enables most layouts to operate with minimum of fuss.

If Silent Steal is enabled in the Throttle Preferences, and steal is available on the Command Station, after a short delay JMRI will attempt to steal the throttle back.

Beware of creating Steal loops if more than 1 CAB is capable of auto-stealback! If you find this is happening, disable the Silent Stealing option to stop the loop.

If neither option is enabled, or the steal / share is not possible, a notification will be displayed:

Ticking the checkbox before closing the popup will supress loco steal notifications for the rest of the JMRI session, for all loco sessions.

Relevant information can be viewed in the main JMRI Console log.

Note that not all JMRI applications currently have a method for dealing with a stolen throttle.

#### Dispatch / Release

Dispatch is available according to Command Station Firmware (eg. supported with CANCMD v4 +)

Note that as dispatch availability for a single loco address may change, this will be reflected by button availability in the main JMRI Throttle.

### Consisting

The MERG system allows for advanced consisting to be set using CANCMD and CANCABs.

JMRI Consisting : Advanced Decoder Consisting (Decoder Assisted Consist)

Primary Address Consists are also supported.

### Connecting a MERG DCC Command Station (CANCMD , CANCSB etc.)

On JMRI startup, the CBUS Node Manager can search for command stations.

If a command station responds then it will be added to the node table.

A command station found at startup will also enable the Track Current Meter, available from the main PanelPro > Tools > Track Current Meter.
This listens for extended event 1 from whichever node number command station 0 is set for.

The frequency and other settings for this are within the command station node variables.

Make sure that main JMRI Preferences Defaults are set to your MERG connection for Throttles, Power Control, Command Station, Service Programmer and Ops Mode Programmer.

You can use an existing DCC command station, or have a separate DCC command station for a programming track (eg. a SPROG) by setting these options.

Events do not need to be set up to connect a MERG DCC Command Station CANCMD.

DCC Accessory Decoders can be controlled over CBUS and a CANCMD by creating turnouts with explicit RDCCx Opscode commands, see CBUS hex event naming.
This is also discussed within the CBUS WIKI documentation.

### Programming CV's

Program decoder CV's using DecoderPro

CANCMD fully supports DCC CV programming.

There are definitions within DecoderPro for the MERG CANACC5 and other MERG DCC decoders.

## Further Support

- MERG introduction to CBUS.
- CBUS protocol specification.
- MERG DCC Resources.
- MERG kits for CBUS.
- JMRI Users at Groups.io
- MERG Forum (members only)
- https://github.com/MERG-DEV MERG members' CBUS Development on Github - Much of it is licensed under the GNU General Public License v3.0.
- https://github.com/phillipsnj/mergCbusServer mergCbusServer - enables multiple network connections to a MERG CANUSB4 using Node.js , MIT License.
- https://github.com/amaurial/mergCanBus CBUS implementation for Arduino. (+ have a look at Amauria's other CBUS Github projects)
- http://www.oscale.net/?q=en/cbus CBUS on an Arduino using CAN BUS shields - See download links at bottom (in English + German)
- https://www.npmjs.com/search?q=keywords:MERG node.js modules to create a CBUS module + Class to create a CBUS module conneted via ethernet.
- http://www.rickdavis.co.uk/rail/control-cbus.php Middle Earth Model Railway has over 70 MERG designed CBUS modules installed on it and uses JMRI.

CBUS® is a registered trade mark of Dr Michael Bolton