Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
maxdd opened this issue Apr 17, 2021 · 4 comments
Open

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

maxdd opened this issue Apr 17, 2021 · 4 comments

Comments

@maxdd
Copy link

maxdd commented Apr 17, 2021

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,

@hartkopp
Copy link
Member

hartkopp commented Apr 17, 2021

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

@maxdd
Copy link
Author

maxdd commented Apr 17, 2021

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?

@leao-nardo
Copy link

leao-nardo commented Jun 13, 2021

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

@yegorich
Copy link
Contributor

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

@linux-can linux-can deleted a comment from fabHO1 Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants