PCAN-UDS API 2.1.0 does not enable automatic TesterPresent by default for functional requests. Enable it by registering a custom session with PUDS_PARAMETER_SESSION_INFO and assigning functional Network Address Information (NAI).
Why Functional TesterPresent Requires a Custom Session
The documented physical-addressing setup does not automatically cover functional requests. For functional addressing, create an uds_sessioninfo structure, set its session and timing fields, configure its NAI as functional, and register it through UDS_SetValue_2013.
Configure the Functional Session
The following configuration was reported to enable automatic TesterPresent. The address and timing values belong to that configuration; verify them against the target ECU and network rather than treating them as universal defaults.
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;
new_sessioninfo.nai.target_addr = (UInt16)0xFF;
new_sessioninfo.nai.extension_addr = 0;
status = UDS_SetValue_2013(
tp_handle,
PUDS_PARAMETER_SESSION_INFO,
&new_sessioninfo,
sizeof(uds_sessioninfo));
Register and Verify the Session
- Adapt
can_msg_type,session_type, timing fields, protocol, and NAI addresses to the actual diagnostic network. - Set
new_sessioninfo.nai.target_typetoPCANTP_ISOTP_ADDRESSING_FUNCTIONAL. - Call
UDS_SetValue_2013withPUDS_PARAMETER_SESSION_INFOand confirm that the returnedstatusindicates success. - Verify on the diagnostic network that automatic TesterPresent traffic uses the configured functional addressing and the required
s3_client_msinterval.
| Field | Evidence-backed configuration | Engineering decision |
|---|---|---|
can_msg_type |
PCANTP_CAN_MSGTYPE_EXTENDED |
Match the CAN message format. |
session_type |
0x05 |
Match the required diagnostic session. |
s3_client_ms |
2000 |
Verify against the required session-maintenance interval. |
nai.protocol |
PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL |
Match the network protocol. |
nai.target_type |
PCANTP_ISOTP_ADDRESSING_FUNCTIONAL |
Required to select functional addressing. |
| Source and target |
0xF1 and 0xFF
|
Example values; replace them when the network uses different addresses. |
FAQ
Does PCAN-UDS 2.1.0 enable functional TesterPresent automatically?
No. Automatic TesterPresent is not enabled by default for functional requests; register a custom session through PUDS_PARAMETER_SESSION_INFO.
Which setting selects functional addressing for TesterPresent?
Set new_sessioninfo.nai.target_type to PCANTP_ISOTP_ADDRESSING_FUNCTIONAL before registering the session.
How do I verify that the custom TesterPresent session was accepted?
Check the status returned by UDS_SetValue_2013, then confirm that TesterPresent traffic uses the configured functional NAI and s3_client_ms interval.