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
|
|
|
|
Joined: 14/01/2006(UTC) Posts: 1,802 Location: Wurttemberg
|
|
|
|
|
Joined: 15/04/2015(UTC) Posts: 64 Location: Budapest, Budapest
|
Originally Posted by: Markus Schild  Oh this is wonderful. I want to try it our immediately. Not speaking German makes it hard to find the right German content.
|
|
|
|
Joined: 01/06/2016(UTC) Posts: 2,465
|
Originally Posted by: nygma  Originally Posted by: Markus Schild  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/translatorNot 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.
|
|
|
|
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
|
|
|
|
Joined: 14/01/2006(UTC) Posts: 1,802 Location: Wurttemberg
|
|
 1 user liked this useful post by Markus Schild
|
|
|
Joined: 15/04/2015(UTC) Posts: 64 Location: Budapest, Budapest
|
Originally Posted by: Markus Schild  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 154 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.
|
|
|
|
Joined: 23/07/2014(UTC) Posts: 8,464 Location: ENGLAND, Didcot
|
Originally Posted by: nygma  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.
|
|
|
|
Joined: 15/04/2015(UTC) Posts: 64 Location: Budapest, Budapest
|
Originally Posted by: kiwiAlan  Originally Posted by: nygma  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.
|
|
|
|
Joined: 10/02/2006(UTC) Posts: 3,997
|
Originally Posted by: nygma  ... 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_Shieldare 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.... |
|
|
|
|
Joined: 15/04/2015(UTC) Posts: 64 Location: Budapest, Budapest
|
Originally Posted by: DaleSchultz  Originally Posted by: nygma  ... 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_Shieldare 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.
|
|
|
|
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!
|
|
|
|
|
Joined: 23/07/2014(UTC) Posts: 8,464 Location: ENGLAND, Didcot
|
|
|
|
|
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.