Page 1 of 1

RocNet interface to Märklin Motorola i2c

Posted: 10.04.2010, 20:35
by MatsP
I'm building an interface for the Märklin i2c-port found on the older Märklin digital "boxes". The 6021 in particular, since it supports the "Newer" Motorola format with absolute direction.

To communicate with the device I'm thinking of using the RocNet since it seems easy to work with. What I'm wondering is if it's possible to easily use over USB-RS232 or RS232, since that is what I will be using to connect to the interface.

Anyone with knowledge about the RocNet-protocol please share your thoughts.

I'm also wondering how you can debug the connection between rocrail and any interface, to see exactly what commands are being sent back and forth. I'm using Snow Leopard on a Mac.

Posted: 10.04.2010, 20:58
by rjversluis

I already replied on this posting, but my wireless LAN did send it to the sky. :-(

In short I will support your project to get RocNet running over RS232.
There is another active project with RocNet for running Trains with WLAN decoders... ;-)

Posted: 10.04.2010, 21:26
by MatsP
I'm glad you're interested.
What version of RocRail/RocView should I be using to test with?

Right now I'm setting up the hardware on breadboards.

Posted: 11.04.2010, 07:38
by rjversluis

use the latest 1.4 snapshot to be able to get the latest RocNet enhancements.

Posted: 11.04.2010, 16:26
by MatsP
Now onto the next step. Getting the commands to be sent over USB-RS232 or RS232.

Although I can choose a serial port when setting up the RocNet Controller, it's not that simple I suppose. What would be the simplest thing to do? Change the RocRail source to be able to use both serial/UDP or code up some standalone software to do the translation to serial? I have not looked at the RocRail source.

I have looked at the packets being sent using Wireshark and glanced at sending/receiving multicast messages with python.

Also, the wiki-entry isn't that updated right? I got 8bit packets with group=9 which isnt even on the wiki.

Posted: 11.04.2010, 19:36
by rjversluis
You have to be patient; This is a hobby project. ;-)

Posted: 12.04.2010, 16:39
by rjversluis
Can you use a Ethernet to Serial converter instead of a USB to Serial?

Posted: 14.04.2010, 21:53
by MatsP
I don't know exactly what an Ethernet to Serial converter is. Some custom hardware?

But I have been looking at connecting it directly to ethernet using a ENC28J60. But I'm not exactly sure how you use it with multicast UDP packages.

But anyway, I have made some progress. I can now convert all Switch-commands to the track. I'm using a "converter"-software i put together in Xcode. It also translates the commands to 7-bit extended-version of the protocol. Which I find easier for serial communication and the older Märklin formats.

Next up: Controlling trains.

Posted: 17.04.2010, 23:44
by MatsP
I have now fixed support for driving Trains. The most important feature.

I have detected something that's not really "spot on" with the protocol right now. But maybe it has already been fixed.

Commands in HEX.

Code: Select all

(1)   00004800 01020202 2D05  (Moving forward)
<Click F0 (lights)>
(2)   00004800 01020202 2D05      (1st command, with lights but no dif.) 
(3)   00004800 01020202 2D05      (2nd command, with lights but no dif.)
(4)   00004800 01020303 400004   (All functions command)
<Now I try to change direction, doesn't send correct command.>
(5)   00004800 01020202 2D05
<Try to change direction again.>
(6)   00004800 01020202 2D05
Although i can understand if it's this way because there hasn't been time to work with it.

Posted: 19.01.2011, 10:52
by rjversluis

I fully lost this subject from focus....

Today I added a serial sublib for RocNet: ... et-prot-en