OBD-II Adapter Design
OBD-II adapters are used to as a bridge device between a vehicle’s OBD-II communication bus and some other host protocol such as serial, USB or Bluetooth. The adapter converts host messages to/from vehicle OBD-II messages. The adapter software is designed with as little message intelligence as possible, meaning the host and vehicle understand the message contents but the adapter’s job is to shuttle data back and forth.
The adapter may be self powered by the vehicle OBD-II connector power and ground pins. A Microchip PIC 18F248 CPU is a common adapter microprocessor. The CPU has CAN bus a peripheral to allow communication with CAN-bus equipped vehicles.
Non CAN-bus legacy protocols such as VPW and PWM (GM and Ford) do not have readily available hardware interfaces. Typically these interfaces are written in assembly and “bit-banged” at the lowest level. It’s quite tedious and time consuming to create as software-based transport layer that conforms to the exact timing requirements of the vehicle data bus. Logic analysers are most helpful to debug the low level communication.
ISO and KWP2000 protocols (European/Japanese) are closely related to simple RS-232 serial and therefore serial based solutions are adaptable to communication with a vehicle.
OBD-II covers many different hardware transport protocols. Initiating first communication with the vehicle requires attempting communication with each interface in a well-defined sequence. During auto-detection, it’s critical that the software perform the process correctly and stop communication immediately in the event of a failure to prevent unwanted a forced Check Engine due to the adapter clobbering the vehicle’s normal communication bus traffic. In some cases, the adapter must quickly take action at the interrupt level if the communication at a particular interface/speed is unsuccessful.