# Programming old LGB locos via Roco z21 and JMRI - my experience



## Andrew_au (Jul 27, 2021)

Summary of my experience & learning trying to program a loco from the "ancient" 70255 LGB starter set using a Roco z21XL and JMRI DecoderPro.

*Setup*

For "ease of configuration", z21 comes with a WiFi router and hard-coded IP address. This ceases to be "easy" as soon as you want to integrate it into your existing WiFi / home network. Unlike almost every other IP device created in the last decade or so, z21 doesn't do DHCP or discovery so you have to manually update its IP address to one that matches your home network.

Note: z21 does not itself do WiFi - only ethernet cable. The WiFi is a home gateway that provides a wired connection to the z21 and a new WiFi network to which you can connect your phone / iPad / other device. This avoids end users needing to understand about ethernet wiring or internet addresses. That is, until they want their phone to do internet at the same time it does z21, and then they _really_ need to understand ethernet wiring and internet addresses.

How I made a z21 play nice with your existing home network:

Find a PC (or Mac or equivalent) with both a wireless and wired ethernet interface
Connect to your home network via wireless. Check the Internet Protocol / IP address of your computer.
Connect to your existing home gateway via its admin web page. Somewhere it will have a range of IP addresses that are assigned via DHCP (e.g 192.168.1.200 - 192.168.1.254). You want to choose an address for the z21 that is in the same _subnet_(e.g. 192.168.1.<something>) but not in the DHCP range. Note: on most networks, the last number needs to be in the range 2-254 (1 is reserved for the gateway, 0 and 255 are special).
If you happen to have a network that uses 192.168.0, you're mostly good. If 192.168.0.111 is in the range of automatically assigned addresses, then there's a slim change you might get conflicts. But for the most part, just plug your z21 into your home network and ignore the rest of the steps since they might break things.

Unplug your wired interface from any network. Manually configure your wired interface to have address 192.168.0.2 (subnet mask 255.255.255.0, leave gateway blank)
Plug the z21 directly into the wired interface with the supplied ethernet cable. The supplied wireless gateway can stay in the box permanently.
Download the z21 maintenance tool from the z21 web site. Run it and connect on the default address.
Update the IP address to the address you chose in step 3. Save. Turn off the z21 and unplug it.
Reset your computer's wired interface to default operation.
Plug the z21 into your main network. You should be able to connect to it using the address you gave it.
Alternative: download the z21 maintenance app, then set up the z21 supplied gateway according to the z21 manual and connect to the z21 to change its address. Then pack away the z21 supplied gateway and move both your computer and the z21 back to the real network.

*Using JMRI DecoderPro with z21*

After doing all that, setting up JMRI is easy. Download and install.

Integration with the z21 worked fine. Start, choose z21 as the control station, put in the IP address you chose, follow the prompts.

*Programming an old-style LGB loco*

This was my experience. Others may have extra advice or corrections.

Key point: The Massoth/LGB 55020 family of decoders uses a non-standard indirection interface via CVs 5 and 6 to write the higher registers.

Only use 'register' address mode. I used it with LocoNet protocol emulation.
Don't try to read any CV past 8 - it won't work. This does mean that you can't read what is in the higher CVs
_Don't_ try to write any CV past 6 directly - it really won't work.
Best way to write is to use single CV mode. Make sure you are set to register addressing.
Find yourself a copy of the LGB 55020 manual. You will need it to know what to write in the higher CVs.
Observations talking to the yellow diesel loco from LGB 70255

CV 8 correctly reports manufacturer 123. CV 7 reports version 1, when according to the JMRI web site it should be at least 10.
Using anything other than 'register' mode gets all sorts of strange values on reading (e.g. the address field kept reading '44'). Only 'register' mode worked sensibly, whether reading or writing.
Writes to registers above 6 are done writing the register ID to register 6, and then the value to register 5. The Roco can write the registers manually in register mode, but doesn't know about the indirection. JMRI DecoderPro doesn't seem to have a way to perform "single step" writes by sending 6/5 write pairs to the z21. So you need to do it all manually using single CV mode.
I couldn't seem to get reset to work (write 55 to register 6, then 55 to register 5). I was able to manually write all the values to factory defaults (or appropriate alternatives) using register indirection.
I set CV 29 to "2". 28 speed steps with default table, no DC support, standard direction.
I also set CV 54 to "1" (allow handoff). Though that probably doesn't matter via the z21.
After manually setting all the values to default, except for the loco address and CV 29, the loco worked normally on the programming track. Have not yet tried it on main.
The need to use register mode probably means that the loco can't be programmed via the z21 app. However, DecoderPro works as long as you only use register mode and don't expect to be able to read back anything above CV 8.


----------



## Andrew_au (Jul 27, 2021)

I should note that I had no physical problem getting the loco to work with the z21 programming track. Issues were all to do with NMRA protocol compatibility & CVs.


----------



## Andrew_au (Jul 27, 2021)

Ok, very strange. Put the steam loco on the programmer today. Came up as 123 (Massoth) version 13, which is different to the diesel. Also, CV 5 had value 255, which is supported on the 55021 interface but not 55020. Updated CV 29 to support 28 speed steps, and then switched back to the diesel and set CV 5 to 255 rather than 127. This rather significantly improved the top speed.

Also set CVs 3 & 4 to 10 and 5 respectively. This makes the train start and stop much more smoothly.

I do see one unusual behaviour. If I am running the diesel forward and then tap the reverse arrow on the z21 interface while the train is moving, the train stalls. I can still control the lights and set forward / reverse (I know this works because the lights switch), but cannot set speed any more.

have not tried it with the steam loco
speculatively have set hand-off to '0'. Will test to see if this makes a difference.
I can reset this by setting the throttle to zero and then lifting the loco off the track and back on.


----------



## Dan Pierce (Jan 2, 2008)

When using the 55020, the first unit was made by LENZ and this is etched on the decoder board. Later on Massoth made the 55020 and has no manufacturer markings. add to that and the Massoth version had several different versions as seen in CV7 for revisions.


----------



## Greg Elmassian (Jan 3, 2008)

I use systems that allow using the different methods of communication in service mode.

Just for reference:

there's address mode (program CV 1)
register mode (really old, similar to address mode, allows access to CV's 1-7)
paged mode (register 6 is an offset to allow access to 4 CVs at a time, cv6=1 registers 1-4 are CVs 1-4, cv6=2, registers 1-4 are really 5-8)
direct mode (similar to paged mode, but faster)



My Zimo system usually figures out which is best.
My NCE system allows you to select which method.

Both systems can normally program anything, but the Zimo has the additional capability to tune the programming voltage/current (Dan I don't remember the details here) in tough situations.

Greg


----------



## Andrew_au (Jul 27, 2021)

Greg Elmassian said:


> there's address mode (program CV 1)
> register mode (really old, similar to address mode, allows access to CV's 1-7)
> paged mode (register 6 is an offset to allow access to 4 CVs at a time, cv6=1 registers 1-4 are CVs 1-4, cv6=2, registers 1-4 are really 5-8)
> direct mode (similar to paged mode, but faster)


I saw all that on the JMRI web site and DCC wiki. As far as I can tell, the system used by LGB / Massoth from the early 2000s is not paged mode, but a hack on top of register mode. I've figured out how to use register mode to blind write these high registers via DecoderPro, but can't figure how to reliably read anything above 8.


----------



## Dan Pierce (Jan 2, 2008)

If I remember correctly the Lenz 55020 decoder could only have cv1-4 programmed on the 55000 mouse system. And the system used by LGB originally had the serial only mouse controller and 55000 central station. 

I have a Zimo system and can change many of the LENZ V2 decoder settings, I just did this with a LGB motor block.

Some interesting info on 55020 decoders:
Some 55020 MTS decoders look different than others. What is the difference?
LGB continuously improve their product line. This includes the MTS Decoders. The main functions of all 55020 decoders are the same. However, there are some slight differences:
- V1 (labeled "LGBE1_V1," rare, only few made): Don`t connect smoke generator directly to the function pins, but use relay as shown in instructions. (I never found the 'LENZ' instructions)
- V2 (labeled "LGBE1_V2"): Connect smoke generator directly to function pins (no matter what the instructions say).
- V3 (labeled "LGBE1_V3"): Same as V2, but using different electronic components.
- ME1-1 (no "V" number, sticker with a serial number): Same as V3, but advanced functions can be programmed.


----------



## Andrew_au (Jul 27, 2021)

The 70255 starter set is MTS-II, but only serial. I haven't been able to track down any official CV information about the decoders, but they behave as if they are LGB 55021 (Massoth) MTS-II decoders, based on defaults for CVs 1-5 and the behaviour when I write certain CVs (e.g. CV 5 scales up to 255 while the spec for the 55020 says it maxes out at 127). I haven't opened the engines up to examine the decoders for markings.


----------



## Greg Elmassian (Jan 3, 2008)

Dan, I stole your 55020 info for my site. I gave you credit of course. I hope this is ok, very interesting data on this old decoder.

Greg


----------



## Dan Pierce (Jan 2, 2008)

It is always OK to take my info and place it on your site. Some of my info was originally in 'LGB' notes, some from other peoples posts.


----------



## Andrew_au (Jul 27, 2021)

Now I'm even more confused. Set up the z21 and JMRI DecoderPro with a programming track and put the steam loco on it. Everything works fine in direct mode - I can read & write all the registers without needing to do anything odd.

For referece: CV 8 = 123, CV 7 = 13, CV 106 = 36.

Also, another useful document: http://reutimann-ch.ch/pdf/onboardCV.pdf - copy of the 2004 document that is no longer on the LGB site listing the CV values supported by the onboard decoders.

Question: does anyone know what values should be set in CV 49/50 (lighting terminal voltage) and 56 (smoke generator voltage) and 57 (smoke generator control)? I speculatively set 49/50 to the defaults for the 55021 (32), but I think they might be wrong. It says that 5V lights should be 5 and 19V lights should be 29. Which does the loco have? And what about the smoke generator?


----------



## Dan Pierce (Jan 2, 2008)

The 70255 came with 2 engines and I have the yellow diesel engine (20900.1). This set is not as ancient as one would think (made in 2006). The diesel engine can be programmed with 128 speed steps and is not the 55020 or 55021 decoder in mine. My address on that loco is 3005, (the number on the side) and is set to 128 speed steps.


----------

