MSGPROTOCOL_FIXED_NORMAL no ISO TP flow control

A free API for the communication with control devices according to UDS (ISO 14229-1)
Post Reply
meetryy
Posts: 3
Joined: Tue 5. Mar 2024, 11:39

MSGPROTOCOL_FIXED_NORMAL no ISO TP flow control

Post by meetryy » Tue 5. Mar 2024, 12:19

Please, help me with resolving the following problem:
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);
 }
 
Every res is PUDS_STATUS_OK, so I assume configuration is passed to API correctly.

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);
And as a result, this CAN trace appears:

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)
ISO-TP parameters PUDS_PARAMETER_BLOCK_SIZE, PUDS_PARAMETER_SEPARATION_TIME, PUDS_PARAMETER_SERVER_ADDRESS are set explicitly, yet ISO-TP Rx doesn't function.

It's clear that I'm missing something in configuration step, but what exactly?

Thanks in advance!

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: MSGPROTOCOL_FIXED_NORMAL no ISO TP flow control

Post by M.Maidhof » Tue 5. Mar 2024, 12:37

Hello,

please send an email to our support address with a photo showing the PCAN hardware serial number sticker, to be able to handle your support request correctly.

regards

Michael

meetryy
Posts: 3
Joined: Tue 5. Mar 2024, 11:39

Re: MSGPROTOCOL_FIXED_NORMAL no ISO TP flow control

Post by meetryy » Tue 5. Mar 2024, 16:22

Michael, thanks for reaching out.
It seems like I have bare P-CAN USB adapter, without any s/n imformation, and packaging long gone.
How can we resolve this?

Flow control seems to work for other forum members, though they use 11bit IDs mainly.

meetryy
Posts: 3
Joined: Tue 5. Mar 2024, 11:39

Re: MSGPROTOCOL_FIXED_NORMAL no ISO TP flow control

Post by meetryy » Tue 5. Mar 2024, 17:29

Can confirm client wasn't emitting correct CTS due to malformed First Frame by server (incorrect DL, byte 2).
Works as intended now.

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: MSGPROTOCOL_FIXED_NORMAL no ISO TP flow control

Post by M.Maidhof » Wed 6. Mar 2024, 09:52

Please send an email with a photo of your PCAN hardware to our support email address with your company details.

regards

Michael

Post Reply