Comments (4)
Hello again, I've done again the circuit and also change the tranceiver(just in case), but also the init_success was 0. I had uncommented debug line, and the response was:
"Looping
Before magic 5 baud.
Before setting port.
After setting port.
Timeout on read 0x55.
init_success:0 "
Unfortunately I dont have a portable logic analyzer, and at my University I can't find one ( i'll try in weekend in front of my university, with a plugged in one, when aren't a lot of students :) ). From the code I tried to expand/short the timeout(just in case) but with no luck. Have you been in the same situation?
Thank you very much for all your help.
from obd9141.
During the initialization the following happens:
The 'slow' handshake is started by sending a byte to the ECU at a baudrate of 5, after that the baudrate becomes 10400 and the ECU should send a 0x55
byte back, which is followed by two more bytes v1
and v2
, these should be identical and the reader (the device trying to handshake with the ECU) should respond by sending the inverted value of v2
, after this the ECU should answer with 0xCC
to finish the initialization.
Based on the debug output you provided, this 0x55
byte is never received from the ECU. There are several things you can try:
- Be sure to use adequate pull-up on the K-line.
- Ensure that the ECU is listening to your handshake (it should be powered); try it with the engine running in idle to be sure. In my situation it works when the engine is off but the key is turned so that all systems are powered, but this might vary depending on the vehicle / ECU.
- It might be that the ECU does not implement the stop bit of the 5 baud sequence correctly; try to disable the delay in this
this->kline(true); delay(200); // stop bit
line of theinit()
method and add it to the timeout for0x55
. This delay is used to create the stop bit of the 5 baud sequence, if the ECU does not adhere to the specification it might send the0x55
byte while we are in the delay. - Hook up a logic analyzer to the K-line: be sure to use a voltage divider. If you do not have a logic analyzer you can try investigate whether the 5 baud sequence looks correctly by hooking up another Arduino, connect its interrupt pin to the voltage divided K-line and print
millis()
on the serial port when it changes. If that looks alright, you might try to use a USB serial converter configured at a baudrate of 10400 to see whether the0x55
byte is actually sent over the bus. (You can also use the second Arduino as a serial converter; there are plenty of how-to's for this on the internet.) - If you have another OBD reader which works; connect this and use the logic analyzer / USB-serial converter to sniff its communication and investigate what is different.
The last two steps are by far the most insightful to investigate what the problem is, because if you can see what is happening you can probably see what is going wrong. Especially the last step is insightful, as you can record what the correct handshake is. It might be the case that your ECU requires the 'fast' initialization, whereas the one implemented in this library is the 'slow' one.
Have you been in the same situation?
Not exactly the same, but I encountered plenty of issues when I first started this project. With these sort of problems a logic analyzer (or second microcontroller) really helps, and comparing the signal to a working OBD reader also helps. I hope the steps above help solving the issue for you, please let us / me know if it does.
from obd9141.
Hi. I have a similar problem with Macchina M2 and Škoda Octavia I 1.9TDI (1999). I wonder why the initialization sequence is '11001100', i.e. 51 backwards. According to https://www.blafusel.de/obd/obd2_kw1281.html it should be the address of the unit (ECU is 1), i.e. '10000000'. Even the rest of the init process seems to be different. Is this code supposed to be compatible with KW1281?
from obd9141.
Hi Wanthalf,
This library is not expected or supposed to be compatible with KW1281
, that seems to be a proprietary protocol by VW. Unfortunately there are many OBD signal protocols, this library only handles OBD9141-2, which is one of them (ISO 14230 KWP2000 could be added relatively easily; only the handshake is different).
KW1281 seems to be a whole different protocol, not only the initialisation, but also the checksums appear to be different than OBD9141. So I don't see any easy way to adapt this library to suit your requirements.
I'm closing this issue as the discussion of whether or not this library implements a specific protocol is unrelated to the original issue. I hope my reply answers your question.
from obd9141.
Related Issues (20)
- Custom request, and recv full data message HOT 1
- Support for different control modules? HOT 1
- TLE 7259G HOT 15
- I need to add delay in between each PID request HOT 1
- why using digitalwrite(tx_pin,true) HOT 1
- about kline HOT 25
- Slow init simulator code HOT 4
- readerKWP not working for me HOT 9
- missing Serial1 declaration
- KWP Slow init with v1 != v2 HOT 4
- ESP32 support HOT 7
- problem 'serial_port' was not declared in this scope HOT 14
- For ESP32 HOT 3
- k-line speed study HOT 18
- How to make it work.... HOT 20
- How can I know if I'm doing everything right? HOT 5
- esp32 with OBD9141 not work HOT 19
- A special kind of communication with the ECU HOT 6
- ESP32 Serial1 crash... HOT 2
- KWP71 Compatibility HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from obd9141.