Hello.
I would like to begin building a library for the K-line as I have need for that myself. I have done some research on it and I’ve found out that messing with the RX and TX pins make serial communication unavailable. This must be normal for an Arduino, but is there some way to reset the pins for serial communication after sending the initialization sequence?
The initialization consists of either a 25ms low followed by a 25ms high and 10.4kbps communication OR the 5 baud init which begins with a 200ms low, a 400ms high, a 400ms low, a 400ms high, a 400ms low and ends with a 200ms high. This cannot be reproduced correctly with Serial.write() command for it sends the start and stop bits as well. There’d come a gap between each 0 bit. If it worked I’d only loop the low time writing a zero and delay the high.
Then another problem comes with the 5 baud initialization sequence speed. The speed may, in some cases, be set by 0x55 byte (01010101) and I need to get that speed to be used with communications. I thought about calculating the time between the edges but is there any easier way? I have no idea if it even works to calculate the speed so for now it may be the best just to assume communication happens at 10.4 kbps instead of messing around trying to calculate the speed.
I hope I will get it working, hopefully even according to the ISO standards, and can help making the M2 a standardized OBD II scanner that can be used as any other OBD II scanner. There’s a whole lot of potential but I’m afraid if it doesn’t comply with the standards there will come trouble getting the device spread so writing the library would help M2 gain some more market potential. Of course M2 already has a lot more potential than most OBD II scanners for it can be reprogrammed, but I’m sure there are people who only need to read the error data.