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.
When I run the code in my car with the ignition on, I get the correct VIN.
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.
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.
@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:
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???
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
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) .
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.
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.
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
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?