I have an ECU with ISO-TP/UDS with non standard CAN-ID 29Bit and normal adressing.
The ID´s for Request and Response are as follows:
Code: Select all
UInt32 Diag_BT_1_Req = 0x17FC0647;
UInt32 Diag_BT_1_Resp = 0x17FE0647; //Please note source and target are still at same position which is correct
byte SourceAdr = 0x47; //for this application (non standard ECU)
byte TargetAdr = 0x06;
The request is sent to the bus correct, even the Flow Control Frame is generated ok.
I checked also the response from the ECU: The 33 bytes can be seen on the bus with proper ISO-TP handling.
But the UDSApi.WaitForService() function obviously doesn´t see anything on the bus, because it returns with error 7 (no message).
I further found out that only the last added mapping is used for generating the requests to the ECU. That´s why in this last mapping I call: MappingStatus(Diag_BT_1_Req, Diag_BT_1_Resp, //Diag_BT_1_Req is first!!
So I think the mapping for the response part cannot be found by the library due to some reason. May be because it cannot be distinguished due to the NONE swapped source and target adresses?
So must likely I did some mistake in defining the two mappings below:
Code: Select all
UInt32 iBuffer;
TPUDSStatus stsResult;
CanHdlUDS = UDSApi.PUDS_USBBUS1;
stsResult = UDSApi.Initialize(CanHdlUDS, TPUDSBaudrate.PUDS_BAUD_500K);
MappingStatus mapping2 = new MappingStatus(Diag_BT_1_Resp, Diag_BT_1_Req,
TPCANTPIdType.PCANTP_ID_CAN_29BIT,
TPCANTPFormatType.PCANTP_FORMAT_NORMAL,
TPCANTPMessageType.PCANTP_MESSAGE_DIAGNOSTIC,
TPCANTPAddressingType.PCANTP_ADDRESSING_PHYSICAL,
SourceAdr,
TargetAdr);
mappingsAdd(CanHdlUDS, mapping2);
MappingStatus mapping1 = new MappingStatus(Diag_BT_1_Req, Diag_BT_1_Resp,
TPCANTPIdType.PCANTP_ID_CAN_29BIT,
TPCANTPFormatType.PCANTP_FORMAT_NORMAL,
TPCANTPMessageType.PCANTP_MESSAGE_DIAGNOSTIC,
TPCANTPAddressingType.PCANTP_ADDRESSING_PHYSICAL,
SourceAdr,
TargetAdr);
mappingsAdd(CanHdlUDS, mapping1);
TPUDSMsg request = new TPUDSMsg();
TPUDSMsg requestConfirmation = new TPUDSMsg();
TPUDSMsg response = new TPUDSMsg();
// initialization
request.NETADDRINFO.SA = SourceAdr;
request.NETADDRINFO.TA = TargetAdr;
request.NETADDRINFO.TA_TYPE = TPUDSAddressingType.PUDS_ADDRESSING_PHYSICAL;
request.NETADDRINFO.RA = 0x00;
request.NETADDRINFO.PROTOCOL = TPUDSProtocol.PUDS_PROTOCOL_ISO_15765_2_29B_NORMAL;
// Sends a Physical ReadDataByIdentifier Request
ushort[] buffer = { 0xFD54};
stsResult = UDSApi.SvcReadDataByIdentifier(CanHdlUDS, ref request, buffer, (ushort)buffer.Length);
if (stsResult == TPUDSStatus.PUDS_ERROR_OK)
stsResult = UDSApi.WaitForService(CanHdlUDS, out response, ref request, out requestConfirmation);
if (stsResult == TPUDSStatus.PUDS_ERROR_OK)
new MsgBox("","Response was received.").Show();
else
// An error occurred
new MsgBox("",String.Format("Error occured: {0}", (int)stsResult)).Show();
Andy