Skip to contentSkip to conversation

CAN Bus over TCP/IP

DISCUSSION John Whitmore 4 participants 4 messages Jun 14, 2014 – Jun 18, 2014 CAN network drivers

lore
Share & tools
lore
#0 lore raw

Was contemplating something which would allow me to transmit CAN Bus frames over TCP/IP. Searching throws up a few papers on the subject but wondered if there's an OpenSource implementation already out there or any kind of spec on the subject. Thought there might be an RFC on the subject but haven't thrown up anything.

#1 lore raw
Quoted 5 lines · John Whitmore

Was contemplating something which would allow me to transmit CAN Bus frames over TCP/IP. Searching throws up a few papers on the subject but wondered if there's an OpenSource implementation already out there or any kind of spec on the subject. Thought there might be an RFC on the subject but haven't thrown up anything.

Take a look at this project: https://github.com/dschanoeh/socketcand

Another variant were to extend slcanpty to accept TCP connections.

Yegor

#2 lore raw
In reply to John Whitmore

A very simple solution using a messaging broker is this one:

https://github.com/smay4finger/MQTT2CAN

Beware, it's not real-time capable and was not developed with network security in mind.

mfg, Stefan.

Quoted 9 lines · John Whitmore

Was contemplating something which would allow me to transmit CAN Bus frames over TCP/IP. Searching throws up a few papers on the subject but wondered if there's an OpenSource implementation already out there or any kind of spec on the subject. Thought there might be an RFC on the subject but haven't thrown up anything.
--
To unsubscribe from this list: send the line "unsubscribe linux-can" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to John Whitmore
Quoted 10 lines · John Whitmore

Was contemplating something which would allow me to transmit CAN Bus frames over TCP/IP. Searching throws up a few papers on the subject but wondered if there's an OpenSource implementation already out there or any kind of spec on the subject. Thought there might be an RFC on the subject but haven't thrown up anything.
--
To unsubscribe from this list: send the line "unsubscribe linux-can" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Hi.

Have a look at slcan and the accompanying tools (slcan_attach, ...) from can-utils in combination with socat or a simple C-implementation that just forwards data between a pseudo-tty and a socket. I use that setup to connect multiple virtual machines via CAN for testing purposes.

The final setup would look like this:

candev <-> ptty <-> socat <-> tcp <-> socat <-> ptty <-> candev

I don't know what kind of performance you need, but it should definitely be worth a look.

For example:
Machine A:
socat -d -d PTY,link=/tmp/slcan,raw TCP-LISTEN:30000 & slcan_attach /tmp/slcan
ip link set slcan0 up

Machine B:
socat TCP:<machine-A-IP>:30000 PTY,link=/tmp/slcan slcan_attach /tmp/slcan
ip link set slcan0 up

should connect those two CAN-Busses over TCP.

Regards
Andre