2010 NMRA Convention - Milwaukee, Wisconsin logo
national train show

Topic 0305051 - Decoder Lock Proposal

AJ Ireland of Digitrax posted a proposal (attached) for a new method of programming multiple decoders in a single locomotive.

This topic was discussed, and several modifications are interspersed with AJ original proposal (see the italic text)

DCC Decoder Lock mechanism:    Monday, May 05, 2003

Summary:

DCC users sometimes want to install more than one decoder in a single locomotive. Common cases are: using separate decoders for motor control and sound generation, and also additional function only decoders. Because these decoders often need to have their CVs adjusted separately, a mechanism is needed to communicate with only one of multiple decoders installed in a locomotive shell, at a time. As a common workaround, it is possible to have several decoders at different CV1 or CV17/18 addresses, but this is cumbersome to operate and is problematic with service mode programming.

This Lock mechanism must be able to:

  1. Do service-mode read and write from a specific decoder, with no need to disconnect other decoders electrically.
  2. Discover the type of decoder(s) present inside a locomotive, without disassembly, and despite multiple decoders being present.
  3. Work with existing DCC systems without modification
Proposal: Using CV15 and CV16 formally assigned by NMRA to Digitrax for Experimental Lock feature development.

CV16 will carry a number from 0 to 7 inclusive. This is called the "ID number". This number identifies a single decoder, so a unique value must be assigned to each decoder in a particular locomotive. Because most users will use this mechanism with decoders that provide different functions, the recommended coding is:

0: Reset value, as shipped

255: Broadcast ID so all decoders can be programmed to the same address at the same time.

De-facto Definitions:

1: Motor decoder

2: Sound decoder

3: Function-only decoder (e.g. for additional lights)

4-7: Reserved for other user choices

CV15 is the "unlock number", 0 to 7 inclusive, and is used to select the decoder that will respond to standard NMRA programming commands in Service and Operations mode programming.

Lock Rule:

When the values in CV15 and CV16 are equal, all CVs in the decoder can be read or written.  When the values in CV15 and CV16 are not equal, only CV15 can be written or read.

Some manufacturers may want to provide a bit in a CV to enable/disable this feature.  If so, that should be in a CV reserved for the manufacturers use, as no NMRA CV has been reserved for this purpose.

[The NMRA will define a CV bit for this purpose.]

Note that a command to reset the decoder to default CV values must not be acted upon unless the CV15 and CV16 values are equal.  This prevents the user from accidentally resetting multiple decoders at the same time, and losing the ability to separately address them.

CV 1 cannot be locked for writing.

To configure decoders at new installation:

Before installing each decoder in the locomotive:

  1. Connect it to the programming track all by itself
  2. Write 8 to CV8 to ensure CV15 and CV16 are both zero
  3. If desired, read CV15 to confirm that the decoder can be addressed
    (This is a read of 0, hence fast)
  4. Write CV16 to the desired ID number, e.g. 2
  5. Write CV15 to the ID number
  6. Configure the rest of the decoder
  7. Disconnect it and install it in the locomotive

Repeat in turn for each decoder to be installed

Note that if the user is installing only one decoder, there is no

need to modify the default values of zero in CV15 and CV16.

To access a decoder after installation:

a) Write the ID of the desired decoder into CV15

b) Read or write other CVs as needed, that will now be executed by the decoder with a matching value in CV16

To identify the decoder(s) present in a locomotive:

a) Write a 0 to CV15

b) Attempt to read a 0 from CV16.

c) If no acknowledge is received, there is no decoder with ID 0.

If an acknowledge is received, a decoder with ID 0 exists.

Repeat this process for ID 1 through 7 to check for those.

Because the ID values are low and only use the 3 least significant bits, a successful read is quite fast. An unsuccessful read, i.e. when the decoder is not present, will take some time on many existing command stations, but eventually give an answer. This can be made faster in the future by having command stations attempt to read just the expected value, instead of 0 to 255, in the absence of an acknowledge.

When a mixture of lockable and "old" non-lockable decoders are present, simply program the lockable decoder(s) and then finally program the "old" decoder. Operations mode programming is effected with the same logic and makes configuration and programming very easy.

Conclusion: This proposal meets all the required and desired properties of a usable decoder lock mechanism.  Of importance is the fact that it works with existing decoders and command stations. Many other methods with greater levels of complexity, flags, sophistication and problems were evaluated, but did not compare to the practicality of this minimalist approach.

Additionally, this has been field-tested in many thousands of decoders of different types over the last 18-months and is separately supported by more than one decoder and software manufacturer. The firmware impact in the decoders is minimal, and is compact and easily added to existing programming algorithms in memory-limited CPUs.

AJ Ireland @ Digitrax Inc.

PS: Special thanks to all the users and others who helped to extensively field-test this over the past 18 months.