TesterPresent with response.

A free API for the communication with control devices according to UDS (ISO 14229-1)
Post Reply
irfanR
Posts: 1
Joined: Fri 19. Jan 2024, 05:02

TesterPresent with response.

Post by irfanR » Fri 19. Jan 2024, 05:23

Hi,

I would like to send the service 3E 00 and read the response in order to determine whether the ECU is powered or not, and automatically disconnect my tool from the ECU.

How can I change this in the PCAN-UDS 2.x API for C#? Currently it is sending 3E 80 with no parameter when i call SvcTesterPresent_2013 (from my understanding) to change this.

Thanks!

K.Wagner
Software Development
Software Development
Posts: 1080
Joined: Wed 22. Sep 2010, 13:36

Re: TesterPresent with response.

Post by K.Wagner » Fri 19. Jan 2024, 12:06

Hello,

when sending 3E 80 you are instructing the ECU to not send a response for the TesterPresent request. This looks like the follow in C#:

Code: Select all

cantp_handle client_handle;
uds_msgconfig config = new uds_msgconfig();

// Set the PCAN-Channel to use
client_handle = cantp_handle.PCANTP_HANDLE_USBBUS1;

// Initializing of the UDS Communication session
status = UDSApi.Initialize_2013(client_handle, cantp_baudrate.PCANTP_BAUDRATE_500K);

// Define Network Address Information used for all the tests
config.can_id = (UInt32)0xFFFFFFFF;
config.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
config.nai.source_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;

config.type = uds_msgtype.PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE;
// "Sends a physical TesterPresent message with no positive response"
uds_status status = UDSApi.SvcTesterPresent_2013(channel, config, out request, UDSApi.uds_svc_param_tp.PUDS_SVC_PARAM_TP_ZSUBF);
To determine if an ECU is powered or not as you describe, you should rather check the response. If a timeout occurs, then it is not powered up. For this just send a physical TesterPresent request and avoid using the flag PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE.

Code: Select all

.....

// "Sends a physical TesterPresent message"
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
status = UDSApi.SvcTesterPresent_2013(channel, config, out request, UDSApi.uds_svc_param_tp.PUDS_SVC_PARAM_TP_ZSUBF);
if (UDSApi.StatusIsOk_2013(status))
    status = UDSApi.WaitForService_2013(channel, ref request, out response, out confirmation);
Console.WriteLine(" UDS_SvcTesterPresent_2013: {0}", (int)status);
if (UDSApi.StatusIsOk_2013(status))
    // "ECU is active"
    ;
else
   // / NO UDS RESPONSE !! ECU is not powered. 
    ;
Best regards,
Keneth

Post Reply