Service Mode Programming
Summary: Service Mode Programming, also known as Broadcast Programming, should occur on a programming track that must be electrically isolated from your running track.
In Service Mode Programming, the following modes are available:
- Basic Mode
- Advanced Modes
- Physical Register
Most decoders today support the Direct Mode. Many command stations support all these modes to maintain backward compatibility. Be sure to use the proper mode for your decoder.
This is the most basic Service Mode programming technique, where the decoder is instructed to change its own address.
Being able to specify the decoder's address allows even the most basic of command stations to control the most complex decoders. Really basic DCC systems may ask you to specify which throttle you want to use, and set the decoder accordingly.
A sophisticated DCC system will ask you what number you want to use as the address, and write that to the decoder. Most modellers use the locomotive's number as the address to simplify selecting a locomotive.
Address Mode can only read, or verify one register or CV, such as the ones holding the Primary and Extended Address bytes.
|Register Mode Programming - DCCWiki.com|
|5||Basic Configuration: Speed steps, Direction of travel|
|6||Offset, Reserved for use during Paged Mode|
Physical Register Mode
Physical Register Mode is an obsolete method of programming which is not used in current production decoders. Some decoders support this mode for legacy reasons.
Early DCC decoders only possessed a limited number of registers to configure the decoder.
- This mode allows you to program a decoder no matter what state it is in. You do not even need to know the address (hence the danger of programming all your decoders at once). It will also work if the decoder's memory is corrupted.
Physical Register Mode expands on the Address Mode, allowing another seven memory locations (registers) to be accessed. It is an early mode which only allows limited decoder programming.
For a multifunction decoder these registers shown in the table are available.
As multifunction decoders became more sophisticated, the registers available expanded to a full set of 1024. A method was required to to address these additional registers. Paged Mode is the most commonly used programming mode and is the preferred method.
Paged Mode introduced the term "CV" (Configuration Variable).
When Paged Mode is used, Register 6 becomes an offset pointer.
Should register 6 be set to a value of 1, there will be no offset, and registers 1 through 4 remain as is. If the offset pointer is set to a value of 2, registers 1 through 4 will now point to registers 5 through 8. As the offset is increased, the pointers will change accordingly. Not all decoders support this mode, avoid using Paged Mode unless the decoder supports it. The command station should be able to determine if the decoder will support Paged Mode.
To avoid this complex scenario, the software in most command stations hides this from the user. The command station asks for a CV number and performs the complex offset calculations to complete the programming process. While Paged Mode is similar to the Direct CV Mode, it is really a modified form of Register Mode which is slower.
Do not remove the locomotive from the programming track until the programming process has completed. Doing so may prevent older command stations from being able to reprogram the decoder at a later date.
Reading a Decoder in Paged Mode
Paged Mode queries the decoder with "Does CVx have a value of Y?" It continues to increment the value of Y until the decoder acknowledges the value matches the contents of the specified CV. There are only two states: NACK (Not Acknowledge), where the command station times out waiting for a response, or ACK (acknowledge), where the decoder responds. This method can take a long time to read the CV settings of a decoder, as it must step through up to 256 (0,1, 2, 3, 4...... 255) possible combinations.
Paged Mode can be problematic with some DCC Systems. Direct Mode is a better choice, especially with modern decoders. Direct Mode can be up to sixteen times faster than Paged Mode.
Direct CV Programming Mode
- Direct Mode is another mode allowed by the NMRA DCC Recommended Practices.
- Direct Mode is the fastest and most recent mode of programming. Most, if not all decoders made in the past 20 years support this mode.
- Sometimes called Direct Bit Mode
Direct Mode allows writing of individual bits. A CV has up to 256 (28) possible states. In the early days of DCC, with the limited number of registers and their possible values, reading the value of a register was slow, but acceptable. As the number of registers and their possible values increased, the time required increased.
Reading CVs in Direct Mode
Direct Mode is similar to Paged Mode, except when querying a decoder Direct mode asks "Does Bit 'X' of CVx = 1?" It is much faster, as it can read an eight-bit CV with 8 queries instead of a possible 256 reads required by Paged Mode. The command station can then calculate from those responses what the content of CVx is. In the worst case the command station will have to wait for 8 timeouts to occur, or 9 to determine no reply.
The command station will then follow up with a full byte verification to ensure no mistakes occurred. This mode can be up to 50 times faster than the other methods available. With modern decoders, such as the ESU LokSound's 100,000 plus CVs, this makes a difference.
- Direct Mode is the preferred method with ESU decoders, and is much faster.
- If you have a number of ESU decoders, a LokProgrammer is recommended. It is much faster when reading and writing CVs as it uses a proprietary technique.
Service Mode Programming Environment
Programming instructions are broadcast to all multifunction decoders on the track, and every decoder will accept the instructions. This method is dangerous as it will reprogram every multifunction decoder in every vehicle on the layout. It is very easy to make a mistake and set every locomotive to the same address.
This is the reason for the isolated programming track.
- Main article: Programming Track
A programming track is either a dedicated length of track located off the layout or a section of track on the layout which is electrically isolated from the rest of the layout. The booster's programming track outputs connect to it for Service Mode programming. Only the vehicle on the programming track will be programmed.
In this environment, the broadcast packets only go to one decoder. The program track is supplied with a low current. This avoids the possibility of wiring error damaging a decoder. Many decoder manufacturers will recommend programming only on a programming track for this reason.
Safe Mode Programming
Many DCC systems make further attempts to protect a decoder during programming.
To prevent damage should a decoder be wiring incorrectly, a regulated Low Current source is used for programming purposes. In addition, the programming track is only active during programming. At any other time, it will have no power.
The purpose of Service Mode is to allow Customization and testing of decoders.
Service Mode Programming
Service Mode operations should be done on an isolated programming track.
An isolated programming track is essential when using Service Mode programming, as the command station sends a broadcast message to all decoders on the track. If you did not use a programming track, you would essentially reprogram all your decoders, something you most likely do not want to do. By using a programming track, you isolate, or select, the decoder you want (re)program.
- External loads, such as constant lighting, smoke generators and other loads should be switched off. Decoders should shut down any loads connected to them when they enter service mode.
- Service mode operations should take place in a limited power environment. The NMRA specifies no more than 250mA for 100mS. The maximum current may be limited by the programmer using a resistor, but the manufacturer must state that it may not be 100% DCC compatible.
- Decoders equipped with capacitors, such as "keep-alive devices may pose problems. If possible, they should be disconnected prior to programming operations.
- A programming track booster may be required for some sound decoders.
- A Program Track connection may or may not be part of the command station/booster. Boosters which do not have additional connections for the program track use Service Mode on the layout via the track power connection.
Entry and Exit from Service Mode
A decoder is required to enter Service Mode when it receives a Reset Packet followed by a Service Mode packet. The purpose of the reset packets is to wake up the decoder and provide it the energy needed to power up prior to the transmission of programming information.
It cannot act on service mode packets when not in service mode.
The decoder will exit Service Mode, but not enter Operations Mode if:
- A non-service mode instruction packet is successfully received
- Twenty milliseconds have passed since the last valid reset or service mode instruction packet was received
After exiting service mode, the decoder will only re-enter operations mode when it receives a valid operations mode packet that is different from the previous service mode instruction packet. This is done to prevent execution of service mode packets as operations mode packets.
- Service Mode instruction packets have a short address in the range of decimal 112 to 127.
Service Mode also includes a CV Readback capability. The decoder can be read and its settings determined. Not all command stations support readback.
Service Mode Instruction Packets
- Bits are numbered right to left, Bit 0 is the rightmost bit and the Least Significant Bit.
- Long Preamble: The packet will have a preamble of at least 20 bits, to allow the decoder time to process the instructions.
- Power On Cycle: After applying power to the track, the programmer will send at least 20 valid packets before service mode operations commence. This allows the decoder to power up and stabilize. During this time a current draw greater than 250mA lasting more than 100mS after initialization of packet transmissions is considered a fault condition. A decoder should not draw more than 100mA of current, except when processing an acknowledgement.
There is an acknowledgement (ACK) mechanism specified. This allows the decoder to act on instructions regardless of the ability of the programmer to detect the ACK signal. There are two acknowledgement mechanisms defined:
This is defined by the decoder providing an increased load on the programming track, of at least 60mA for 6mS. One method is to apply power to the motor, or a similar load connected to the decoder. Many decoders apply a short burst of power to the motor, causing the locomotive to lurch forward.
The decoder should not send an ACK pulse until all the CV bits have been written into non-volatile memory.
The programmer should scan for the pulse after the end bit of the second service mode instruction packet, or as many packets as needed to send the instructions, as well as the specified decoder recovery time. The programmer must continue to send packets to the programming track (which turns supplies power to the decoder) until the end of the decoder recovery time.