can-utils icon indicating copy to clipboard operation
can-utils copied to clipboard

Is it possible to use TCP/IP socket from ELM327 clones?

Open maxdd opened this issue 4 years ago • 4 comments

Hi, as per the title would it be possible to use the ELM327 clones together with these tools? As far as i can see the ELM327 is providing a WIFI network and via Telnet to port 35000 it is possible to send AT commands as well as OBD PIDs request (maybe less relevant)

https://www.sparkfun.com/datasheets/Widgets/ELM327_AT_Commands.pdf https://learn.sparkfun.com/tutorials/obd-ii-uart-hookup-guide/obd-commands

as far as i can see using the following guide it should be possible to sniff the CAN

https://www.csmagics.com/single-post/2013/07/24/this-is-the-title-of-your-first-image-post

Regards,

maxdd avatar Apr 17 '21 15:04 maxdd

Here is a project that implements the ELM327 raw protocol and make it a SocketCAN compatible device: https://github.com/norly/elmcan To interconnect this driver with WIFI you would need some 'netcat' script that redirects the traffic to a tty or pty, so that the above driver can access the content.

Alternatively you might build some program which talks to the ELM327 over WIFI and route the CAN frames to a virtual CAN interface in which you can use the can-utils then.

Something similar to this https://github.com/linux-can/can-utils/blob/master/slcanpty.c

Regards, Oliver

hartkopp avatar Apr 17 '21 17:04 hartkopp

So as far as i understood i should compile the elmcan and use something along this

sudo socat pty,link=/dev/ttyCAN0,raw tcp:192.168.0.10:35000&

and then

sudo ldattach \
       --debug \
       --speed 38400 \
       --eightbits \
       --noparity \
       --onestopbit \
       --iflag -ICRNL,INLCR,-IXOFF \
       29 \
       /dev/ttyCAN0

at this point in a terminal what shall i type?

./cansniffer any

or looking at the code (i'm no expert)

./cansniffer elmcan

is it ok?

maxdd avatar Apr 17 '21 20:04 maxdd

@maxdd hows it going ? did you tested it ? did it worked ?

leao-nardo avatar Jun 13 '21 08:06 leao-nardo

If ELM327 firmware can understand SLCAN protocol, you could use the same commands as we do for our NetCAN Plus devices:

  1. sudo sh -c ”socat pty,link=/dev/netcan0,raw tcp:192.168.1.5:2001 &”
  2. slcand -c -o -s8 /dev/netcan0 - this command creates slcan0 CAN device
  3. ip link set up slcan0

Now you can use slcan0 device with candump, cansend etc. like you would do with can0 device.

For more details, see our manual

yegorich avatar Jun 13 '21 19:06 yegorich