Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need for an initialization of the ELM to setup expected settings #29

Open
AugustinVoiMa opened this issue Feb 12, 2024 · 2 comments
Open

Comments

@AugustinVoiMa
Copy link

Hello,

My vehicle follow the CAN protocol ISO 15765-4 (according to what is detected by a commercial obd app that successfully read my VIN)

When reading the VIN code by using kotlin-obd-api (connection via a bluetooth obd adapter), the VIN fails to be correctly decoded.
I get the formatted value: @ tcD$4DTdt�#3
instead of expected VIN: WF0DABCDEFGH01234

The raw data transmitted are

09 02\r
014\r
0: 49 02 01 57 46 30\r
1: 44 41 42 43 44 45 46\r
2: 47 48 30 31 32 33 34\r

and the value in the ObdRawResponse is: 09 020140: 49 02 01 57 46 301: 44 41 42 43 44 45 462: 47 48 30 31 32 33 34

I notice that in the implementation Control.kt: parseVIN, there is nothing that discards the first two rows that corresponds to the command and the message bytes count.(if I change the replacement criteria to "^.{7}0:49020.".toRegex(), I get the expected VIN.

I didn't find any documentation that talks about the repeated command (first line 09 02 of the received message), either in the examples of the ELM327 chip documentation there is no mention to that, except that the message format can vary from one vehicle to another.

There is always the command repeated in the received message from my bluetooth interface.
Should I implement this case in this lib or maybe this is specific to my interface so I have to manage it on the bluetooth adapter side?

@AugustinVoiMa
Copy link
Author

Found in the ELM doc
By default echo is on so the ELM always send back our command, that is why i always receive the first line that causes my issue (that is actually not related to VIN Decoding)

Since kotlin-obd-api assumes echo to be set of when it handle the elm responses,
should we think about implementing a default setup method that would allow to reinitialize from scratch the ELM interface?
A sequence of ATZ, E0, and any other setting that is currently implicitely expected?

-> SetEchoCommand(OFF)

@AugustinVoiMa AugustinVoiMa changed the title VIN decoding for CAN (ISO 15765-4) Need for an initialization of the ELM to setup expected settings Feb 12, 2024
@MikkM
Copy link

MikkM commented Apr 1, 2024

Is this what you are after ?

obdConnection.run(SetEchoCommand(Switcher.OFF), delayTime = 500) //ATE0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants