arduino-OBD2 icon indicating copy to clipboard operation
arduino-OBD2 copied to clipboard

Clear DTC function is currently broken

Open jLynx opened this issue 2 years ago • 3 comments

Right now the implementation of the clear DTC (https://github.com/sandeepmistry/arduino-OBD2/pull/7) is broken and we are trying to work out how to get it to work. I am starting this issue thread so we can do a bit of a knowledge dump while we work out how to get it working.

Here are a few links to information that may be helpful.

http://www.totalcardiagnostics.com/support/Knowledgebase/Article/View/104/0/obd2-pids-for-programmers-technical https://electronics.stackexchange.com/questions/561221/0x7e8-to-0x7fh-on-the-can-bus https://en.wikipedia.org/wiki/OBD-II_PIDs https://en.wikipedia.org/wiki/On-board_diagnostics

Here is the current implementation

ID: 0x7DF
Length: 8
Data: 0x00, 0x04x 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

Based of the information in the Wikipedia article, this should work but in practice it does not seem to work.

jLynx avatar Dec 21 '21 22:12 jLynx

image image

image

jLynx avatar Dec 21 '21 22:12 jLynx

0x04 also been used here https://github.com/Javadad01/obd2-instruments/blob/2ca7acc15b9f2b41a4f29c6f5f273607c6c1d010/obd2-instruments/common/obd2.c#L161

jLynx avatar Dec 21 '21 23:12 jLynx

Hi, seems you are missing the "data bytes" value in the message. On byte 0 there is a number of data bytes and in your implementation you have "0", while you are sending 1 byte of data, which is the service number. You can try to change the line 714 of the ODB2.cpp file to: CAN.write(0x01); // number of additional bytes

So try sending the: ID: 0x7DF Length: 8 Data: 0x01, 0x04x 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

areckicode avatar Mar 22 '22 21:03 areckicode