-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
OBD2 CAN IDs not matching spec #12
Comments
Here is a capture (using
Here is what the current implementation actually sends, when using 0x7df as the tx_id:
And here is what happens when using 0x7e0 as the tx_id on a 2020 Toyota Camry or 2022 Carolla:
|
I talked to the author of the |
OK thanks for this! I will work on a new OBD2 diagnostic server when I get time to fix this issue :) |
Adding a note about extended addressing for whenever we can get around to fixing this issue. If using 29-bit (extended) addresses instead of the typical 11-bit addressing, the broadcast ID is 0x18DB33F1 instead of 0x7DF.
ref: https://www.csselectronics.com/pages/obd2-explained-simple-intro |
Background
According to Wikipedia (sorry I don't have access to the actual OBD-II specification):
This library's current code has you specify a sid/did (
tx_id
,rx_id
) for OBD messages, and uses a single socket (socketCAN ISO-TP kernel interface) to handle sending/receiving messages on just those addresses. However, this causes problems when running against vehicles that follow the spec.Observed Behavior
On a 2020 Toyota Camry, I tested
Service_09::get_vin()
, but it causes a timeout error. The reason is that if I set thetx_id
to0x7df
, I get the first frame back from the ECU (with CAN ID0x7e8
), but the ECU pauses and waits for a FlowControl frame to be sent with CAN ID0x7e0
(8 less than the ECU's transmit ID). The ISO-TP kernel sends flow control using the original broadcast address,0x7df
, which the ECU ignores. If I set thetx_id
to 0x7e0 and request the VIN, the ECU completely ignores the request.Other Implementations
I have a scan tool that sends the OBD messages properly, and I looked at the example code for Comma.ai's Panda, and they also send the request to 0x7df and listen on 0x7e8 (which sends the FC frame using ID 0x7e0). Their handling of UDS protocol does similar filtering to ensure the tx addr is changed from 0x7df to something in the range 0x7e0-0x7e7 (based on the first response received).
Proposed Design
The OBD code should have a single transmit socket with
tx_id = 0x7df
, and eight listening sockets withrx_id
in the range 0x7e8 - 0x7ef (andtx_id
for FC frames set to a value that is 8 less than therx_id
). This would follow the specification, allowing 8 ECUs to respond to OBD queries simultaneously. If it is a simple request, like to get the VIN, then that function can just take the first response and return it. In order for this to be possible, you will first have to implement the suggestion in Issue #11 to have a software-based ISO-TP channel. Thesocketcan-isotp
crate definitely supports this, as demonstrated in their examples.The text was updated successfully, but these errors were encountered: