Scanner OBD2 in OpenWrt

With the advent of OBD2 (On-Board Diagnostics) in cars many models of different scanners appeared in the market which allow you to connect and look into the "brains" of a car. Some of you have probably built your first Kline adapter at home in order to understand by yourself the reasons of indication of CHECK ENGINE on the panel. Therefore, this section will probably be more interesting to motorists who couldn’t imagine before that the car can diagnosed using home router. ))).

On the stage of configuration OpenWrt the following modules are to be selected:
Kernel modules:
USB Support:
kmod-usb-serial
kmod-usb-serial-ftdi

At the moment of writing of this article the utility for working with obd2 isn’t included in OpenWrt. Therefore I suggest considering the program Freediag from there http://freediag.sourceforge.net/. It is worth to say that this program hasn’t been updated for a long time. I don’t know perhaps I searched badly but I fall under the impression that the support in linux obd2 is very poor. I hope that in “some time”the problem with the software for this subject will be solved also. So, let’s download it and build using a cross-compiler.

Downloading and installing the packages:

root@OpenWrt:/# opkg install kmod-usb-serial-ftdi
Installing kmod-usb-serial-ftdi (2.6.36.2-1) to root...
Downloading ftp://ftp:ftp@192.168.0.9/kmod-usb-serial-ftdi_2.6.36.2-1_brcm47xx.ipk.
Installing kmod-usb-serial (2.6.36.2-1) to root...
Downloading ftp://ftp:ftp@192.168.0.9/kmod-usb-serial_2.6.36.2-1_brcm47xx.ipk.
Configuring kmod-usb-serial.
Configuring kmod-usb-serial-ftdi.

Let’s connect the scanner OBD2 to the diagnostic connector in our car. A blue led should begin to light inside of the scanner box OBD2. Let’s connect the scanner OBD2 to the USB-port and check the output dmesg:


root@OpenWrt:/# dmesg
ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
ftdi_sio 1-1.3:1.0: device disconnected
usb 1-1.3: new full speed USB device using ohci_hcd and address 6
ftdi_sio 1-1.3:1.0: FTDI USB Serial Device converter detected
usb 1-1.3: Detected FT232RL
usb 1-1.3: Number of endpoints 2
usb 1-1.3: Endpoint 1 MaxPacketSize 64
usb 1-1.3: Endpoint 2 MaxPacketSize 64
usb 1-1.3: Setting MaxPacketSize 64
usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0

The scanner OBD2 has detected in the system as a device ttyUSB0.

Let’s start the Freediag. The base of the Freediag is the utility scantool, therefore let’s start scantool.

root@OpenWrt:/# ./scantool
scantool: version 0.3
scantool: Type HELP for a list of commands
scantool: Type SCAN to start ODBII Scan
scantool: Then use MONITOR to monitor real-time data
scantool>

The documentation for the Freediag scantool is available as well as on the web site as in the directory with the initial code. Therefore the available command set you can find there. The command scan starts the scanning.

scantool> scan
Trying SAEJ1850-VPW ... failed!
Trying SAEJ1850-PWM ... failed!
Trying ISO14230_FAST ... Failed to open hardware interface failed!
Trying ISO14230_FAST !ISO9141-2
Connection to ECU established
MIL light OFF, 0 stored DTC(s)

Сканер OBD2