DCCWiki, a community DCC encyclopedia.

Decoders receive commands from throttles or other devices and are responsible for controlling the motor and/or performing certain functions around a layout.

Types Of Decoders

Mobile decoder installed on chassis for testing

Decoders can be grouped into two main categories: mobile and stationary.

Mobile Decoders

Main article: Mobile Decoder

Mobile decoders are typically installed into locomotives or other rolling stock that moves along the rails. This allows control of motors, lights, sound, and other functions. Another term is Multifunction Decoder, indicating it supports a number of functions in addition to motor control, such as lighting effects.

Stationary Decoders

NCE Stationary Decoder - this one is for switches
Main article: Stationary Decoder

Stationary decoders are normally mounted under the benchwork in a "stationary" position. Stationary decoders can be used to control railway switches, structure lights, scene lighting, animation, and signaling.

What Conditions can cause a Decoder to Fail?

The motor has the negative tab soldered to the motor frame, which completes the electrical circuit with the locomotive frame.
  1. ESD can damage a decoder prior to, or during installation
  2. Soldering using an acid flux
  3. Soldering iron which is not ESD Safe
  4. Overvoltage on input (from track)
  5. Failure to isolate the motor from the frame.
  6. Current draw exceeds decoder ratings (wiring short or other overload condition): Be careful when first testing a decoder installation. Put the DCC device on a test track (programming track or section with a 100-ohm series resistor) instead of the main line for testing. If all functions work, and it can move (assuming motor output drive from decoder) at low speed steps, then you should be relatively safe to place it on the main. As always, follow the manufacturer's instructions for testing in addition to the above.
  7. Overheating: Imagine running a black loco in direct sunlight and hauling a heavy load at nearly the limit of the current output of the decoder. Now imagine the decoder only having current limits, and not thermal limits built in. The scenario can also happen if the decoder is installed in an area with little air space. Consider the heat is the only suggestion so far…
  8. Incorrect wiring. It is very important that you check that the motor brushes are not connected to the frame. They must be isolated. Any power source other than the decoder's outputs is a recipe for failure.

What Causes a Decoder to Reset

Decoders are small, task specific computers. Whenever they power up, they run through an initialization process.

Two situations can occur that produce an unexpected result.

Upon powering up, after the microcontroller has initialized, the validity of the decoder’s alterable parameters stored in NV-RAM (Non-Volitile Random Access Memory) is verified by performing a checksum and comparing that to a previously calculated value. If the two values don’t match, the decoder’s operating system decides that the memory has been corrupted and resets those parameters to the factory defaults.

Anytime you alter a CV, the checksum is recalculated and the result is stored in the NV-RAM.

A short circuit can also cause the memory to be scrambled, so when the checksum is done, it results in a fail and the decoder software initiates a reset to factory defaults. Should the previously calculated checksum be corrupted, the same results will occur.

This process is done without warning or user intervention. The checksum only indicates a pass or fail. The decoder cannot determine where the problem(s) are. The only solution is to clear the memory and reset its values to the factory default.

Many decoders require a power interruption to restore the decoder to factory settings when a reset is purposely initiated.

Memory Types

The decoder has two types of memory: The firmware, which is the operating system software for the decoder, and the factory default values, are usually stored in memory that is non-volatile, or permanent. It can be part of the microcontroller’s die, or a separate intergrated circuit. The user values, such as configuration variables are stored in memory that while being non-volitile, can be altered. This alterable memory can be part of the microprocessor die, or a separate IC.

There are many types of memory. The most well known is RAM, or random access memory, which will lose its contents when power is removed. Another form is ROM, or read only memory, which is not affected by power loss. It is programmed at the time of manufacture.

A familiar type of memory is NV-RAM, or Non Volatile RAM. Well known examples would be Compact Flash, SD, or Memory Sticks used for cameras, which do not lose their contents when power is removed. (Note: Eventually they will lose their contents, so don’t rely on them for long term storage. They depend on little capacitors, which eventually lose their charge.)

For this reason, storing a copy of the decoder programming is a good idea. DecoderPro can read the memory and store the contents on your computer, and you can reload them anytime. If you spend a lot of time tweaking, this will save you much grief.

What causes Memory Corruption?

  • One of the most common causes is bad power. If the track voltage is not stable during initialization, this can cause the checksum routine to return an incorrect value, which doesn’t match the stored value.
  • If the layout experiences a short during this routine, and power is interrupted, that can be enough to force a reset.
  • The same can be caused if the locomotive itself is the cause of the short. Power cycling can do interesting things to memory contents.

Should power be interrupted while the locomotive is in operation on a section of track with low voltage or signal quality issues, it can either corrupt the memory, or interfere with the initialization of the decoder causing an error, with the result being a reset to factory defaults.

Reducing the Chances of a Decoder Reset

Good trackwork, proper wiring following the recommended best practices, proper power management and eliminating the cause of shorts goes a long way to prevent random decoder resets from occurring.

Runaway Locomotives

After a successful startup (or a restart), the decoder checks to see if there are digital or analog voltages on the track. If it sees a digital packet, it switches to a digital mode. The NMRA DCC standard defines a number of modes available, under the term “power conversion”. Most decoders only support two modes, DCC and Analog.

If the mode setting in CV29 allows for dual mode (DCC and analog), the decoder will switch from DCC mode to analog. This can happen with a noisy or distorted digital signal, as the decoder cannot determine it is DCC, so it switches to analog.

The Mode Control CV #29 uses bit #2 to indicate if an Alternate Power Source is permitted. If that bit is set to "1", the software will look at CV12, Power Conversion for the mode to use. If CV12 has a decimal value of "1", Analog operation is enabled. In this case the full track power is passed directly to the motor when the decoder switches to Analog mode.

Warning: Setting the Primary Address in CV1 to "0" when CV12 = "1" overrides the Alternate Power Source bit in CV29. A runaway will immediately occur when track power is turned on.

Another cause is intermittent power or a short that is cleared quickly. If the decoder doesn’t have enough of a power interruption to force a restart, it may interpret the signals present as a non-DCC signal. It takes is a distorted or poor power quality signal to do this, and that is often present for a short time after the circuit protector has reconnected the track to the power source.

When this happens the locomotive can run away. There is no control, as it sees full track voltage and since it is in analog mode, that means full throttle ahead. For this reason many modellers will set the decoder to “NMRA Digital Only”. Thus the decoder will only respond to a proper DCC digital packet. It also will not respond to Direct Current voltages when placed on the track of a non-DCC layout.

How to Avoid a Runaway Locomotive

Good trackwork, proper wiring following the recommended best practices, proper power management and eliminating the cause of shorts goes a long way to prevent runaways from occurring.

A runaway is scary, and the only way to stop it is a total shutdown of track power.

Also read the section on Compatibility Issues for technical details on decoder addressing to avoid a runaway.

My DCC Decoder Equipped Locomotive will not Work on a Direct Current (Analog) Layout

If that occurs, the power conversion mode has been set to NMRA Digital Only, so the decoder, while powered up and active, will not apply power to the motor or respond to any changes in throttle settings.

The solution is to change CV29 so it can operate on an analog layout.

This can only be done using a DCC system, so planning is required before moving the locomotive to an analog layout. Many modellers disable the Alternate Power Source setting in CV29 by setting it to "NMRA Digital Only."

See Also

External Links

From the Australian NMRA site:

These refer to JMRI.

Tuning Decoders with Decoder Pro

Setting the Brake Function

Speed Matching a Diesel Tsunami Decoder