Skip to contentSkip to conversation

ODB-II Interfaces and Linux CAN?

DISCUSSION Sven Geggus 3 participants 5 messages Apr 27, 2012 CAN network drivers

lore
Share & tools
lore
#0 lore raw

Hello,

cheap ODB-II Interfaces claiming to support CAN (at least up to 500 kbps) are available for less than 20 Euros now.

Here is one of them:
http://www.autodia.de/produkte/autodia-e327/technische-daten

Will this already work with socketcan or would it be possible to implement support?

Sven

Signature · 4 lines
"If you don't make lower-resolution mapping data publicly
available, there will be people with their cars and GPS
devices, driving around with their laptops" (Tim Berners-Lee)
/me is giggls@ircnet, http://sven.gegg.us/ on the Web
#1 lore raw
Quoted 7 lines · Sven Geggus

Hello,

cheap ODB-II Interfaces claiming to support CAN (at least up to 500 kbps) are available for less than 20 Euros now.

Here is one of them:
http://www.autodia.de/produkte/autodia-e327/technische-daten

nice :)

Quoted 2 lines

Will this already work with socketcan or would it be possible to implement support?

The webpage talks about a "327 Chip" when searching for it, I find:
http://www.blafusel.de/obd/obd2elm327.html
http://www.elmelectronics.com/DSheets/ELM327DS.pdf

This chip converts ODB (and CAN seems to be part of ODB) to serial. The question is how the 327 in the autodia-e327 is converted to USB. They probably use a standard USB-Serial converter chip. There is support for serial attached CAN adapters in mainline (IIRC), but I think it talks a different protocol. So if it's possible the send and receive CAN messages with the 327 it should be possible to hack a driver that can send/receive some CAN messages.

Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
#2 lore raw
Quoted 3 lines · Marc Kleine-Budde

The webpage talks about a "327 Chip" when searching for it, I find:
http://www.blafusel.de/obd/obd2elm327.html
http://www.elmelectronics.com/DSheets/ELM327DS.pdf

Jepp this includes a description of the serial protocol.

Quoted 3 lines

This chip converts ODB (and CAN seems to be part of ODB) to serial. The question is how the 327 in the autodia-e327 is converted to USB. They probably use a standard USB-Serial converter chip.

They almost certaily do.

Quoted 2 lines

There is support for serial attached CAN adapters in mainline (IIRC), but I think it talks a different protocol.

You are talking about slcan.c right?

Probably I should just get me one of these cheap Interfaces.

Sven

Signature · 4 lines
Unix is simple and coherent, but it takes a genius – or at any rate a
programmer – to understand and appreciate the simplicity
(Dennis M. Ritchie)
/me is giggls@ircnet, http://sven.gegg.us/ on the Web
#3 lore raw
Quoted 12 lines · Sven Geggus
Quoted 3 lines · Marc Kleine-Budde

The webpage talks about a "327 Chip" when searching for it, I find:
http://www.blafusel.de/obd/obd2elm327.html
http://www.elmelectronics.com/DSheets/ELM327DS.pdf

Jepp this includes a description of the serial protocol.

Quoted 3 lines

This chip converts ODB (and CAN seems to be part of ODB) to serial. The question is how the 327 in the autodia-e327 is converted to USB. They probably use a standard USB-Serial converter chip.

Quoted 6 lines

They almost certaily do.

Quoted 2 lines

There is support for serial attached CAN adapters in mainline (IIRC), but I think it talks a different protocol.

You are talking about slcan.c right?

Yes.

Quoted 1 line

Probably I should just get me one of these cheap Interfaces.

These serial CAN converters are probably quite slow, I haven't used any. Maybe Oliver can comment on them.

Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
#4 lore raw
Quoted 9 lines · Marc Kleine-Budde
Quoted 7 lines · Sven Geggus
Quoted 3 lines · Marc Kleine-Budde

The webpage talks about a "327 Chip" when searching for it, I find:
http://www.blafusel.de/obd/obd2elm327.html
http://www.elmelectronics.com/DSheets/ELM327DS.pdf

Jepp this includes a description of the serial protocol.

Yes. It looks like that not only CAN diagnosis and transport protocols like j1939 and iso-tp are supported to transfer their PDUs but also it is possible to process bare CAN frames.

Implementing e.g. the iso-tp protocol inside the ELM327 chip hides the timing requirements from the diagnosis application on the PC side. So the PC application can be pretty simple - only processing PDUs without knowing all the transport protocol details.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

This chip converts ODB (and CAN seems to be part of ODB) to serial. The question is how the 327 in the autodia-e327 is converted to USB. They probably use a standard USB-Serial converter chip.

Quoted 10 lines
Quoted 6 lines

They almost certaily do.

Quoted 2 lines

There is support for serial attached CAN adapters in mainline (IIRC), but I think it talks a different protocol.

You are talking about slcan.c right?

Yes.

Quoted 1 line

Probably I should just get me one of these cheap Interfaces.

Good idea. Supporting all devices on earth is Greg K-Hs mission. So why not bringing the ELM327 to life for SocketCAN? :-)

Quoted 2 lines

These serial CAN converters are probably quite slow, I haven't used any. Maybe Oliver can comment on them.

Indeed there are many of them out there - as you can see in the Kconfig entry:

http://lxr.linux.no/#linux+v3.3.3/drivers/net/can/Kconfig#L21

The ASCII protocol is pretty simple and there's no kind of feedback or error reporting - it's not my favourite CAN hardware ...

There are only incoming and outgoing ASCII streams which are converted to struct can_frames in the slcan.c driver.

The slcan encapsulation format is described here:

http://lxr.linux.no/#linux+v3.3.3/drivers/net/can/slcan.c#L100

Before the simple stream conversion in slcan.c can take place the SLCAN adapter needs to be initialized, and the bitrate needs to be set.

https://gitorious.org/linux-can/can-misc/blobs/master/slcan/SLCAN-API.pdf

This is done by e.g. slcan_attach tool.

Don't know how to setup the ELM327 to bring it into this mode - but if you get one you may keep me informed.

Regards,
Oliver