How to Request VIN

I think we are extremely close. Running your code with some slight modifications I was able to receive message id 0x7E8, and adding some print statements, able to see that the code was indeed sending a flow control message.

However, it seems that the obd.complete function never returns true. Hope my trial helps.

1 Like

I had the time to wrap up the code above in an app. Check out the VIN reader app at https://carloop.io/apps/

The app is available on GitHub at GitHub - carloop/app-vin-reader: VIN reader

When I run the code in my car with the ignition on, I get the correct VIN. :tada:

Here’s the debug log through Serial:

Reading VIN
Got reply from ECU
Sent flow control
Got reply from ECU
Got reply from ECU
VIN: 3FADP4FJ2BM113913
Done

You are right that there’s something fishy with the obd.complete() function because at some point while tweaking the Serial.print statements I didn’t get complete() to return true anymore. There must be a bug in the OBDMessage class causing this. :unamused:

1 Like

Nice! I will definitely check it out. I’ve just finished scaling and offsets for all Mode 1 PIDs (I am no programmer by trade, so it’s probably horribly inefficient but it works nonetheless) Hoping I will have time to post a project to hackster.io tomorrow.

1 Like

That would be awesome! The folks from Hackster.io hooked us up with a nice project page, so you could add your Carloop projects here: Hackster.io - The community dedicated to learning hardware.

Hello ,
Please the data D2= 0x49 found in line 2 is always the same for all multiple frames obd messages ?
Regards

@ninfeinous, I think the information you are looking for regarding multi-frame CANbus messages is on Wikipedia here:

The byte of date you are asking about was answered in the details above. It is essentially saying the message is a response to a specific request. This way you can search for the message containing the response you need, out of the many messages going across the CANbus:

Does this help you out?

i am trying to get response from OBD2 through STN chip
here is the response of emulator
0902
7E810144902014D4154
7E82134303330393642
7E8224E4C3030303135
i not getting how to decode can anyone help???

this is for vin pid plz rpy fast

Ascii code of 4D(hex) - 77(DECIMAL) “M” - 41(hex) - 65(DECIMAL) “A”
First 3 byte is CAN ID. After that split that data 2 by 2,
if there is a data on D1 “10” thats means there will come more data. D2 = hex(14) that means total byte will come (14 hex = 20 decimal )
if rows first byte(D1) is 2x that is information byte and you can take all bytes after thats

I did that in excel
you can use HEXTODEC() and CHAR() function on excel

A post was split to a new topic: J1939 Protocol on Carloop

Is 7DF default for any car to get diagnosis ? I’m trying to send data like (cansend can0 7df#0209020000000000) and nothing happens. All can-tools are woking fine. I’m trying it on a Honda 2016 (Brazil) .

Thanks in advance

7DF is the broadcast address for OBD-II, so as long as your car supports OBD-II you should be able to use that mode. You might want to try different CAN bus speeds like 250000 bits/s and 1000000 bits/s.

First, thanks for this post. Great information. When testing my code, I am able to send the 0902 request for the VIN and I receive the initial response, I then send the Flow control message and receive the second frame of the VIN. However, I never can get the third frame of the VIN. I have tried numerous troubleshooting steps to isolate the problem but I am at a loss. No matter what I do, I can only get two thirds of the VIN (2 of 3) frames. Do you have any ideas what could be causing this. My code is in C so its slightly different than the C++ provided. Thanks for any assistance.

@slgtech,

You mentioned specifically sending a Flow control message to request the second frame. That seems to work fine, because you say that you then receive the second frame. However, you do not mention a Flow control message to request the third frame. Can you check to ensure you are sending a request for the third frame? Also, does the Flow control message have a frame number built into it (I do not have the details on-hand at the moment about the Flow control message format, just covering all the possible bases.)?

Look into that and let us know if that helps. If not, we can dig in deeper and try to figure it out.

Fantastic Thread with good explanations…

However I got stuck at a point.

A diagnostic device sends a Remote Transmission Request and
I need to simulate my ECU by sending the VIN via CAN

VIN is: SALLDWBP8DA431032

I converted VIN to HEX as: 53 41 4C 4C 44 57 42 50 38 44 41 34 33 31 30 33 32

So I thougt the ECU (7E8) should respond

(0.1) 7E8 10 14 49 02 01 53 41 4C
(0.2) 7E8 21 4C 44 57 42 50 38 44
(0.3) 7E8 22 41 34 33 31 30 33 32

Is this correct?

Questions: Between the 1st and 2nd message there should be the requestors flow control message… may I ignore that and simply continue transmitting? Bus Speed is 500k

BR
Ralf

Thank jvanier. It’s really helpful.
Can you please tell me what 01(5th byte) signifies here: 10 14 49 02 01 33 46 41? Is it indicating that the following bytes are ascii string?

1 Like

On the first reply from the ECU, the fifth byte is 01. What does that byte mean? (Your VIN appears to start after that)

Also, I suspect you a missing a “3” from the end of the VIN you have in your textual description.

I also thanks to jvanier. it is really helpful for me.

Hi,

I have been through the VIN reader app but I didn’t find any options? Is it due to the completability issue.