@gimpo
I wrote this last night but it doesn't seem to have posted it.. I don't know why.. Anyways...
Your solution seems to be the exact answer to my issue, even to the point that when you said this ...
Contents of the response are not fixed, the text can contain different kind of inormation (look here below the comment from my code). What is more important is that the resulting response-string can be chaotic; it can contain blank added blank spaces, special chars and sometimes the answer arrive with a big delay in time. When this happens, many ECUs have the strange habit to queue answer in a buffer, so when you issue a second request than the answer could contains also a part that is the answer to the first one (!)
I realized exactly what was going on, because I was sending ATSP 5 and didn't get anything, then when I sent 0100 I got "BUS-INIT:" Then the response I was detecting. I have a serial to usb converter on the way so I can do more diag's with my computer, but your code seems to be the solution.
My question on your code is this..
In the getRpm() function you called
Code: Select all getResponseAndCheck("6160"); // remember: this are hexadecimal numbers!
what is the 6160? I just want to see what my RPM is at all times, I'm not looking for a specific RPM. Also you have
Code: Select allint position = bufferEndPositionOf("6130");
What is the 6130? Can that be left out or is that the length of the response you're expecting?
I'm not quite understanding those two things, I would be very appreciative if you could shed some light on that and help me out, it seems the ISO 14230-4 protocol is some what of an art form to deal with.