Welcome to the forum   
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post in this topic Go to first unread post in this topic
Offline bobyAndCo  
#1 Posted : 20 March 2025 21:47:22(UTC)
bobyAndCo

France   
Joined: 20/02/2024(UTC)
Posts: 20
Location: France - Bretagne
Hello all,

Here's a project that lets you drive MFX locomotives without CS 2/3 or MS2.

UserPostedImage

The hardware base is a 5A control unit developed by the Locoduino group to which I belong. Initially, this control unit was intended for the DCC. https://www.locoduino.org/spip.php?article337

I completely rewrote the software based on a work by Gérald Litzistorf (https://gelit.ch/), who in turn drew on a colossal work by Stefan Skrauss on the MFX protocol: https://www.skrauss.de/m...llbahn/Trackprotocol.pdf

This control unit can be controlled via WiFi or TCP from software such as Rocrail (tested) or any other network management software that respects Marklin's CAN protocol.

Here's a video on how to use it with Rocrail

?si=J3XxasXgv1eZfzvU

The project on Github: https://github.com/BOBILLEChristophe/directMFX_ESP32/tree/main

Don't hesitate to contact us for more information

Christophe
thanks 5 users liked this useful post by bobyAndCo
Offline patnaik  
#2 Posted : 25 March 2025 00:29:42(UTC)
patnaik

United States   
Joined: 22/08/2020(UTC)
Posts: 39
Location: Maryland, Silver Spring
Christophe,

Great work as always! Any chance you can add in other protocols like DCC and MM2? Essentially duplicating the functionality a Gleisbox.

Gopal
Offline rhfil  
#3 Posted : 25 March 2025 03:21:48(UTC)
rhfil

United States   
Joined: 05/09/2014(UTC)
Posts: 674
Location: NEW HAMPSHIRE, Somersworth
Every Marklin mfx locomotive also has a DCC address. Are you driving it with that address and not the mfx address? My understanding is that when a mfx locomotive is registered by a CS3 it is assigned a unique address not already being used by any other loco on that CS3. If you bring the loco to another CS3 it may be assigned a different address. If you examine the cv's of any mfx loco you will find two different addresses for the decoder, a DCC one and a mfx one.
Offline bobyAndCo  
#4 Posted : 25 March 2025 10:03:12(UTC)
bobyAndCo

France   
Joined: 20/02/2024(UTC)
Posts: 20
Location: France - Bretagne
Hello @patnaik & @rhfil,

patnaik : Yes, it is of course possible to extend to the DCC and MM2, these are “just” extra lines of code that require you to spend a little time on them.

rhfil : The process of recognizing and assigning an MFX address is a little complex and needs to be understood.

In DCC, the locomotive address is “hard-written” into the decoder. This address can be modified by CV programming.

For MFX, the “short” address comparable to the DCC address is called Loc-ID by Marklin, not locomotive address but local address. MFX decoders also have an ID which, by definition, is unique for each locomotive. Two apparently identical locomotives, produced at the same time, can be distinguished from each other by their UID.

The UID - LocID pair is specific to each control unit and stored in the control unit. At regular intervals, the control unit sends requests to the rails using this UID - LocID pair.

If the locomotive responds, all is well and nothing more happens. If no locomotive responds, the control unit will send a UNBIND, forcing the locomotive with the UID to delete its Loc-ID, triggering a new identification by the control unit based on this UID-LocID pair.

So, when you go from one CS3 to another, it's a coincidence that the LocID assigned by the first CS3 is also the one registered in the second CS3. And if we go back to the first CS3, it will then create a new Loc-ID which may well be different from the one it had already assigned, because in the meantime it may have assigned it to another locomotive.

In reality, no two addresses (Loc-ID) are ever the same, because 16-bit DCC addresses are in the range 0xC000 to 0xFFFF, while MFX addresses are in the range 0x4000 to 0x7FFF.

So, for example, for address 3, 0xC003 for DCC and 0x4003 for MFX.

As I said, it's a bit complex, but not complicated.

Christophe
thanks 2 users liked this useful post by bobyAndCo
Offline rhfil  
#5 Posted : 25 March 2025 12:31:14(UTC)
rhfil

United States   
Joined: 05/09/2014(UTC)
Posts: 674
Location: NEW HAMPSHIRE, Somersworth
Thanks for taking the effort to make the explanation understandable to a non-expert. I was surprised to accidentally learn that some changes you make to a locomotive are actually recorded in its decoder. I changed the name on one locomotive to comply with a standard used by our club as I had purchased it to donate it to them and noticed that the name change was present when I ran it on a friend's layout with his CS3. I would be curious to learn what other information is retained by the locomotive decoder. I have observed that changes to the functions are not recorded in the decoder but in the locomotive identity within the CS3 that it made the change.
thanks 2 users liked this useful post by rhfil
Offline osoraku  
#6 Posted : 03 April 2025 09:36:19(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Dear Christophe -

I read the code for this project and have a few questions about it. Thank you for generously sharing it. Following our PM exchange, I hope that you can answer a few technical questions about it in particular, and differences between DCC and MFX in general.

1) If I read the code of the directMFX_ESP32 project correctly, you only use RMT for MFX output. There is no way to receive MFX input, and so to use the MFX protocol for loco discovery. Is this a correct reading of the code? If there is no way to read digital signal input from the rails, that also means that it is not possible to read CV values in programming mode.

2) I have been reading the DCC protocol standard. It is based on voltage level changes for specific durations. In it, there is no capability to read DCC signal input from decoders. Rather, DCC uses a completely different, current-based protocol in short intervals when track voltage is switched off to pass data back from decoders. I am sure that there are good engineering reasons for this choice (though it seems to me strange). Is that also true for the MFX protocol, or is that one of the mysteries of MFX that is still not fully understood?

Osoraku
Offline kiwiAlan  
#7 Posted : 03 April 2025 13:49:22(UTC)
kiwiAlan

United Kingdom   
Joined: 23/07/2014(UTC)
Posts: 8,455
Location: ENGLAND, Didcot
Originally Posted by: osoraku Go to Quoted Post
If there is no way to read digital signal input from the rails, that also means that it is not possible to read CV values in programming mode.


The method used for reading DCC decoders on the programming track is different to the method for reading mfx decoders, so you are wrong in your supposition.

To read mfx decoders there is a high frequency signal sent on the track which requires a special circuit in the control unit to detect it.

To read DCC decoders on the programming track the decoder pulses the motor to change the current draw, which is then detected by the command station using the standard current overload detection circuitry, so no special circuit is needed.

Offline bobyAndCo  
#8 Posted : 03 April 2025 14:25:06(UTC)
bobyAndCo

France   
Joined: 20/02/2024(UTC)
Posts: 20
Location: France - Bretagne
Originally Posted by: osoraku Go to Quoted Post

I have been reading the DCC protocol standard. It is based on voltage level changes for specific durations. In it, there is no capability to read DCC signal input from decoders. Rather, DCC uses a completely different, current-based protocol in short intervals when track voltage is switched off to pass data back from decoders. I am sure that there are good engineering reasons for this choice (though it seems to me strange). Is that also true for the MFX protocol, or is that one of the mysteries of MFX that is still not fully understood?


Hello osoraku,

You have to distinguish between two things, programming and the main channel.

For me, reading and writing CV's must be done on a programming channel. kiwiAlan explained the principle well in DCC by current consumption.

With MFX too, CV's are programmed by modulating the channel signal. Only confirmation is by return of an RDS signal. This is the same feedback procedure as for MFX locomotive recognition.

As for the DCC, I think you're mixing up two things. When you talk about the track voltage being cut, you're referring to the CUTOUT, which is the window created by the central unit for RAILCOM feedback, and this is the main track.

Railcom, although it allows you (among other things) to read the locomotive address, is not comparable to MFX recognition. In the case of MFX recognition, once it has been achieved, it cannot be reproduced in general. Railcom, on the other hand, is based on the principle of identifying a locomotive in a given area every 100 milliseconds or so.

In MFX, there is no equivalent to Railcom for identifying a locomotive in a given zone.

For Railcom and the necessary equipment, please refer to an article I wrote here: https://www.locoduino.org/spip.php?article334

Christophe

Offline bobyAndCo  
#9 Posted : 03 April 2025 14:33:31(UTC)
bobyAndCo

France   
Joined: 20/02/2024(UTC)
Posts: 20
Location: France - Bretagne
Originally Posted by: osoraku Go to Quoted Post


1) If I read the code of the directMFX_ESP32 project correctly, you only use RMT for MFX output. There is no way to receive MFX input, and so to use the MFX protocol for loco discovery. Is this a correct reading of the code? If there is no way to read digital signal input from the rails, that also means that it is not possible to read CV values in programming mode.



For MFX feedback with this power plant, I have high hopes for the continuation of what is presented in this thread.

https://www.marklin-user...96-MFX-decoder-addresses

I'm not an electronics engineer and I'll need the electronic schematic and the list of components to work on this MFX feedback.

I know how to decode digital signals in computer processing and I also have the equipment for this.

So I'm renewing my request for these elements and I should be able to propose MFX feedback solutions.

Christophe


Offline kiwiAlan  
#10 Posted : 03 April 2025 15:36:24(UTC)
kiwiAlan

United Kingdom   
Joined: 23/07/2014(UTC)
Posts: 8,455
Location: ENGLAND, Didcot
Originally Posted by: bobyAndCo Go to Quoted Post

In MFX, there is no equivalent to Railcom for identifying a locomotive in a given zone.


Actually there is every reason that mfx could emulate Railcom, but I believe Marklin have not implemented this as they would fall foul of the Railcom patent.

thanks 1 user liked this useful post by kiwiAlan
Offline bobyAndCo  
#11 Posted : 03 April 2025 17:09:48(UTC)
bobyAndCo

France   
Joined: 20/02/2024(UTC)
Posts: 20
Location: France - Bretagne
Originally Posted by: kiwiAlan Go to Quoted Post


Actually there is every reason that mfx could emulate Railcom, but I believe Marklin have not implemented this as they would fall foul of the Railcom patent.



In theory, this is true, but not in practice.

It wouldn't be very difficult to insert a COUTOUT into the MFX track signal. But MFX decoders are not Railcom-compatible. They won't send any information.

Some TRIX decoders (i.e. MFX and DCC) are Railcom-compatible. But their Marklin equivalents are not. This is certainly due to licensing issues with Lenz.

For example, I own the 241 A 004 from Marklin which is DCC but not Railcom and the same one from Trix which is compatible.

https://www.marklin.fr/p...08b4ead3f85b68417017d365

https://www.trix.de/en/p...ts/details/article/25241

You can add a small electronic circuit to the loco (not Railcom compatible) which you program like a decoder.

https://kieskemper-shop....-Inhalt/a51257150_u1160/

But even if you insert a CUTOUT in the MFX track signal, I think there will be another problem that will be difficult to solve. The CUTOUT is an absence of power for about 450µSec. Railcom-compatible DCC decoders “compensate” for this absence of current by means of a capacitor, because it takes current to store Railcom information at this point!

Christophe
thanks 1 user liked this useful post by bobyAndCo
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

| Powered by YAF.NET | YAF.NET © 2003-2025, Yet Another Forum.NET
This page was generated in 0.739 seconds.