aws / aws-iot-fleetwise-edge

Reference Implementation for AWS IoT FleetWise
https://aws.amazon.com/iot-fleetwise/
Apache License 2.0
61 stars 44 forks source link

Request PID range 0xC0, 0xE0 in a separate message #11

Closed csxwin closed 2 years ago

csxwin commented 2 years ago

fixes #10

Describe the bug Per specification from ISO15765 in J1979, maximum six PID can be sent out to ECU. In v0.1.4, seven PIDs were sent to ECU to request supported PID list: 0x00, 0x20, 0x40, 0x60, 0x80, 0xA0, 0xC0.

To Reproduce This issue was caught on an old vehicle model which respond 0x7F, 0x01, 0x12 due to requesting PID 0xC0.

Expected behavior

  1. Software shall not request more than six PIDs at one time.
  2. Although ECU respond 0x7F, 0x01, 0x12 for PID 0xC0, software shall still get the supported PIDs in other ranges.

Fix Moved the extra PID range (0xC0, 0xE0) request to the second message

Logs Before the fix. The log collected from vehicle whose ECU follow ISO 14230

[TRACE] [OBDOverCANModule::doWork]: [Requesting Supported PIDs from Engine ECU]
[TRACE] [OBDOverCANModule::requestSupportedPIDs]: [send supported PID requests]
[TRACE] [OBDOverCANModule::requestSupportedPIDs]: [TxPDU: 1,0,32,64,96,128,160,192]
[TRACE] [ISOTPOverCANSenderReceiver::sendPDU]: [ sent a PDU of size:8]
[TRACE] [ISOTPOverCANSenderReceiver::receivePDU]: [ Received a PDU of size:3]
[TRACE] [OBDOverCANModule::receiveSupportedPIDs]: [ECU Response: 127,1,18]
[WARN] [OBDDataDecoder::decodeSupportedPIDs]: [Invalid Supported PID Input]
[ERROR] [OBDOverCANModule::doWork]: [Failed to request/receive Engine ECU PIDs for SID: 1]

After the fix. Software can correctly handle the ECU response

[TRACE] [OBDOverCANModule::doWork]: [Requesting Supported PIDs from Engine ECU]
[TRACE] [OBDOverCANModule::requestReceiveSupportedPIDs]: [send supported PID requests]
[TRACE] [OBDOverCANModule::requestPIDs]: [Transmit PDU: 1,0,32,64,96,128,160]
[TRACE] [ISOTPOverCANSenderReceiver::sendPDU]: [ sent a PDU of size:7]
[TRACE] [ISOTPOverCANSenderReceiver::receivePDU]: [ Received a PDU of size:21]
[TRACE] [OBDOverCANModule::receiveSupportedPIDs]: [ECU Response: 65,0,191,190,168,147,32,145,7,224,25,64,250,220,128,1,96,4,0,0,0]
[TRACE] [OBDOverCANModule::requestPIDs]: [Transmit PDU: 1,192,224]
[TRACE] [ISOTPOverCANSenderReceiver::sendPDU]: [ sent a PDU of size:3]
[TRACE] [ISOTPOverCANSenderReceiver::receivePDU]: [ Received a PDU of size:3]
[TRACE] [OBDOverCANModule::receiveSupportedPIDs]: [ECU Response: 127,1,18]
[WARN] [OBDDataDecoder::decodeSupportedPIDs]: [Invalid Supported PID Input]
[TRACE] [OBDOverCANModule::doWork]: [Engine ECU supports PIDs for SID 1: 1,3,4,5,6,7,8,9,11,12,13,14,15,17,19,21,25,28,31,33,36,40,46,47,48,49,50,51,60,61,65,66,67,68,69,71,73,74,76,77,78,81,102]

Tested on newer model of vehicle with ISO15765

[TRACE] [OBDOverCANModule::doWork]: [Requesting Supported PIDs from Engine ECU]
[TRACE] [OBDOverCANModule::requestReceiveSupportedPIDs]: [send supported PID requests]
[TRACE] [OBDOverCANModule::requestPIDs]: [Transmit PDU: 1,0,32,64,96,128,160]
[TRACE] [ISOTPOverCANSenderReceiver::sendPDU]: [ sent a PDU of size:7]
[TRACE] [ISOTPOverCANSenderReceiver::receivePDU]: [ Received a PDU of size:21]
[TRACE] [OBDOverCANModule::receiveSupportedPIDs]: [ECU Response: 65,0,190,61,168,19,32,144,31,176,17,64,254,220,160,81,96,9,8,0,0]
[TRACE] [OBDOverCANModule::requestPIDs]: [Transmit PDU: 1,192,224]
[TRACE] [ISOTPOverCANSenderReceiver::sendPDU]: [ sent a PDU of size:3]
[TRACE] [OBDOverCANModule::doWork]: [Engine ECU supports PIDs for SID 1: 1,3,4,5,6,7,11,12,13,14,16,17,19,21,28,31,33,36,44,45,46,47,48,49,51,52,60,65,66,67,68,69,70,71,73,74,76,77,78,81,83,90,92,101,104,109]

Environment (please complete the following information):

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.