The automatic TesterPresent using functional addressing

A free API for the communication with control devices according to UDS (ISO 14229-1)
Post Reply
NaoyaImai
Posts: 2
Joined: Mon 19. Apr 2021, 04:38

The automatic TesterPresent using functional addressing

Post by NaoyaImai » Sat 13. Nov 2021, 12:07

Hello,
I have a question about the automatic TesterPresent on PCAN-UDS API(2.1.0).
I could find out how to enable automatic TesterPresent using physical addressing in "PCAN-UDS 2.x API – User Manual page 42", but could not find any information about functional addressing.
Is it possible to use functional addressing on automatic TesterPresent?

F.Vergnaud
Software Development
Software Development
Posts: 305
Joined: Mon 9. Sep 2013, 12:21

Re: The automatic TesterPresent using functional addressing

Post by F.Vergnaud » Mon 15. Nov 2021, 10:41

Hello,

Automatic TesterPresent is indeed not enabled by default with functional requests. You have to manually force this setting by registering a custom session.
Check parameter PUDS_PARAMETER_SESSION_INFO and example 02_client_request_ecu_reset_USDT to see how to force a custom session.

In your case, you'll have to modify the following example's code to match your needs:

Code: Select all

	// Initialize new session info
	new_sessioninfo.can_msg_type = PCANTP_CAN_MSGTYPE_STANDARD;
	new_sessioninfo.session_type = 0x05;
	new_sessioninfo.timeout_p2can_server_max = 1;
	new_sessioninfo.timeout_enhanced_p2can_server_max = 2;
	new_sessioninfo.s3_client_ms = 8;
	new_sessioninfo.nai = SOME_FUNCTIONAL_NAI;      /// <=== ADAPT CODE HERE to have a Network Address Information using functional addressing

	// Set new session info
	status = UDS_SetValue_2013(tp_handle, PUDS_PARAMETER_SESSION_INFO, &new_sessioninfo, sizeof(uds_sessioninfo));
	printf("Set new session info: %s\n", STATUS_OK_KO(status));
	
	[...]
Best regards,
Fabrice

NaoyaImai
Posts: 2
Joined: Mon 19. Apr 2021, 04:38

Re: The automatic TesterPresent using functional addressing

Post by NaoyaImai » Tue 28. Dec 2021, 05:29

Thanks for your advice.
I could enable automatic TesterPresent using functional addressing with the following code.

Code: Select all

            uds_sessioninfo new_sessioninfo;
            new_sessioninfo.can_msg_type = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_EXTENDED;
            new_sessioninfo.session_type = 0x05;
            new_sessioninfo.timeout_p2can_server_max = 50;
            new_sessioninfo.timeout_enhanced_p2can_server_max = 500;
            new_sessioninfo.s3_client_ms = 2000;
            new_sessioninfo.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL;
            new_sessioninfo.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_FUNCTIONAL;
            new_sessioninfo.nai.source_addr = (UInt16)0xF1;  // for example
            new_sessioninfo.nai.target_addr = (UInt16)0xFF;  // for example
            new_sessioninfo.nai.extension_addr = 0;

Post Reply