Coder Social home page Coder Social logo

railroad's Issues

CAN2ETH

Hi GBert,
Is this project only support UDP? is it possible to do bidirection communication by TCP2CAN and CAN2TCP ?
Thank you verymuch!

build-files & howto missing

Hello,

I tried to build a fresh checkout, but the build failes immediatly. It seems some files of the build-framework (make) have not been committed yet.

The file $(TOPDIR)/rules.mk missing
The file $(INCLUDE_DIR)/package.mk missing, too.
For example, these file are referenced by ./can2udp/Makefile.

Please commit the missing files to the repo, and please add a short howto of the required environment variables.

Cu, Frank

Probleme mit Steuerung durch railcontrol und can2lan (RPi 1 Modell B, Waveshare 2-CH CAN HAT, Gleisbox)

Guten Tag,
ich habe die Anweisungen aus https://www.stummiforum.de/t148950f7-RE-Raspberry-Pi-CAN-Interface-zur-Gleisbox-Anbindung.html#msg2223890 befolgt.
Der can2lan service läuft und mit railcontrol kann ich auch korrekte CV-Werte von der Lok lesen.
Was jedoch nicht funktioniert ist die manuelle Steuerung der Lok über railcontrol.

Hier ist der Datenverkehr den ich mit can-monitor lese (Fahrstrom wird eingeschaltet und Fahrtregler wird erhöht, DCC-Adresse der Lok ist 3):

14:36:37.712   CAN  0x0030776C  [0]                         Ping Anfrage
14:36:37.713   CAN  0x00319346  [8] 47 46 81 D4 01 29 00 10 Ping Antwort von Gleisbox UID 0x474681D4, Software Version 1.41
14:36:45.788   CAN  0x0000776C  [5] 00 00 00 00 01          System: alle Go
14:36:45.788   CAN  0x00019346  [5] 00 00 00 00 01          System: alle Go
14:36:45.819   CAN  0x00030300  [6] 73 EB 1B FF 19 00       Lok Discovery - 0x73EB1BFF Range 25 ASK 0
14:36:45.927   CAN  0x00030300  [6] 73 EB 1B 7F 19 00       Lok Discovery - 0x73EB1B7F Range 25 ASK 0
14:36:46.048   CAN  0x00030300  [6] 73 EB 1B FF 19 00       Lok Discovery - 0x73EB1BFF Range 25 ASK 0
14:36:46.169   CAN  0x00030300  [6] 73 EB 1B 7F 19 00       Lok Discovery - 0x73EB1B7F Range 25 ASK 0
14:36:46.290   CAN  0x00030300  [6] 73 EB 1B FF 19 00       Lok Discovery - 0x73EB1BFF Range 25 ASK 0
14:36:46.363   CAN  0x00030300  [6] 73 EB 1B 7F 19 FF       Lok Discovery - 0x73EB1B7F Range 25 ASK 255
14:36:46.437   CAN  0x00030300  [6] 73 EB 1B 7F 1A FF       Lok Discovery - 0x73EB1B7F Range 26 ASK 255
14:36:46.506   CAN  0x00030300  [6] 73 EB 1B 7F 1B FF       Lok Discovery - 0x73EB1B7F Range 27 ASK 255
14:36:46.584   CAN  0x00030300  [6] 73 EB 1B 7F 1C FF       Lok Discovery - 0x73EB1B7F Range 28 ASK 255
14:36:46.662   CAN  0x00030300  [6] 73 EB 1B 7F 1D FF       Lok Discovery - 0x73EB1B7F Range 29 ASK 255
14:36:46.803   CAN  0x00030300  [6] 73 EB 1B 7F 1E 00       Lok Discovery - 0x73EB1B7F Range 30 ASK 0
14:36:46.881   CAN  0x00030300  [6] 73 EB 1B 7B 1E FF       Lok Discovery - 0x73EB1B7B Range 30 ASK 255
14:36:46.959   CAN  0x00030300  [6] 73 EB 1B 7B 1F FF       Lok Discovery - 0x73EB1B7B Range 31 ASK 255
14:36:47.036   CAN  0x00030300  [6] 73 EB 1B 7B 20 FF       Lok Discovery - 0x73EB1B7B Range 32 ASK 255
14:36:47.053   CAN  0x00030300  [5] 73 EB 1B 7B 20          Lok Discovery - 0x73EB1B7B Protokoll mfx Range 0 - 32
14:36:47.712   CAN  0x0030776C  [0]                         Ping Anfrage
14:36:47.715   CAN  0x00319346  [8] 47 46 81 D4 01 29 00 10 Ping Antwort von Gleisbox UID 0x474681D4, Software Version 1.41
14:36:49.071   CAN  0x0008776C  [6] 00 00 C0 03 03 FF       Lok dcc-3 Geschwindigkeit: 102.3
14:36:49.073   CAN  0x00099346  [6] 00 00 C0 03 03 FF       Lok dcc-3 Geschwindigkeit: 102.3
14:36:49.429   CAN  0x00030300  [6] 7F FF FF FF 03 FF       Lok Discovery - 0x7FFFFFFF Range 3 ASK 255
14:36:49.507   CAN  0x00030300  [6] 7F FF FF FF 04 FF       Lok Discovery - 0x7FFFFFFF Range 4 ASK 255
14:36:49.648   CAN  0x00030300  [6] 7F FF FF FF 05 00       Lok Discovery - 0x7FFFFFFF Range 5 ASK 0
14:36:49.726   CAN  0x00030300  [6] 77 FF FF FF 05 FF       Lok Discovery - 0x77FFFFFF Range 5 ASK 255
14:36:49.867   CAN  0x00030300  [6] 77 FF FF FF 06 00       Lok Discovery - 0x77FFFFFF Range 6 ASK 0
14:36:49.945   CAN  0x00030300  [6] 73 FF FF FF 06 FF       Lok Discovery - 0x73FFFFFF Range 6 ASK 255
14:36:50.023   CAN  0x00030300  [6] 73 FF FF FF 07 FF       Lok Discovery - 0x73FFFFFF Range 7 ASK 255
14:36:50.101   CAN  0x00030300  [6] 73 FF FF FF 08 FF       Lok Discovery - 0x73FFFFFF Range 8 ASK 255
14:36:50.179   CAN  0x00030300  [6] 73 FF FF FF 09 FF       Lok Discovery - 0x73FFFFFF Range 9 ASK 255
14:36:50.256   CAN  0x00030300  [6] 73 FF FF FF 0A FF       Lok Discovery - 0x73FFFFFF Range 10 ASK 255
14:36:50.334   CAN  0x00030300  [6] 73 FF FF FF 0B FF       Lok Discovery - 0x73FFFFFF Range 11 ASK 255
14:36:50.475   CAN  0x00030300  [6] 73 FF FF FF 0C 00       Lok Discovery - 0x73FFFFFF Range 12 ASK 0
14:36:50.553   CAN  0x00030300  [6] 73 EF FF FF 0C FF       Lok Discovery - 0x73EFFFFF Range 12 ASK 255
14:36:50.631   CAN  0x00030300  [6] 73 EF FF FF 0D FF       Lok Discovery - 0x73EFFFFF Range 13 ASK 255
14:36:50.772   CAN  0x00030300  [6] 73 EF FF FF 0E 00       Lok Discovery - 0x73EFFFFF Range 14 ASK 0
14:36:50.850   CAN  0x00030300  [6] 73 EB FF FF 0E FF       Lok Discovery - 0x73EBFFFF Range 14 ASK 255
14:36:50.927   CAN  0x00030300  [6] 73 EB FF FF 0F FF       Lok Discovery - 0x73EBFFFF Range 15 ASK 255
14:36:51.005   CAN  0x00030300  [6] 73 EB FF FF 10 FF       Lok Discovery - 0x73EBFFFF Range 16 ASK 255
14:36:51.146   CAN  0x00030300  [6] 73 EB FF FF 11 00       Lok Discovery - 0x73EBFFFF Range 17 ASK 0
14:36:51.224   CAN  0x00030300  [6] 73 EB 7F FF 11 FF       Lok Discovery - 0x73EB7FFF Range 17 ASK 255
14:36:51.364   CAN  0x00030300  [6] 73 EB 7F FF 12 00       Lok Discovery - 0x73EB7FFF Range 18 ASK 0
14:36:51.442   CAN  0x00030300  [6] 73 EB 3F FF 12 FF       Lok Discovery - 0x73EB3FFF Range 18 ASK 255
14:36:51.583   CAN  0x00030300  [6] 73 EB 3F FF 13 00       Lok Discovery - 0x73EB3FFF Range 19 ASK 0
14:36:51.660   CAN  0x00030300  [6] 73 EB 1F FF 13 FF       Lok Discovery - 0x73EB1FFF Range 19 ASK 255
14:36:51.738   CAN  0x00030300  [6] 73 EB 1F FF 14 FF       Lok Discovery - 0x73EB1FFF Range 20 ASK 255
14:36:51.816   CAN  0x00030300  [6] 73 EB 1F FF 15 FF       Lok Discovery - 0x73EB1FFF Range 21 ASK 255
14:36:51.956   CAN  0x00030300  [6] 73 EB 1F FF 16 00       Lok Discovery - 0x73EB1FFF Range 22 ASK 0
14:36:52.034   CAN  0x00030300  [6] 73 EB 1B FF 16 FF       Lok Discovery - 0x73EB1BFF Range 22 ASK 255
14:36:52.111   CAN  0x00030300  [6] 73 EB 1B FF 17 FF       Lok Discovery - 0x73EB1BFF Range 23 ASK 255
14:36:52.189   CAN  0x00030300  [6] 73 EB 1B FF 18 FF       Lok Discovery - 0x73EB1BFF Range 24 ASK 255
14:36:52.330   CAN  0x00030300  [6] 73 EB 1B FF 19 00       Lok Discovery - 0x73EB1BFF Range 25 ASK 0
14:36:52.408   CAN  0x00030300  [6] 73 EB 1B 7F 19 FF       Lok Discovery - 0x73EB1B7F Range 25 ASK 255
14:36:52.485   CAN  0x00030300  [6] 73 EB 1B 7F 1A FF       Lok Discovery - 0x73EB1B7F Range 26 ASK 255
14:36:52.562   CAN  0x00030300  [6] 73 EB 1B 7F 1B FF       Lok Discovery - 0x73EB1B7F Range 27 ASK 255
14:36:52.640   CAN  0x00030300  [6] 73 EB 1B 7F 1C FF       Lok Discovery - 0x73EB1B7F Range 28 ASK 255
14:36:52.718   CAN  0x00030300  [6] 73 EB 1B 7F 1D FF       Lok Discovery - 0x73EB1B7F Range 29 ASK 255
14:36:52.858   CAN  0x00030300  [6] 73 EB 1B 7F 1E 00       Lok Discovery - 0x73EB1B7F Range 30 ASK 0
14:36:52.936   CAN  0x00030300  [6] 73 EB 1B 7B 1E FF       Lok Discovery - 0x73EB1B7B Range 30 ASK 255
14:36:53.013   CAN  0x00030300  [6] 73 EB 1B 7B 1F FF       Lok Discovery - 0x73EB1B7B Range 31 ASK 255
14:36:53.091   CAN  0x00030300  [6] 73 EB 1B 7B 20 FF       Lok Discovery - 0x73EB1B7B Range 32 ASK 255
14:36:53.107   CAN  0x00030300  [5] 73 EB 1B 7B 20          Lok Discovery - 0x73EB1B7B Protokoll mfx Range 0 - 32
14:36:55.495   CAN  0x00030300  [6] 7F FF FF FF 03 FF       Lok Discovery - 0x7FFFFFFF Range 3 ASK 255
14:36:55.572   CAN  0x00030300  [6] 7F FF FF FF 04 FF       Lok Discovery - 0x7FFFFFFF Range 4 ASK 255
14:36:55.714   CAN  0x00030300  [6] 7F FF FF FF 05 00       Lok Discovery - 0x7FFFFFFF Range 5 ASK 0
14:36:55.792   CAN  0x00030300  [6] 77 FF FF FF 05 FF       Lok Discovery - 0x77FFFFFF Range 5 ASK 255

Jedoch macht die Lok keine Bewegungen, wissen Sie woran das liegen könnte?

When 8 bytes CAN Frame is sent, the output is not coming properly on CAN interface

In the current program implementation you are sending 4bytes can frame & incrementing the DATA..
Say,

can0 07B [4] 00 00 00 01
can0 07B [4] 00 00 00 02
can0 07B [4] 00 00 00 03

& so on..

When i changed the frame length to 8 bytes the output is coming as below

can0 07B [8] 00 00 00 01 01 00 00 00
can0 07B [8] 00 00 00 02 02 00 00 00
can0 07B [8] 00 00 00 03 03 00 00 00

I expect the output as below

can0 07B [8] 00 00 00 00 00 00 00 01
can0 07B [8] 00 00 00 00 00 00 00 02
can0 07B [8] 00 00 00 00 00 00 00 03

Please let me know what changes need to be done in the current program to get the desired output as mentioned above.

TCP-read may cause erroneous message

Hello,

The following line reads a bunch of bytes from TCP-connection.

if ((n = read(tcp_socket, netframe, MAXDG)) == 0) {

The following code does not verify, if the read bytes represent a complete/single message, but forwards directly to CAN-socket.

Using TCP, it may happen, that the read-function returns with too little or too many bytes (for example only a fragment of the intended message or also the first bytes of next message in stream)
(Does not happen with message oriented UDP)

In this use-case, if the short messages are sent with high frequency via TCP, it is very likely that the TCP-reader in can2lan might read over the boundary of a single message, forwarding faulty messages to the Can-bus.

To solve the issue, the TCP-reader must verify that the read bytes match exactly one message.
For example the TCP-reader could read till the 5th byte udpframe[4] , defining the payload length N (DLC), and then continue reading the corresponding N bytes of the payload.

Cu, Frank

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.