UDS Api Mapping
Posted: Mon 26. Nov 2018, 11:29
Hi,
I am trying to write an application to set data on ECU via UDS Api. However device has custom CAN ID request and response. After setting up connection I get ERROR_NO_MESSAGE on WaitForService() after sending request. In PCAN-View I can see that frame is send on correct CAN ID and there is response which application don't see.
ECU is listening to requests on 0x780 and response on 0x781, baud rate is 500 kBit/s
Code used to configurate device:
and code used to send request and wait for service:
I send PCAN-View trace which confirms that ECU responds.
What can cause the problem that application do not receive message?
I am trying to write an application to set data on ECU via UDS Api. However device has custom CAN ID request and response. After setting up connection I get ERROR_NO_MESSAGE on WaitForService() after sending request. In PCAN-View I can see that frame is send on correct CAN ID and there is response which application don't see.
ECU is listening to requests on 0x780 and response on 0x781, baud rate is 500 kBit/s
Code used to configurate device:
Code: Select all
// Set basic address info
AddressInfo = new TPUDSNetAddrInfo
{
SA = (byte)TPUDSAddress.PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT,
TA = (byte)TPUDSAddress.PUDS_ISO_15765_4_ADDR_ECU_1,
TA_TYPE = TPUDSAddressingType.PUDS_ADDRESSING_PHYSICAL,
RA = 0x00,
PROTOCOL = TPUDSProtocol.PUDS_PROTOCOL_ISO_15765_2_11B
};
// Initialize connection
status = UDSApi.Initialize(Channel, (TPUDSBaudrate)BaudRate.Id);
if (IsError(status))
{
Trace.TraceError("Initialization failed");
return false;
}
// Set this device address
uint buffer = AddressInfo.TA;
status = UDSApi.SetValue(Channel, TPUDSParameter.PUDS_PARAM_SERVER_ADDRESS, ref buffer, 1);
if (IsError(status))
{
Trace.TraceError("Can't set buffer");
return false;
}
TPCANTPStatus s;
// Define ISO-TP communication from ECU to Client (physical responses)
s = CanTpApi.AddMapping(Channel, 0x780, 0x7E0,
TPCANTPIdType.PCANTP_ID_CAN_11BIT,
TPCANTPFormatType.PCANTP_FORMAT_NORMAL,
TPCANTPMessageType.PCANTP_MESSAGE_DIAGNOSTIC,
AddressInfo.SA, AddressInfo.TA,
TPCANTPAddressingType.PCANTP_ADDRESSING_PHYSICAL,
0x00);
// Define ISO-TP communication from Client to ECU (physical requests)
s = CanTpApi.AddMapping(Channel, 0x7E8, 0x781,
TPCANTPIdType.PCANTP_ID_CAN_11BIT,
TPCANTPFormatType.PCANTP_FORMAT_NORMAL,
TPCANTPMessageType.PCANTP_MESSAGE_DIAGNOSTIC,
AddressInfo.TA, AddressInfo.SA,
TPCANTPAddressingType.PCANTP_ADDRESSING_PHYSICAL, 0x00);
Code: Select all
TPUDSStatus status;
TPUDSMsg message = new TPUDSMsg
{
NETADDRINFO = connection.AddressInfo
};
TPUDSMsg messageResponse = new TPUDSMsg();
TPUDSMsg messageBuffer = new TPUDSMsg();
status = UDSApi.SvcDiagnosticSessionControl(connection.Channel, ref message, UDSApi.TPUDSSvcParamDSC.PUDS_SVC_PARAM_DSC_DS);
if (status == TPUDSStatus.PUDS_ERROR_OK)
status = UDSApi.WaitForService(connection.Channel, out messageResponse, ref message, out messageBuffer);
connection.Error = status.ToString();
What can cause the problem that application do not receive message?