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 nygma  
#1 Posted : 27 February 2019 16:19:18(UTC)
nygma

Hungary   
Joined: 15/04/2015(UTC)
Posts: 64
Location: Budapest, Budapest
Hi Guys,

I would like to play around with CAN-bus with my Marklin controller. I have the CAN-bus Marklin protocol (although in German) but I can't seem to find information on which pins are the CAN L and CAN H lines.

Eventually I would like to connect my CAN-bus device to the connector box (60113) came with MS2, but I also have a CS2 as well, which I would like to use for testing.

Would you be able to tell me where I find the CAN lines on these devices (connector box and CS2)? And where I could purchase these DIN connectors?

Best Regards,
Csongor
Offline Markus Schild  
#2 Posted : 27 February 2019 17:19:52(UTC)
Markus Schild

Germany   
Joined: 14/01/2006(UTC)
Posts: 1,802
Location: Wurttemberg
Hi Csongor,

This should help: http://www.skrauss.de/mo...bahn/canbus_stecker.html

Regards

Markus
Offline nygma  
#3 Posted : 27 February 2019 17:24:55(UTC)
nygma

Hungary   
Joined: 15/04/2015(UTC)
Posts: 64
Location: Budapest, Budapest
Originally Posted by: Markus Schild Go to Quoted Post
Hi Csongor,

This should help: http://www.skrauss.de/mo...bahn/canbus_stecker.html

Regards

Markus


Oh this is wonderful. I want to try it our immediately. Not speaking German makes it hard to find the right German content.

Offline TEEWolf  
#4 Posted : 27 February 2019 18:56:38(UTC)
TEEWolf


Joined: 01/06/2016(UTC)
Posts: 2,465
Originally Posted by: nygma Go to Quoted Post
Originally Posted by: Markus Schild Go to Quoted Post
Hi Csongor,

This should help: http://www.skrauss.de/mo...bahn/canbus_stecker.html

Regards

Markus


Oh this is wonderful. I want to try it our immediately. Not speaking German makes it hard to find the right German content.



Well in the digital centura you get a translation software s well.

https://www.deepl.com/translator

Not easy but it helps, because unfortunately most of the technical descriptions are in German.

But never use a track box 60113 together with any CS! A MS1 or MS2 can always be used together with a CS 2 or CS 3 without the trackbox. The CS does have their own sockest in front of the controller for the Mobile Stations.
Offline nygma  
#5 Posted : 27 February 2019 20:26:29(UTC)
nygma

Hungary   
Joined: 15/04/2015(UTC)
Posts: 64
Location: Budapest, Budapest
I have an outdoor Gauge 1 layout. I am using the MS2 and the connector box there. The connector box is permanently mounted outside in an electrical box. The weather is not great to test there. So for testing I am using the CS2.

I already have an ESP32 development board connected to the CS2 and I can see the CAN messages going back and forth.

I would like to build a physical board to control the switches on my layout. I want physical control, not a computer screen.

I am starting the understand the messages, even though the CS2 does not appear to send the messages in a way it is explained in the documentation.

I am not sure if there is anyone here with some knowledge how these CAN bus messages work.

Regards,
Csongor
Offline Markus Schild  
#6 Posted : 27 February 2019 21:10:52(UTC)
Markus Schild

Germany   
Joined: 14/01/2006(UTC)
Posts: 1,802
Location: Wurttemberg
Hi Csongor,

You know this document: http://www.skrauss.de/modellbahn/CAN_Doku_V101.pdf ?

The connectors can be bought here: http://www.can-digital-b...ys5&modul=28#Mod_Top

Maybe you also could do some reverse engineering from the RAILUINO - project: https://github.com/MBura...tree/master/Railuino/src


Regards

Markus
thanks 1 user liked this useful post by Markus Schild
Offline nygma  
#7 Posted : 27 February 2019 22:18:52(UTC)
nygma

Hungary   
Joined: 15/04/2015(UTC)
Posts: 64
Location: Budapest, Budapest
Originally Posted by: Markus Schild Go to Quoted Post
Hi Csongor,

You know this document: http://www.skrauss.de/modellbahn/CAN_Doku_V101.pdf ?

The connectors can be bought here: http://www.can-digital-b...ys5&modul=28#Mod_Top

Maybe you also could do some reverse engineering from the RAILUINO - project: https://github.com/MBura...tree/master/Railuino/src


Regards

Markus


Thanks. I have a different version of the CAN document, it is titled CAN CS2 Protokoll - 2.0.doc (see attached below). As I said, I am only interested controlling points, via accessory decoders. That is much easier than locos. And CS2 is a great test tool. I modify the layout in the CS2, and see what messages are sent out when I switch the points from straight to diverging. So far I was able to figure out what messages are sent out, where is the flag for MM2 and DCC decoder type and the address. That is pretty much all that is required for the accessory decoders.
I have written a simple program which switches a point every 2 seconds. I can see the point changing on the CS2 screen, so I am assuming that I am doing it right.
Btw, here is the file: cs2CAN-Protokoll-2_0.pdf (958kb) downloaded 135 time(s).
If you see section 4.1 is about the accessory decoder.
When I change the points I am sending out the following CAN message (all in hex)
Message ID: 00 16 77 5e, DLC: 6, message: 00 00 38 1D 01 01 00 00

This will change DCC accessory decoder with address 30 to diverging. According to the documentation, the first 4 bytes of the message which is 00 00 38 1D should be the loc-ID. And the loc-ID for DCC accessory decoder is 00 00 38 00. And byte 5 should be the address. But here byte 4 is the address. I could be reading something wrong, but when I send the same message, I see the point change on the CS2. So I am not sure why the document does not match what I observe.

So far I am testing with the CS2 only. I still need to buy an actual accessory decoder to test all this with a physical device. But I am making some progress and quite happy about it.

Offline kiwiAlan  
#8 Posted : 27 February 2019 23:19:24(UTC)
kiwiAlan

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

Thanks. I have a different version of the CAN document, it is titled CAN CS2 Protokoll - 2.0.doc (see attached below).


The document you list is for the cs2/3, the other one is for the cs1. My understanding is that there are differences between them, but hte cs2/3 understand enough of the earlier version to handle ms1 controllers.

I have a google tranlsate of the CS2 Protokoll 2.0 somewhere. It needs to be read in conjunction with the Marklin document as it doesn't have any of the pictures in it. I'll try and dig it out and attach it tomorrow.

Offline nygma  
#9 Posted : 28 February 2019 07:01:57(UTC)
nygma

Hungary   
Joined: 15/04/2015(UTC)
Posts: 64
Location: Budapest, Budapest
Originally Posted by: kiwiAlan Go to Quoted Post
Originally Posted by: nygma Go to Quoted Post

Thanks. I have a different version of the CAN document, it is titled CAN CS2 Protokoll - 2.0.doc (see attached below).


The document you list is for the cs2/3, the other one is for the cs1. My understanding is that there are differences between them, but hte cs2/3 understand enough of the earlier version to handle ms1 controllers.

I have a google tranlsate of the CS2 Protokoll 2.0 somewhere. It needs to be read in conjunction with the Marklin document as it doesn't have any of the pictures in it. I'll try and dig it out and attach it tomorrow.


Thanks, I was putting this document to Google Translate line-by-line as well, but only section 4.1 about the accessory decoder. Probably I need to go through the beginning of the document as well, to get the fundamentals.
But since it seems to be working already, I am happy so far.
Offline DaleSchultz  
#10 Posted : 28 February 2019 16:42:14(UTC)
DaleSchultz

United States   
Joined: 10/02/2006(UTC)
Posts: 3,997
Originally Posted by: nygma Go to Quoted Post
... But here byte 4 is the address.

First:
could this be due to a confusion of byte numbers and the index of the byte in an array...
For example,

byte 0 to 3 is an ID, byte 4 is an address

that would be 4 ID bytes and the 5th is an address

Second:

I am wondering of the CAN BUS libraries I come across, such as, https://github.com/Seeed-Studio/CAN_BUS_Shield
are referring to the same CAN Bus that we use in the train world.... in which case grabbing such a board would make the job easier....
Dale
Intellibox + own software, K-Track
My current layout: https://cabin-layout.mixmox.com
Arrival and Departure signs: https://remotesign.mixmox.com
Offline nygma  
#11 Posted : 28 February 2019 17:21:39(UTC)
nygma

Hungary   
Joined: 15/04/2015(UTC)
Posts: 64
Location: Budapest, Budapest
Originally Posted by: DaleSchultz Go to Quoted Post
Originally Posted by: nygma Go to Quoted Post
... But here byte 4 is the address.

First:
could this be due to a confusion of byte numbers and the index of the byte in an array...
For example,

byte 0 to 3 is an ID, byte 4 is an address

that would be 4 ID bytes and the 5th is an address

Second:

I am wondering of the CAN BUS libraries I come across, such as, https://github.com/Seeed-Studio/CAN_BUS_Shield
are referring to the same CAN Bus that we use in the train world.... in which case grabbing such a board would make the job easier....


Could be the byte order, but still the documentation says that the first 4 bytes of the message is the Loc-ID. In my case it is 00 00 38 1D and when I change the accessory address, the 1D changes. That is 4th byte. Anyway, since it was German I did not read the entire documentation, just the section on the accessory decoder. So somewhere in the beginning of the document this might be explained already :)

On your second comment: I believe CAN BUS is CAN BUS, so whatever library you have should work. I am using an ESP32 microcontroller board which has the CAN BUS management built in, so I only needed a transceiver chip board which was a few quid from Aliexpress.

I used this post to set up the hardware: http://www.iotsharing.co...sp32-can-interface.html. I am also using almost the same code that was in that post, and it worked like a charm. Just commented out the part which sends the received message back. I am using ESP32 because I plan to enable the built in Wifi later, so this board and my controller will communicate via Wifi for ease of use. At least that is the plan.

Offline DaleSchultz  
#12 Posted : 28 February 2019 18:15:09(UTC)
DaleSchultz

United States   
Joined: 10/02/2006(UTC)
Posts: 3,997
great, I did not realise that the ESP32 also had a CAN BUS! I have been using the ESP8266 for my projects and they are amazing!
Dale
Intellibox + own software, K-Track
My current layout: https://cabin-layout.mixmox.com
Arrival and Departure signs: https://remotesign.mixmox.com
Offline kiwiAlan  
#13 Posted : 28 February 2019 18:56:48(UTC)
kiwiAlan

United Kingdom   
Joined: 23/07/2014(UTC)
Posts: 8,082
Location: ENGLAND, Didcot
OK, here are the files as google provided me ...

CS2 CAN Protocol 2-0 Translated_files.zip (356kb) downloaded 215 time(s).

Users browsing this topic
UnknownOceanSpiders 0.0
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-2024, Yet Another Forum.NET
This page was generated in 0.545 seconds.