I am using PCAN-UDS trying to receive both ISO-TP and sigle frame responses to UDS services (in this case, RequestScalingByIdentifier).
Config is the following:
29bit CAN ID, J1939 format, server ID = 0x10, tester ID = 0x20, block size = 32.
If I understand correctly, right configuration of the API will automatically enable ISO-TP Rx, as UDS is higher level API.
My init function is the following: (C#)
Code: Select all
public static cantp_handle tp_handle = cantp_handle.PCANTP_HANDLE_USBBUS1;
private static uds_msgconfig cfg = new uds_msgconfig();
public static uds_status res;
public static UInt32 timeout_request;
public static UInt32 timeout_response;
private static void init()
{
const int BUFFER_SIZE = 256;
StringBuilder buffer = new StringBuilder(BUFFER_SIZE);
// Initialize variables
tp_handle = cantp_handle.PCANTP_HANDLE_USBBUS1;
// Initialize channel
res = UDSApi.Initialize_2013(tp_handle, cantp_baudrate.PCANTP_BAUDRATE_250K);
res = UDSApi.GetValue_2013(tp_handle, uds_parameter.PUDS_PARAMETER_TIMEOUT_REQUEST, out timeout_request, sizeof(UInt32));
UInt32 STmin = 5;
UInt32 bs = 32;
res = UDSApi.SetValue_2013(tp_handle, uds_parameter.PUDS_PARAMETER_BLOCK_SIZE, ref bs, sizeof(UInt32));
res = UDSApi.SetValue_2013(tp_handle, uds_parameter.PUDS_PARAMETER_SEPARATION_TIME, ref STmin, sizeof(UInt32));
res = UDSApi.AddCanIdFilter_2013(tp_handle, 0x18DA1020);
res = UDSApi.AddCanIdFilter_2013(tp_handle, 0x18DA2010);
UInt32 sa = 0x10;
res = UDSApi.SetValue_2013(tp_handle, uds_parameter.PUDS_PARAMETER_SERVER_ADDRESS, ref sa, sizeof(UInt32));
UInt32 addr = 0x20;
res = UDSApi.SetValue_2013(tp_handle, uds_parameter.PUDS_PARAMETER_ADD_LISTENED_ADDRESS, ref addr, sizeof(UInt32));
cfg.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_EXTENDED;
cfg.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL;
cfg.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
cfg.nai.target_addr = (ushort)0x20;
cfg.nai.source_addr = (ushort)0x10;
cfg.nai.extension_addr = 0;
cfg.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
cfg.type = uds_msgtype.PUDS_MSGTYPE_USDT;
CanTpApi.GetValue_2016(cantp_handle.PCANTP_HANDLE_NONEBUS, cantp_parameter.PCANTP_PARAMETER_API_VERSION, buffer, 500);
Console.WriteLine("PCAN-ISO-TP API Version : {0}", buffer);
}
Right after that I call SvcTesterPresent, then WaitForService. This part works OK (see trace below).
And then I request ScalingData, response on which is multipacket by ECU code.
Code: Select all
uds_msg msg_request = new uds_msg();
uds_msg msg_response = new uds_msg();
uds_msg msg_request_confirmation = new uds_msg();
msg_request.type = uds_msgtype.PUDS_MSGTYPE_USDT;
msg_response.type = uds_msgtype.PUDS_MSGTYPE_USDT;
res = UDSApi.SvcReadScalingDataByIdentifier_2013(tp_handle,
cfg,
out msg_request,
(uds_svc_param_di)487
);
res = UDSApi.WaitForService_2013(tp_handle,
ref msg_request,
out msg_response,
out msg_request_confirmation);
Code: Select all
RX 0000277 EFF 18DA2010 8 DAT 02 3E 00 55 55 55 55 55 1223246599 // tester present req
RX 0000278 EFF 18DA1020 8 DAT 02 7E 00 55 55 55 55 55 1223255727 // tester present resp
RX 0000279 EFF 18DA2010 8 DAT 03 24 01 E7 55 55 55 55 1223832865 // scaling data 01E7 req
RX 0000280 EFF 18DA1020 8 DAT 10 01 64 01 E7 51 00 00 1223845760 // scaling data first frame
(here tester has to send flow control frame "CTS" (first byte 0x20, but it doesnt happen)
It's clear that I'm missing something in configuration step, but what exactly?
Thanks in advance!