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 walter__  
#1 Posted : 19 October 2015 16:12:10(UTC)
walter__

Belgium   
Joined: 30/12/2013(UTC)
Posts: 19
Location: Antwerp
Hi all,

After a year of inactivity, I opened the box again to continue upgrading our track with CS2.

Trying to understand the CAN specs, I wrote some apps to send and read the Ethernet traffic between CS2 and PC.
There are 16 S88 cascaded and connected to the CS2 (60215) with Hardware version 5.1, and is now updated to software version 4.1.0 (3).

The connections and ports must be correct as I can command locs and points.

All I found so far is mostly in German, but since my technical German is far from good, and translations frequent fail, I could not make things work.
What I already could determine is that in "layout" there must be a S88 contact numbered at least to the number of modules there is to poll.
So in my case I have a contact number 256 on screen. When its toggled on the CS2, an event (S88) is generated, but when I request the modules with the following command, there is no reply from CS2.

S88 Polling command

The command I tried Prio: 0, Command (incl. Resp.): 0x20, Hash: 0x4711, DLC: 6, Data: 0x00 0x00 0x00 0x00 0x01 0x10 0x00 0x00.

The Hash comes from other examples, and works fine for other commands. As the CS2 is the only device I assume the "Geräte-UID CS2 / S88 Interface" is 0.

Hope someone already has good results with this and can help me out.

Thanks in advance

Walter


P.S. I assume the DLC for the second line is 6, and not 5 (this comes from the CS2 internal website) as indicated.
Offline clapcott  
#2 Posted : 19 October 2015 21:39:21(UTC)
clapcott

New Zealand   
Joined: 12/12/2005(UTC)
Posts: 2,433
Location: Wellington, New_Zealand
Originally Posted by: walter__ Go to Quoted Post

P.S. I assume the DLC for the second line is 6, and not 5 (this comes from the CS2 internal website) as indicated.

Hi Walter,

It has been a while since I played in this area and have yet to revisit it in the context on the L88 capability.

I do recall finding "typos" in the documentation and in most cases I had to sniff the activity while simulating activity from the CS2 itself to achually understand what was trying to be said.

There is also the need to understand that there is both the polling and the direct mechanisms for getting S88

Sorry , I can't be more specific right now - will have to dig out some old bits of sandpit code.


Peter
Offline siroljuk  
#3 Posted : 20 October 2015 10:00:47(UTC)
siroljuk

Finland   
Joined: 29/10/2010(UTC)
Posts: 377
Hello Walter.

I have also tried to learn this CAN-area. Would it be possible you to open your environment a bit. What program language you use?, Please show some lines of your program how you send and read ETHERNET when sending command to locos and points

I´m going to make ARDUINO UNO or Raspberry PI 2 as a main S88 handler with CS2. I have studied in theoretical way how this mus be done but not yet in practice.

Happy Training
Regards

Jukka
Offline walter__  
#4 Posted : 20 October 2015 15:20:11(UTC)
walter__

Belgium   
Joined: 30/12/2013(UTC)
Posts: 19
Location: Antwerp
Hi Jukka,

Quote:
Would it be possible you to open your environment a bit. What program language you use

I am old school programmer still using Borland C++, for the Ethernet connection I use a component by F Piette (ICS) for wsocket.

Quote:
Please show some lines of your program how you send and read ETHERNET when sending command to locos and points

For the moment I am still testing the CAN-bus, so I wrote a small app over the componets demo to send CAN info rather direct.

UDP sender

simple code for button pressed
Code:

void __fastcall TMainForm::SendButtonClick(TObject *Sender)
{

    struct Can {
        byte Prio;
        byte Command;
        short int Hash;
        byte Dlc;
        byte D[8];
    };

    Can c;

    c.Prio = 0;
    c.Command = StrToInt(eCmd->Text);
    c.Hash = StrToInt(eHash->Text);
    c.Dlc = spDlc->Value;
    c.D[0] = StrToInt(eD0->Text);
    c.D[1] = StrToInt(eD1->Text);
    c.D[2] = StrToInt(eD2->Text);
    c.D[3] = StrToInt(eD3->Text);
    c.D[4] = StrToInt(eD4->Text);
    c.D[5] = StrToInt(eD5->Text);
    c.D[6] = StrToInt(eD6->Text);
    c.D[7] = StrToInt(eD7->Text);
    WSocket->Proto = "udp";
    WSocket->Addr  = "255.255.255.255";
    WSocket->Port  = PortEdit->Text;
    WSocket->Connect();
    WSocket->Send(&c, 13);
    WSocket->Close();
}

All inputs can take integer as well as hex values, which I take direct from CS2 info.
Meanwhile I found how the "Geräte-UID" is calculated.. is 0x43433200 + 2 * serial number (CS2)

Quote:
I´m going to make ARDUINO UNO

As we had a major disaster a few years ago (blew up interface and control unit) I created an interface of my own, using an Atmel AtMega 88 in combination with a Ethernet to Serial adapter, so the AtMega can take and understand the old interface info for commanding locs and points and return s88 data. Can help you there with soma code and timing for polling S88 Cool

more info can be found on our website

Greetings,
Walter
thanks 2 users liked this useful post by walter__
Offline siroljuk  
#5 Posted : 22 October 2015 10:00:56(UTC)
siroljuk

Finland   
Joined: 29/10/2010(UTC)
Posts: 377
Hi Walter,
Is it really so that your CS2´s IP-address is 255.255.255.255, seems to me a bit odd.

As far as I understand right, you can poll S88-device´s status, but you cannot send any "commands" to S88 device´s ports. I mean, you cannot change S88-port status via CAN-bus like you can do if you have ports installed in your layout side in CS2.
My German language is also very poor, and I have to use Google Translator. Please read also Rückmelde Event- page from CS2 WEB-server.
At the moment I am trying to translate both pages and try to find out the solution for your problem.
I´ll get back to this later today or tomorrow.

I want to know what exactly you want to do with S88-devices using CAN-bus. I know that you can get information from S88-devices but that information is quite difficult to read and handle, because CS2 gives you information from all S88-devices and all ports at the same time, not from single port.
I might be wrong, but it seems to me to be so.
It is different if you use new S88Link-device. In that device there is some intelligent. At the moment I have very little information about that device. I have it and I have used it, but how to control it using CAN-bus I know nothing. . . yet.

But . . . I am very interested of this and I will study more, let see what we can find out, this will take some time.

Meanwhile Happy Training all you youThumpUp

Regards

Jukka
Offline walter__  
#6 Posted : 22 October 2015 12:06:35(UTC)
walter__

Belgium   
Joined: 30/12/2013(UTC)
Posts: 19
Location: Antwerp
Hi Jukka,

Quote:
Is it really so that your CS2´s IP-address is 255.255.255.255, seems to me a bit odd.

The CS2 its IP address is 192.168.2.102 in my case, but the sender (PC on 192.168.2.101) does a broadcast on port 15731 and all connected equipment (again only CS2 in my case) will "listen" there.
Just like the CS2 does its own broadcast on port 15730, where all other equipment needs to listen in there.

Quote:
I want to know what exactly you want to do with S88-devices using CAN-bus.

Please read also Rückmelde Event- page from CS2 WEB-server.

Basically, the program I wrote to control the trains automatically has no handshaking as it was written for the old interface (6051).. with the crash we had, I converted the program from serial to Ethernet, still with the old commands. This also meant the program polls the S88 units each 333 ms, as in our case they contain block information, like occupied by a train or short circuit.

The idea was to keep the program in polling mode and make a translator app from 6051 commands to CAN commands, hence the tests.

I now also tested the "Rückmelde Events" and they work fine, I can even request the status of the S88 inputs, which I need at program start.
So even it will take me more work, I am going to convert my program from "Polling" to "Event driven" mode.

Of course finding out why the polling on CS2 wont work (for me) is still worth looking into Sneaky and if you need more info, just ask Smile

Greetings
Walter

Offline siroljuk  
#7 Posted : 22 October 2015 16:05:14(UTC)
siroljuk

Finland   
Joined: 29/10/2010(UTC)
Posts: 377
Hello Walter,

Now I have red all possible information from CS2 WEB-server around S88 polling. I am not sure that I have translated all exact right, but I have now understanding that you cannot use the old S88 polling in the latest CS2 program-version. At least it is certainly not advisable (Es wird empfohlen, statt dessen die neuen S88-Events zu nutzen).

I would try to use another command, Read and translate all from this headline ( in CS2´s Web-server)
Rückmeldungen

I think that the new S88LINK-Device have so much intelligence different ways of handling events that Märklin have had to fundamentally change the code that manages contacts.

Please read and translate this also:
System: Basisadresse Rückmelder

I am waiting impatient to Märklin´s latest book, which will hopefully deal with the possibilities of the latest digital devices and software versions. Eventhoug this book is German only.

I´m just starting to test S88LINK and its capabilities. I´ll try to find out how the information to and from this device can be seen in CAN-BUS.
I don´t have any application in my PC with which I could "sniff" ethernet and that is why I use my ARDUINO and its Ethernet-card and piece of software of RAILUINO.

I´ll tell you my findings later this week

Happy Training

Regards

Jukka
Offline walter__  
#8 Posted : 28 October 2015 12:58:29(UTC)
walter__

Belgium   
Joined: 30/12/2013(UTC)
Posts: 19
Location: Antwerp
Hi all,

just for information...

I tested the event mode S88 from CS2 and its satisfactory on our trajects..
Meanwhile the main program has been rewritten for commanding the CS2 over Ethernet CAN, and all works fine (MM2 mode only for now)
Next is changing the "polling" to "event driven" for the part where the trains run automatically.

More info on that later.

greetings,
Walter
Users browsing this topic
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.440 seconds.