pylessard / python-udsoncan

Python implementation of UDS (ISO-14229) standard.
MIT License
575 stars 199 forks source link

1904 Error returned while reading DTC snapshot #168

Closed hanlfa closed 11 months ago

hanlfa commented 1 year ago

2023-08-07 12:07:53 [INFO] UdsClient: ReadDTCInformation<0x19> - Sending request with subfunction "reportDTCSnapshotRecordByDTCNumber" (0x04). 2023-08-07 12:07:53 [DEBUG] Connection: Sending 6 bytes : [b'1904c25900ff'] 2023-08-07 12:07:54 [DEBUG] Connection: Received 97 bytes : [b'5904c25900090119cf0078cf010000cf02170404000000cf03000000ce000000ce010019ce02006cce0300ce040026ce0500ce0641ce0741ce0841ce0943ce0a43ce0b43ce0c00ce0d2364ce0e23ce0f00ce1001ce1102ce1201ce1303ce140000'] 2023-08-07 12:07:54 [INFO] UdsClient: Received positive response for service ReadDTCInformation (0x19) from server. 2023-08-07 12:07:54 [ERROR] UdsClient: [ConfigError] : Actual data identifier configuration contains no definition for data identifier 0xcf00 2023-08-07 12:07:54 [INFO] Connection: Connection closed As per the above log, unable to output response. How to solve this problem

pylessard commented 1 year ago

As the message say, you need to define a codec to interpret the data you have received. See example here : https://udsoncan.readthedocs.io/en/latest/udsoncan/examples.html#reading-a-did-with-readdatabyidentifier

The service/subfunction you are using returns data for DID 0xCF00, so you need that in your config

hanlfa commented 1 year ago

ok,it is right. i have a question, How to read a snapshot while reading a dtc? Must 1902 read dtc before 1904 read snapshot? Can you read the dtc and the corresponding snapshot at once

pylessard commented 1 year ago

If by "reading a DTC" you mean getting its status, you can use 0x1904 only. It returns the satus byte + snapshot data in a single call.

pylessard commented 1 year ago

Should we close this?

hanlfa commented 1 year ago

ok