JMRI® connects to...
C/MRI
Supported Hardware
Devices, command stations, networks, and protocols:
Applications
By the community of JMRI.org:
Tools
JMRI tools for working with your layout:
Layout Automation
Use JMRI to automate parts of your layout and operations:

JMRI Help:

Contents Index
Glossary FAQ

Donate to JMRI.org

Hardware Support: Chubb Computer/Model Railroad Interface (C/MRI)

Using C/MRI with JMRI

This documentation describes how C/MRI hardware (including microcontrollers emulating C/MRI hardware) can be used with JMRI. It also provides guidance on connecting a C/MRI system to JMRI. It assumes a basic knowledge of JMRI and some familiarity with C/MRI.

If you are using C/MRI hardware, it is highly recommended that you have access to Bruce Chubb's C/MRI User Manual, Version 3.0 which contains detailed hardware documentation not available elsewhere. Since JMRI takes the place of the control software described, you can skip over computer programming details in the manual. Excellent descriptions of various signaling systems and model railroad layout device controls are also presented in Dr. Chubb's manuals.

If you are using microcontrollers such as the arduino to emulate C/MRI hardware, additional information on their use with JMRI can be found on the Using Arduinos with JMRI help page.

The network over which C/MRI hardware communicates with JMRI is called CMRInet. The CMRInet protocol definition is published by the NMRA under the Standards and Recommendations Section, Layout Control Specifications: LCS-9.10 C/MRI Introduction v1.0 (2014.12.01) and LCS-9.10.1 CMRInet v1.1 (2014.12.01).

Note: C/MRI and CMRI (without the slash) are used interchangeably. The C/MRI communication protocol is referred to as CMRInet.

Introduction to C/MRI on JMRI

C/MRI is an object control system of digital input and output lines that can connect a computer to a model railroad layout, allowing computer monitoring and control of various objects on the layout such as turnouts, sensors, signals, lights, and even animations. You may run C/MRI with any train control system, whether DC or DCC. If you are controlling your trains with a train control system that JMRI supports, you can connect your C/MRI system and your train control system to JMRI simultaneously.

Most C/MRI users who use JMRI run with connections to both their C/MRI and their train control system. There are many advantages to doing so. JMRI allows you to "mix and match" how you control and monitor things on your layout. For example, you can switch your Turnouts (track switches) using static decoders on your train control system, and simultaneously use C/MRI inputs to provide Turnout Feedback to JMRI. JMRI is designed to make both connected systems work smoothly together.

PanelPro is the JMRI application most often used to manage a C/MRI system, and is the one used in the examples below. Since all JMRI applications use the same underlying library, it is also possible to run C/MRI functions from DecoderPro. Access to C/MRI system-specific features is via a menu pulldown titled for the specific hardware connection. The picture below shows the C/MRI specific menu pulldown from the PanelPro main screen.

Devices providing the digital input and output lines are called "nodes." Nodes connect to the computer using a serial network or a USB interface. Microcontrollers can be programmed to emulate C/MRI nodes and connect to a computer in a similar manner.

C/MRI inputs are defined in JMRI as 'Sensors', and C/MRI outputs can be defined as JMRI 'Turnouts' or JMRI 'Lights' (see below). Note that C/MRI inputs and outputs are sometimes called 'bits', 'pins', or 'lines'; all refer to the same things.

CMRInet is a polled master/slave system, which means that communicating with C/MRI nodes requires that a "master" computer (in this case, JMRI) periodically sends a message asking each of its "slave" nodes to transmit the status of its input bits (Sensors to JMRI). JMRI allows multiple C/MRI connections to be defined, thus creating multiple "masters" that communicate only with the slave nodes defined specifically to each. JMRI begins to poll a node on a particular C/MRI connection when at least one Sensor has been set up to refer to an input bit on that node. It is this polling action that keeps the network traffic activity LEDs on the nodes flashing at a high rate. JMRI will also transmit data (Turnout and Light state) to nodes to change the state of output bits for that node.

[Go to top of page]

Types of C/MRI Nodes

There are three types of C/MRI nodes; USIC/SUSIC, SMINI, and cpNode [more may be added in the future]. The USIC/SUSIC and SMINI are Classic nodes. The cpNode and other Open Source/DIY offerings, which comply with the CMRInet protocol, are referred to as Open Source Nodes (OSN).

The SUSIC (Super Universal Serial Interface Card) and USIC (Universal Serial Interface Card) are serial controller boards for a large digital I/O systems. A motherboard supports up to 32 digital input and digital output cards, with either 24 or 32 input or output lines per card. The USIC is an older version of the SUSIC.

The SMINI (Super Mini-node) card is a stand-alone serial node providing a fixed 24 input lines and 48 output lines.

Software is generally available for microcontrollers to emulate SMINIs and SUSICs of any size. See Emulating a CMRI node for more information.

The CPNODE (cpNode) is a standalone serial node which provides 16 to 144 input and output lines. The cpNode uses an Arduino Leonardo style microcontroller and is an Open Source Node (OSN).

A number of hardware interface boards are available as part of C/MRI. They all connect to your computer via an SMINI, a SUSIC/USIC, or cpNode. For example, C/MRI's DCCOD occupancy detector board connects to an input port on a node.

Layouts which use C/MRI will commonly have several SMINI's located at different places on the layout, and perhaps one or two SUSIC's located at CTC panels. cpNodes are small physical footprint nodes, which can be distributed around a layout to provide connection to devices clustered in an area. All C/MRI node types, including microcontrollers emulating any of these types, may coexist and interoperate within a CMRInet network.

JMRI libraries have built-in support for C/MRI serial hardware using the SUSIC/USIC, SMINI, and cpNode. Each SUSIC/USIC, SMINI, or cpNode is a serial node capable of communicating independently with a computer via serial I/O. Several C/MRI nodes may be connected together using the RS-485 communication protocol in a daisy chain configuration so that only one serial line into your computer is required. For this to work, each node must have a different unique address set into the address switches on its board, defined in the cpNode Kernel sketch, or specified in the emulation software of a microcontroller. You will need a C/MRI RS-232 to RS-422/485 conversion card or USB to RS-422/485 interface between the RS-422/485 bus connecting the cards and the RS-232 or USB port on your computer (see CMRINet Network Connections below). More than one chain can be defined to JMRI as well with each chain requiring a separate designation within JMRI (see Establishing a C/MRI System Connection in JMRI below).

Each node (SUSIC/USIC, SMINI, or cpNode) needs to receive an initialization string before it can communicate with a computer. JMRI will automatically create and transmit the required initialization string when it starts up, but to make this possible, you need to tell JMRI the details of how your C/MRI hardware is set up. The process of doing this is called "configuring" your C/MRI Node (see below).

Supported Hardware

Note: Some C/MRI output boards can be configured in whole or in part as either ‘current sinking’ or ‘current sourcing’, and you will have to keep track of that to successfully use the outputs. Note also that Current Sinking Outputs are not compatible with the inputs, and will thus cause errors in the CMRI wraparound test available in JMRI.

Limitations

Original Chubb IBEC and UBEC interfaces for older PC system buses (ISA, PCI) are not supported.

[Go to top of page]

Establishing a C/MRI System Connection in JMRI

Before C/MRI objects can be defined, a CMRInet system connection needs to be defined within JMRI. This is done from the Preferences window. A CMRInet connection can be a physical hardware connection via a serial interface (including USB), a network connection via TCP/IP (wired or wireless), or a simulated connection. More than one JMRI system connection can be defined if you have multiple CMRINet connections to your computer (including multiple connections of the same type).

Serial Connection

To create a CMRInet serial connection, open the Preferences window. Click on Connections in the left selection box.

CMRI Prefs - Serial

Select C/MRI in the System manufacturer menu popup. Select Serial from the System connection menu popup.

Under Settings, select the name of the physical serial port on the computer. Either an RS-232 or USB port known to the system can be selected.

"C" is the default Connection Prefix for C/MRI. That is, C/MRI objects will automatically use that prefix in their system name. For example, a C/MRI sensor will have a system name beginning with "CS" ("S" for sensor). The default can be changed if necessary. If you have more than one C/MRI connection, you must use different connection prefixes for each, such as "C2", "C3", etc.

Click on Additional Connection Settings, select the network line speed rate that the C/MRI nodes are configured for.

Click Save to create the serial connection. JMRI will present a dialog window asking if you want to restart.
Click Yes.

Network Connection

To create a CMRInet network connection, open the Preferences window. Click on Connections in the left selection box.

As of Release 4.21.2, problems have been reported in some circumstances using the Network Interface to C/MRI. If you have any issues using this capability, please post them to the JMRI User Group on groups.io.

CMRI Prefs - Network

Select C/MRI in the System manufacturer menu popup. Select Network Interface from the System connection menu popup.

Under Settings, enter the IP Address or Host name of the network connected device. For example, if an arduino is broadcasting C/MRI information via TCP/IP wireless over address "192.168.0.123" enter that. If you have defined a Host Name, say "TrainNode1" for that IP address, then enter that host name.

"C" is the default Connection Prefix for C/MRI. That is, C/MRI objects will automatically use that prefix in their system name. For example, a C/MRI sensor will have a system name beginning with "CS" ("S" for sensor). The default can be changed if necessary. If you have more than one C/MRI connection, you must have different connection prefixes for each, such as "C2", "C3", etc.

Click on Additional Connection Settings and specify the TCP/UDP Port that the CMRINet is broadcasting on. Output interval can be varied if communications problems arise.

Click Save to create the network connection. JMRI will present a dialog window asking if you want to restart.
Click Yes.

Simulator

A Simulator connection is very useful if you are creating a PanelPro panel and do not have actual C/MRI hardware in place or want to test without being connected to your layout. Once you define a C/MRI simulator connection, you can define any JMRI objects as C/MRI objects. As with other connection types, "C" is the default Connection Prefix. A physical and simulator connection using the same Connection Prefix may be defined at the same time, but only one may be active at a time. Use the Disable Connection checkbox to enable or disable a connection.

If you have more than one active C/MRI connection, including simulators, you must have different connection prefixes for each, such as "C2", "C3", etc. You can also define a JMRI Configuration Profile for testing with simulator connections replacing each of your physical C/MRI connections.

To create a Simulator connection, follow the same steps above and select Simulator for the System connection. Be sure to Save after defining Simulator connections.

CMRI Prefs - Sim

[Go to top of page]

Managing Nodes

An SMINI, USIC/SUSIC, or cpNode is called a "node". A node is a point in the CMRInet network where the physical connections for controlled layout equipment is done. Before using C/MRI with JMRI, you must tell JMRI what nodes you have attached to each C/MRI system connection and the configuration of each node.

Each node has a unique node address in the range of 0 to 127. Two nodes on the same C/MRI system connection to JMRI may not have the same node number. However, nodes on different connections may have the same node address since each connection describes a totally separate CMRInet network.

Node addresses are set using switches on the SMINI and USIC/SUSIC boards, by entering the node number into the cpNode software sketch, or as required in the emulation software of a microcontroller. In the C/MRI manuals, node addresses are called the Unit Address (UA).

You can add new nodes or update an existing node's configuration via the main PanelPro window, either by

You will need to save your Preferences after making changes to your node configuration. Use the "Save" button in the Preferences window to do this.

Configuring C/MRI Nodes

CMRInet nodes are created from the Node Configuration Manager window.

C/MRI nodes require certain information be established for proper operation within the CMRInet network. Each node type has some common parameters, and may have specific parameters for initialization and data port mapping.

To open the Node Configuration Manager window from the PanelPro Main menu, select the name of the specific C/MRI connection to get the pulldown. If there is only a single C/MRI connection, that will be C/MRI⇒Configure Nodes. You may also click on the "Configure CMRInet nodes" button in the Preferences window for the specific C/MRI connection.

Any existing C/MRI nodes will be displayed by node address. The serial connection name is displayed with additional configuration information for the node. Clicking on any of the column titles will sort the rows in alphanumeric order.

JMRI assigns numbers sequentially beginning at 1 to input lines and separately to output lines. It does not matter how many input or output "cards" any node has, how many bits are on each card, or whether you have attached sensors to every input line or turnouts or lights to every output line - if the configuration says there are 24 input lines and 48 output lines, that's how many JMRI will assume when it sends a transmission to or receives a transmission from your C/MRI node (in this example, it will send C/MRI messages with 6 bytes of data and expect to receive 3 bytes of data). See below for how to assign and name JMRI sensors, lights, and turnouts to use the desired C/MRI bit.

Adding a Node Definition

To add a node, click the Add Node button at the bottom of the Node Configuration Manger window. The Add Node window will be displayed.

There are parameters, which need to be entered for every node type. These entries are required and some are common to all C/MRI node types. The example below shows the data fields for an SMINI. See the individual sections for creating the specific node definitions.

Clicking on the Done button will close the Node Configuration Window.

A printed list of configured nodes can be provided by clicking on the Print button.

[Go to top of page]

Creating an SMINI Node Definition

Open the Node Configuration Window from either the Preferences window or from the PanelPro main menu, select CMRI⇒Configure Nodes.

Select SMINI from the Node Type popup menu.

Click the Add Node button. The entries are checked for valid data, and if any data errors are present, an error message will be displayed in the Alert Message area.

You must do a Save from the Preferences window for nodes which are added.

[Go to top of page]

Creating a USIC/SUSIC Node Definition

Open the Node Configuration Window from either the Preferences window or from the PanelPro main menu, select C/MRI⇒Configure Nodes.

Select USIC_SUSIC from the Node Type popup menu.

Click the Add Node button. The entries are checked for valid data, and if any data errors are present, an error message will be displayed.

You must do a Save from the Preferences window for nodes which are added, updated, or deleted.

[Go to top of page]

Creating a CPNODE Node Definition

Open the Node Configuration Window from either the Preferences window or from the PanelPro main menu, select C/MRI⇒Configure Nodes.

Add CPNODE

Select CPNODE from the Node Type popup menu.

Click the Add Node button. The entries are checked for valid data, and if any data errors are present, an error message will be displayed.

You must do a Save from the Preferences window for nodes which are added, updated, or deleted.

Creating a CPMEGA Node Definition

CPMega is an updated Version of the CPNode supporting the arduino Mega. It allows 56 bits of onboard I/O and is compatible with I2C expansion boards for a total of up to 184 bits bit per Node.

A separate area within the setup window is used to specify the "onboard" bits. Other than that, this is set up like a CPNODE.

Add CPMega

[Go to top of page]

Editing a Node Definition

Node configuration parameters may be changed by selecting the Edit function from the Node Configuration Manager window.

For the node you want to edit, click on the Select popup column for the node, and select Edit.

The Edit Node window will open and display the configuration for the selected node. The node address cannot be modified. Make the necessary changes, then click on the Update Node button. If there are any data entry errors, an error message will be shown in the "Notes" section of the window. When you are done editing, click on the Done button to close the window.

You must do a Save from the Preferences window for the update to take effect.

Note: When exiting the Node Configuration Manager and changes were made, a warning dialog will be presented reminding you to save your changes from the Preferences window.

[Go to top of page]

C/MRI Input and Output Bits - JMRI Tables

JMRI refers to C/MRI Input bits as Sensors and Output bits as Turnouts or Lights. The definition of Sensors, Turnouts, and Lights is done by adding entries into the appropriate data table. Tables are accessed by selecting from the PanelPro main screen Tools⇒Tables⇒{table name}

A specific input or output bit may be assigned to only one object at a time. If the requested C/MRI bit has already been assigned, JMRI will refuse to associate a new object with that bit. Input bits are only associated with Sensors. Output bits are associated either with Turnouts or Lights, but a particular bit can only be associated with one at a time. When a new Turnout or Light is created, JMRI checks that the specified output bit is available for assignment.

Assigned and unassigned bits can be viewed using the List I/O Bit Assignments tool.

Inputs - Sensor Table

Sensors provide input to JMRI about conditions on the layout; a button is pushed, a block is occupied, etc. When you see a "Sensor" reference, think "input bit" or "input port".

A Sensor may be created in a number of ways, including automatically. All JMRI Sensors which have been created may be viewed in the JMRI Sensor Table, which is accessed by selecting Sensor Table in the Tools menu in the main PanelPro window.

A sensor is created by clicking the Add button at the bottom of the Sensor Table. Creating a Sensor to refer to a specific C/MRI input bit, is called "assigning" that input bit. Each input bit may be assigned only once, i.e. two different Sensors may not refer to the same C/MRI input bit. A Sensor is "active" when its assigned input bit is On and "inactive" when its input bit is Off.

Outputs - Turnout Table

Turnouts are basically on/off switches that JMRI can change to control things on the layout. C/MRI output bits are associated with Turnouts so when you see a "Turnout" reference, think "output bit" or "output port".

For historical reasons, C/MRI output bits used to control signal aspects are referred to as 'Turnouts', even if the output bits are used to control signal mast LEDs or lamps. NOTE: Always use 'Turnouts' for C/MRI outputs used to control Turnouts (track switches) and for C/MRI outputs used to operate signals.

Before you can refer to a Turnout within JMRI, the Turnout must be "created". A new Turnout is created by clicking "Add" at the bottom of that table. A new Turnout is created in the Turnout table as illustrated below. Creating a Turnout to refer to a specific C/MRI output bit, is called "assigning" that output bit. Each Turnout is linked to a specific output line via the address part of the System Name.

Turnouts that have been created may be viewed in the JMRI Turnout Table, accessed by selecting Turnout Table in the Tools menu from the PanelPro main window.

Outputs - Light Table

Similarly, Lights are controlled by C/MRI output bits. When you see a "Light" reference, think "output bit" or "output port". Lights can be created via the Light Table.

The JMRI Light Table is accessed by selecting Lights in the Tools > Tables menu. All JMRI Lights that have been created are listed in the JMRI Light Table. Turnouts and Lights are different methods of referring to C/MRI outputs from within JMRI. Each method has different setup and control options. JMRI refers to C/MRI output bits as Turnouts or Lights. Lights are on/off switches that JMRI can change to control things on the layout.

The JMRI Light Table is accessed by selecting Lights in the Tools > Tables menu. All JMRI Lights that have been created are listed in the JMRI Light Table. Creating a Turnout or a Light to refer to a specific C/MRI output bit, is called "assigning" that output bit. Each Light or Turnout is linked to a specific output line via the address part of the System Name.

Unique Output Bits

A specific output bit may be referred to as a Turnout or a Light, but not both. Each output bit may be assigned only once. When a new C/MRI Turnout or a new C/MRI Light is created, JMRI checks that the specified output bit is available for assignment. If the requested C/MRI output bit is in use by a Turnout or a Light, JMRI will refuse to create the new Turnout or new Light. Note that some C/MRI Turnout control options use two output bits, the addressed one and the next one (see next paragraph), and that both output bits must be unassigned for successful creation of a new Turnout controlled by two output bits.

[Go to top of page]

Forming a JMRI System Name For a C/MRI Bit

System Names, which represent physical C/MRI hardware inputs or outputs, have four components:

c[c]pn[nn]bbb

where:

For example, C2S10024 is a JMRI Sensor, associated with the 24th input bit on Node 10 of C/MRI connection C2. CT8001 is a JMRI Turnout for the 1st output port on Node 8 of C/MRI connection C.

When adding a C/MRI object to a JMRI table, only node address and bit number are entered. Connection prefix and port type are prefixed automatically.

More information on System Names within JMRI can be found here.

Alternate Numbering Scheme for C/MRI System Names

An alternate scheme for numbering in C/MRI System Names was developed to give user access to the full number of lines allowed by C/MRI hardware design. The main numbering system allows access to 999 input and output lines on each node. The C/MRI hardware design, however, supports many more bits for USIC and SUSIC nodes. Most JMRI users will never need this alternate scheme, and should use the main numbering scheme.

The alternate numbering scheme is similar to the main numbering scheme, except the node address and bit number are separated by a "B", and both node address and bit number can range to any value supported by C/MRI. The format is thus:

c[c]pn[nn]Bbbbb

where "B" is the separator between the node number and the bit number, which can now go up to 2048 (depending on how the C/MRI node is defined to JMRI).

For example, C2S10B24 is a C/MRI Sensor, for the 24th input bit on Node 10 on C/MRI connection C2. CT2B1009 is the a C/MRI Turnout for the 1009th output port on Node 2 on C/MRI connection C.

Users may use either numbering scheme interchangeably for line numbers up to 999, but must use the alternate numbering scheme for line numbers greater than 999. For ease in communicating with other users, the main numbering scheme is recommended unless bits greater than 999 need to be addressed.

[Go to top of page]

Creating JMRI Objects to Use With C/MRI

Creating a Sensor Input

To create a sensor input, open the Sensor table by selecting Tools⇒Tables⇒Sensors in the main PanelPro menu. Select "Add" and Select the name of the C/MRI connection from the pulldown list. [See also the Sensors Documentation.]

Sensor Table

Creating a Sensor to refer to a specific C/MRI input bit on a specific node is called "assigning" that input bit. Each input bit may be assigned only once, i.e., two different Sensors may not refer to the same C/MRI input bit on the same node. Enter the node address and the bit number in the Hardware Address field using the numbering scheme discussed above. Do not enter the C/MRI Connection Prefix or the Port type ("S") as those will be prefixed automatically.

Sensors have two hardware states: a Sensor is "active" when the input bit is 1 and "inactive" when its input bit is zero.

Some types of C/MRI hardware may require sensors to be defined for every bit on every active node. This is not, however, a JMRI requirement.

[Go to top of page]

Creating a Turnout Output

Turnouts and Lights are different methods of referring to C/MRI outputs from within JMRI. Each method has different control options. Always use 'Turnouts' for C/MRI outputs used to control Turnouts (track switches) and for C/MRI outputs used to operate signals.

To create a turnout output, open the Turnout table by selecting Tools⇒Tables⇒Turnouts in the main PanelPro menu. Select "Add" and Select the name of the C/MRI connection from the pulldown list. [See also the Turnout Documentation.]

Turnout Table

Creating a Turnout to refer to a specific C/MRI output bit on a specific node is called "assigning" that output bit. Each output bit may be assigned only once, i.e., two different Turnouts or Lights may not refer to the same C/MRI output bit on the same node. Enter the node address and the bit number in the Hardware Address field using the numbering scheme discussed above. Do not enter the C/MRI Connection Prefix or the Port type ("T") as those will be prefixed automatically.

Note that some C/MRI Turnout control options use two output bits, the addressed one and the next one (see next section), and that both output bits must be unassigned for successful creation of a new Turnout controlled by two output bits.

Turnout bits have two hardware states; THROWN for On and CLOSED for Off. These names are in place for historical reasons. When connected to actual switches, Closed can be "Normal" or the straight route and thrown can be interpreted as "Reverse" or the diverging route.

When turnout bits are used on the C/MRI hardware to control signal LEDs or lamps, one turnout (output) bit would be assigned to the connection wire to the LED or lamp. Multi-color (aspect) signal heads would have one output port assigned to each active color LED. When defining signal heads, the defined turnout name for the color is used to associate the LED control wires. See the example on defining signal heads.

Some types of C/MRI hardware may require turnouts to be defined for every bit on every active node. This is not, however, a JMRI requirement.

Turnout Control Options

Turnouts (switches) may be controlled using one or two output bits. When a Turnout is created using the Add option in the Turnout Table, the user is asked whether the Turnout is to be controlled using one or two output bits and whether these should be "steady-state" or "pulsed." The way JMRI responds in each case for C/MRI turnouts is described in the following paragraphs.

The way JMRI responds for turnouts defined with other hardware control systems may be different than for C/MRI. If you are not using C/MRI hardware or protocols, please refer to the Hardware help pages for your particular hardware or protocol.

Turnout Control Bits

With one bit control, THROWN and CLOSED states are controlled by the same bit (see below for how). With two bits, one bit is "On" for THROWN and the other bit is "On" for CLOSED. If both bits are "On" or "Off," nothing is sent to C/MRI. "Steady state" output means the C/MRI bit or bits will be sent once by JMRI. "Pulsed" means that an "On" will be sent when a change in state is requested and then an "Off" one second later, i.e. a pulse is sent. This behavior is particularly important to understand if you are programming a microcontroller to accept and respond to C/MRI transmissions.

Turnout Output Type

There are four possible combinations of number of bits and output selection:

[1 bit, steady-state]

The one output bit is set "Off" for CLOSED (C/MRI manuals call this 'normal') or "On" for THROWN ('reverse'). When setting the output bit, JMRI compares the requested state to the state indicated by the current value of the output bit. If these states are different, then the output bit is set and transmitted as indicated above. If these states are the same, that state is compared to the state indicated by Turnout Feedback. If the states are the same, no transmission take place since the Turnout is already in the requested state. If the states are different, the Turnout was probably changed by some means separate from JMRI.

To ensure the Turnout is actually set to the requested state, the output bit is sent twice as follows:

  • first, it is changed to match the state indicated by the Turnout Feedback,
  • then one second later, it is changed again to match the requested state.

This approach guarantees that a requested change of state causes an actual move in the Turnout for those Turnout control devices that require a change in state to force the move.

[1 bit, pulsed]

If "Use 1 bit" option is used with "Pulsed Output" control, the output bit is "Off" when nothing is happening. When CLOSED or THROWN is requested, this request is compared to the known state of the Turnout (which follows Turnout Feedback). If the known state indicates the Turnout is already in the requested state, nothing is done. If the known state is different from the requested state, then the bit is 'pulsed'. A 'pulse' consists of the bit being turned "On" and transmitted. One second later, the bit is set "Off" and another transmission occurs.

[2 bit, steady-state]

If "Use 2 bits" control is selected, the bit referenced in the Turnout system name and the next bit in sequence are used to control the Turnout. For example, if CT33 has two-output-bit control, the 33rd and 34th bits are used to control the Turnout. If two-output-bit control is selected, the user must select either 'steady state' or 'pulsed' control. Steady state control should be selected for stall motor Turnouts, such as a Tortoise, if it is being controlled according to the recommendation in Chubb's C/MRI User's Manual, Version 3.0, page 3-12. With steady state control, for CLOSED, the first bit is set "Off" and the second bit is set "On"; for THROWN, the bits states are reversed, i.e., the first bit is set "On" and the second bit is set "Off".

[2 bit, pulsed]

If "Use 2 bits" control with "Pulse Output" control is requested, both bits are "Off" when nothing is happening. When CLOSED or THROWN is requested, this request is compared to the known state of the Turnout (which follows Turnout Feedback). If the known state indicates the Turnout is already in the requested state, nothing is done. If the known state is different from the requested state, then the first bit is pulsed if CLOSED is requested, or the second bit is pulsed if THROWN is requested. In either case, a 'pulse' consists of the bit being turned "On" for one second, then returned to the "Off" position.

Note that Turnouts using two-output-bit control can only be created using the "Add" button in the Turnout Table.

Finally, the "inverted" option can be selected. This controls how the C/MRI hardware implements the "On" and "Off" used in the description above. Normally (invert option not selected), "On" refers to a "1" to the hardware; with standard C/MRI hardware, this pulls the output pin down and allows it to sink current. "Off" the corresponds to a "0" to the hardware, turning the output pin off, and causing it to stop sinking current. When "invert" is selected, "On" results in a "0" sent to the hardware, and "Off" results in a "1" being sent. This causes the hardware to act with the opposite polarity.

[Go to top of page]

Creating a Light Output

To create a Lights output, open the Light table by selecting Tools⇒ Tables⇒Lights in the main PanelPro menu. Select "Add" and Select the name of the C/MRI connection from the pulldown list. [See also the Lights Documentation.]

Light Table

Creating a Light to refer to a specific C/MRI output bit on a specific node is called "assigning" that output bit. Each output bit may be assigned only once, i.e., two different Turnouts or Lights may not refer to the same C/MRI output bit on the same node. Enter the node address and the bit number in the Hardware Address field using the numbering scheme discussed above. Do not enter the C/MRI Connection Prefix or the Port type ("L") as those will be prefixed automatically.

[Go to top of page]

CMRInet Network Management Tools

The C/MRI menu contains three tools which are used to manage nodes in a CMRInet network. Controlling the polling of nodes, displaying the operational states of configured nodes, and monitoring the data message traffic on the network are all functions available in the tool suite.

Tools are found under a pulldown menu on the PanelPro and DecoderPro menu bar with the name of the C/MRI connection. In the example below, two C/MRI connections have been defined so two separate pulldown menus are listed.

CMRI Tools on the Menu Bar

CMRInet Network Manager

The CMRInet Manager is selected by selecting the C/MRI Network Manager menu item from the C/MRI menu.

The CMRInet Manager displays the status of each configured node. Polling of individual nodes can be enabled or disabled by checking the Enabled check box for the node. The Status column shows the real time state of the node.

Network Manager Menu

Network Manager

[Go to top of page]

CMRInet Monitor

CMRInet protocol messages can be viewed by selecting C/MRI Monitor from the C/MRI menu in main PanelPro window. The monitor window decodes and formats the CMRInet data message to a readable form. The message traffic is displayed in real time with options selected by the user. The window has a scroll bar which will move the display up or down so messages which are off view can be seen.

The data display may scroll by very quickly, depending upon the network line speed. Clicking on the Freeze Display button will stop the display from scrolling. Data messages will still be collected but not displayed until the Resume Display button is clicked. A text message tag can be inserted into the data display (and log file) by typing the text into the field next to the Add Message button. Click on the Add Message button to insert the text into the display.

Data messages can be captured into a text file and saved for later viewing and analysis. Click on Choose Log File. A file create dialog window will open. Select a file name to save the data, then close the window. This action only creates the file for data capture. Click the Start Logging button to start the collection of data. Clicking Stop Logging will stop the data capture and close the log file.

Monitor Menu

The following screen shows polling with responses for nodes 20 and 21. [See the section below for help in interpreting hexadecimal output.]

Monitor

There are display option checkboxes which provide additional information and formatting for the messages.

If the Show Timestamps check box option is checked, each message is prefixed with the system time in the form of hh:mm:ss:mss.

The message type (e.g. Receive) and node address (ua) are displayed next. The "IB" are the input data bytes. Each byte is displayed as a separate hexadecimal number.

Monitor Poll Timestamp

Here are examples of the Initialization messages for each of the node types.

Init USIC

Init SMINI

The following screen shows the node initialization message sequence for node 20, followed by the node coming on line and responding to polls. The Init message shows the node address (ua) of 20, followed by the node type (NDP) of C which is a cpNode. DL is the delay value, and Opts are node options entered in the node configuration window. A Transmit message follows with the node address (ua) of 20. OB are the output data bytes as hexadecimal values. Polls are seen followed by the poll/response sequence.

Monitor Poll Init

If a node goes off line and stops responding to polls, JMRI will initiate an initialization sequence consisting of five polls. If five polls result in no responses (timeouts) the Init/Transmit message sequence will be done. This poll/init/transmit message sequence is repeated until the node comes back on line.

Monitor Poll Timeout

The following screen shows a poll to node 20, followed by a response, then output bytes sent to the node.

Monitor Transmit

The following screen shows all of the display options enabled. The order of options is:

timestamps as hh:mm:ss:mss, raw data in hexadecimal, data message

Monitor Timestamp

CMRInet messages can be filtered from display by clicking the Filter Packets button. The packet filter window lets you select the nodes and message type to display in the monitor window. The Select Nodes, Select Packets buttons allow for quick select or de-select of the filters. Clicking the Halt Poll button will stop network polling. Clicking Resume Polling will restart polling.

Network Packet Filer

[Go to top of page]

Interpreting Hexadecimal in C/MRI Monitor Output

The CMRI Monitor is a useful debugging tool for advanced JMRI users as it shows all data sent to and received from each connected CMRI node. Data is displayed in hexadecimal format (each digit representing 4 bits with hexadecimal values from 0 to F) so two digits represent a single byte (if the high order bits are all zero, then only a single digit is displayed).

Hexadecimal numbers are used in displaying computer values based on assigning values in terms of powers of 2. Bits are numbered from 0 to 7 within a single byte where bit 7 is the leftmost and bit 0 is the rightmost bit displayed (if bits 4-7 are 0, only one hexadecimal digit will be shown).

Note that the byte values "2", "3" and "10" have special meaning to CMRI (start of text, end of text, and escape). To avoid confusion, an additional byte of "10" is put in the string in front of any other byte whose value is "2", "3" or "10" (see below for examples).

Be aware: JMRI numbers C/MRI bits starting at 1 rather than 0 which may cause some confusion in interpreting the C/MRI Monitor output versus the C/MRI bit assignments. Some devices receiving C/MRI transmission from JMRI, such as the arduino, are programmed to assume bit numbering that starts at zero which is a further source of possible confusion.

To help in interpreting C/MRI Monitor output, here are several examples showing what would be displayed with the corresponding bits set to 1. The examples represents a C/MRI node with 24 bits (three bytes) of either input or output:

C/MRI bits 8, 16, 24 set to 1 display as 80 80 80 (computer bits 7, 15, 23)
C/MRI bits 7, 15, 23 set to 1 display as 40 40 40 (computer bits 6, 14, 22)
C/MRI bits 6, 14, 22 set to 1 display as 20 20 20 (computer bits 5, 13, 21)
C/MRI bits 5, 13, 21 set to 1 display as 10 10 10 10 10 10 (computer bits 4, 12, 20, each preceded preceded by the escape byte value of "10")

C/MRI bits 4, 12, 20 set to 1 display as 8 8 8 (computer bits 3, 11, 19)
C/MRI bits 3, 11, 19 set to 1 display as 4 4 4 (computer bits 2, 10, 18)
C/MRI bits 2, 10, 18 set to 1 display as 10 2 10 2 10 2 (computer bits 1, 9, 17, each preceded by the escape byte value of "10")
C/MRI bits 1, 9, 17 set to 1 display as 1 1 1 (computer bits 0, 8, 16)

If multiple bits are set to 1 within the same byte, then output appears as in these examples:

C/MRI bits 1, 2, 3, 4 set to 1 display as F (computer bits 0, 1, 2, 3)
C/MRI bits 2, 4, 8 set to 1 display as 8A (computer bits 1, 3, 7)
C/MRI bits 1, 2 set to 1 display as 10 3 (computer bits 0, 1, preceded by the escape byte value of "10")
C/MRI bits 3, 4 set to 1 display as C (computer bits 2, 3)
C/MRI bits 3, 4, 6, 7 set to 1 display as 6C (computer bits 2, 3, 5, 6)
C/MRI bits 6, 8 set to 1 display as A0 (computer bits 5, 7)

[Go to top of page]

CMRInet Network Metrics

Anytime the CMRInet is active, a network metrics collector is running in the background. The metrics collected are errors and performance or instrumentation data. CMRInet metrics can be viewed by selecting C/MRI Network Metrics from the C/MRI menu in main PanelPro window

Network Metrics Menu

Each of the Error and Data Metric values can be reset to zero by clicking the appropriate Reset button. All of the metrics can be reset to zero by clicking the Reset All button. Metric data can be saved to a text file by clicking on the Save Metrics button. A file create dialog window will open, enter a file name for the metric data.

Network Metrics

Listing C/MRI Bit Assignments

For each node, you can view a summary list of C/MRI bits that are in use and those that are available.

From the PanelPro main menu, select C/MRI⇒List Assignments, or C/MRI⇒Configure Nodes and then Select⇒Bit Assignments for each node, to bring up the Bit Assignments window. Click "Show Input Bits" or "Show Output Bits" depending on which you are interested in.

List Assignments

List Assignments is useful for checking that you have assigned the correct input and output bits to each Sensor (input) and Turnout or Light (outputs). Each line in the Assignment Table also contains an "address" column showing the node address and bit number as used in the JMRI system name for each C/MRI object. Printing blank assignment lists for each node provides a convenient paper form for use in setting up your input/output bit assignments. The Comment field information for the sensor, turnout, or light is also displayed.

List Bit Assign

[Go to top of page]

Diagnostics

Diagnostics are useful for checking the functioning of your C/MRI hardware. These automated procedures are controlled via a dialog available by selecting Run Diagnostics in the C/MRI menu. Some of the diagnostic tests require external hardware to operate. Chapter 6 of Bruce Chubb's C/MRI User's Manual, Version 3.0, describes a test output card and loopback cable. These items connect to input and output ports on Classic nodes and provide hardware devices which are driven by the diagnostic test code. An integrated test card (IOTEST) from MRCS provides compatible test hardware support.

Test message traffic can be viewed by opening the C/MRI Monitor.

Diagnostics Menu

Diagnostics Main

The C/MRI Diagnostics window has five sections.

Test Node provides a popup menu for the selection of the node to be tested. The menu only displays the addresses of configured nodes for the connection. Node type and card assignment information for the selected node are displayed.

Test Suite has the test selection popup menu which lists available tests. The suggested equipment needed to run the test is also listed. The Halt polling button stops polling of nodes on the connection. Polling should be halted when running diagnostics so as not to interfere with the test sequences.

Test Set Up provides user input fields for data card selection and options for each test suite.

Status displays the progress of the running tests and any error messages related to the test sequences.

Test Control buttons displayed at the bottom of the window control the various test sequences and are specific to each test suite.

Output Test

The Output Test writes a walking bit pattern to the output test card, lighting the LEDs corresponding to the bit pattern. The number of bits written is based upon card size (8, 24, 32). The Output Card number is checked to be a valid defined output card. Observation delay is the number of milliseconds delay between each write. Checking the Invert box flips the state of the bits. This is useful for output cards which drive Common Anode (sinking) devices.

Output test

Loopback Test

The Loopback Test uses a loopback cable connected to a card of outputs and a card of inputs. The test writes a data value pattern to each output port and reads the value from the corresponding input port. The input value is compared to the output value and displays any comparison errors. If a compare error occurs, the test is paused. Clicking the Continue button will write the next value to the output. Observation Delay and Filtering Delay adds time delay intervals to the write and read operations. Invert works the same as in the Output Test.

Loopback

Send Commands

Send Commands provides raw CMRInet packet transmissions to the test node.

Initialize Node transmits an Initialize (I) message to the node. The node would then execute the onboard initialize code.

Poll Node transmits a poll message (P) to the node. The count of input bytes in the response is returned. If the node does not respond to the poll, a timeout error is reported.

Write Bytes transmits (T) the user entered byte string to the output card number. The bytes need to be entered as hexadecimal values separated by a space. The maximum number of bytes written is the defined by size of the card (1, 3, 4). Invert works the same as in the Output Test.

Send commands

[Go to top of page]

CMRInet Network Connections

Using USB-serial adapters

Most C/MRI systems use RS-422/485 electrical signals to communicate between the nodes and the computer. There are several ways to generate them:

1. If your computer has a built-in serial port (RS-232 connection), you can use an RS-232 to RS-422/485 convertor. There's one you can build as part of the C/MRI system, or you can buy a commercial one.

2. If your computer has a USB port, you can buy a commercial USB to RS-422/485 adapter and use that.

3. If your computer has a USB port and you have a RS232 to RS-422/485 convertor, you can install a USB-to-RS232 adapter (sometimes called a "USB-to-serial converter"), then connect the RS232 output of that to the RS232 input of the RS232 to RS-422/485 convertor.

Note that if you're using the Chubb RS232-to-RS-422/485 converter, some USB-to-RS232 adapters will require that you connect certain RS232 control leads that are not handled by the Chubb interface board:

o DSR - DTR (pins 4 & 6 on the DB9 connector)o RTS - CTS (pins 7 & 8 on the DB9 connector)

In all cases, the communications line will end up appearing as a serial port on your computer. In Windows, this is a COM port, in other computers it's a named serial device. You will need to select the proper one when configuring JMRI. If no serial devices appear in the selection popup menu, you may not have any operating system serial device drivers installed.

Using An Ethernet Network Connection

JMRI allows you to connect to C/MRI nodes through a network connection. JMRI communicates via the TCP/IP protocol across a network to a network-to-serial adapter, which converts the network connection to a serial stream that then goes through a RS-422/485 convertor to the C/MRI node(s).

The network-to-serial adapter is sometimes called a "terminal server". It's also sometimes called a "Lantronix box" after an early manufacturer of these, though they're now available from multiple sources. The adapter has to be configured with the correct serial parameters for your C/MRI system, including the proper baud rate and 8-data-bits, no parity. You will probably need a RS232-to-RS-422/485 adapter on the output of the network adapter.

Some hobbyists have also built C/MRI nodes that have native Ethernet connections. JMRI communicates with them via a direct TCP/IP connection using the C/MRI protocol, but in this case there's no need for a RS-422/485 convertor.

To configure JMRI to use a network connection, go to the Preferences screen, Connections tab. After selecting C/MRI for the System Manufacturer, select "Network Interface" for the System Connection. Then enter the IP address (or node name, if it has one) of your network-to-serial adapter in the IP Address / Host Name field. If it uses a non-standard port number, check the Additional Configuration Settings box and enter the port number. Click Save and restart the program.

[Go to top of page]

Running JMRI when disconnected from your C/MRI system

JMRI continually polls the C/MRI hardware for status changes. If one or more C/MRI nodes are not responding, eventually their inputs (Sensors) are set to the UNKNOWN state to indicate that JMRI has lost contact with those devices on the layout.

Although this is the right thing to do when you're really connected to the hardware and trying to operate the layout, it can get in the way if you're running JMRI without your layout connection. You might want to do this, for example, to work on your panels while away from the layout, or while the layout needs to be powered off for some reason.

To accommodate using JMRI without an active layout connection, in the JMRI 2.3.2 release a "C/MRI Simulator" connection was made available in the Preferences.

Please note that this is only meant for users who already have a working C/MRI connection already configured. Please do not try to use the C/MRI simulator before configuring a valid connection to C/MRI hardware, as it will not work.

Once you have your C/MRI connection configured, when your hardware is not available you can just go to the JMRI Preferences, select "C/MRI Simulator", save Preferences, quit and restart. Don't change any other settings!

When the C/MRI hardware is again available, go the JMRI Preferences, select "C/MRI Serial", save Preferences, quit and restart.

[Go to top of page]

PanelPro Signaling Example Using C/MRI

The following is an example of what is needed to create a simple ABS signaling system using an SMINI node and Control Panel Editor (CPE) in PanelPro. The SMINI will be set to node address 15.

The focus of the example is to show the relationship between the input and output ports (bits) on the SMINI and the logical connection to the various JMRI device tables. Only the device table information will be defined. The required Logix and Conditionals will not be described.

The section to be signaled is a classic mainline/passing siding triad. The operating scheme is assumed to be Automatic Block System (ABS), with the trains given written authority to occupy the track segments and operate the switches if needed. Block occupancy and turnout position determine signal aspects. All Stop aspects are Absolute.

Signals, which control the entrance and exit to the siding, will display only Yellow (Approach) and Red (Stop) as it is assumed these are low speed routes.

Rucker section

Sensors are the block occupancy detectors and two fascia toggle switches controlling the turnouts. The detectors will present an Active state when a block is occupied, and Inactive when a block is vacant. The switch controls, will present Inactive for the turnout in Normal, and Active if the turnout is Reverse.

Inputs are assigned to Card 2, ports A0 through B0. The output of block detector BLK78 is connected to SMINI Node 15, Sensor input, Card 2, port A0. The comment field is used to document the physical SMINI port and a description of the track section.

By referring to the port names printed on the SMINI circuit board, the connection is path is fully defined. User Names are used when writing Logix statements. A consistent naming scheme should be adopted for creating easy references in the Logix Conditionals. One should be able to look at a User Name and immediately identify what type of device is connected to the port.

The Sensor table is a live view of the state of the port. For Sensors, applying a signal ground to the port will cause the State to change from Inactive to Active. This technique is a great way to verify if the node is communicating with the Master and that the port assignments match the actual connected device.

Sensor Table

Outputs are defined in the Turnout table. As described earlier, the name "turnout" is historical. Again, just think of turnouts as the output ports. Output states are Closed for Off, and Thrown for On. If the port is connected to an actual turnout, Closed would normally be "Normal" and Thrown would be "Reverse". The "Cmd" column displays the live state of the port. Clicking on the Cmd button will toggle the turnout from Closed to Thrown. This capability can be used to test connections and proper operation of output devices.

Turnout Table

There are two output ports assigned to turnout controller bits. The turnout control bits are assigned to Card 0, ports A0 through C7, and Card 1 port A0. The turnout motor control bit for SW35 is connected to SMINI Node 15, Turnout output, Card 0, port A0.

Six signal masts are required for signaling. Two are dual head with an upper and lower head. LED's are assumed to be the lamps used for aspect illumination. One output bit is required for each color. All LED commons are tied together. Signal mast 80LA is a single head signal.

There are three LEDs in the head; Green, Yellow, and Red. Each wire attached to a color LED must be connected to an output port. The green LED for signal 80LA (SG80LA-G) is connected to SMINI node 15, turnout, bit 10, Card 0, port B1.

Add signal head

Signal mast table

Add signal mast

[Go to top of page]

JMRI and Third Party Help

For more information on C/MRI (including the C/MRI User Manual), please see:

[Go to top of page]