Page 1 of 1
Disable TesterPresent
Posted: Fri 25. Sep 2015, 11:05
by tr.gt
Hello,
as mentioned in your documentation it should be possible to disable the periodic TestPresent requests.
Note: this only affects the API client side ONLY, no communication with any ECUs is made. If a user wants
to disable the automatic transmission of TesterPresent requests that keeps alive a non‐default diagnostic
session, he/she should set the SESSION_TYPE to the default diagnostic session
(TPUDSSvcParamDSC.PUDS_SVC_PARAM_DSC_DS).
It is assumed that the channel was already initialized and the user retrieved the current session
information with the GetValue API function.
We have the problem as mentioned in earlier posts, that the ECU has some problems with successive TransferData requests and responses. Our partner how did the ECU UDS counterpart says while waiting for a response the TestPresent requests could be a problem. So we want to disable them for testing.
Here's the code, but it does not seem to work. We still get TesterPresent while waiting for responses.
Code: Select all
TPUDSSessionInfo session = {};
TPUDSStatuss = UDS_GetValue( ch, PUDS_PARAM_SESSION_INFO, &session, sizeof(TPUDSSessionInfo));
std::cout << "get session: " << PcanUdsUtils::toMessage( s ).toString() << std::endl;
session.SESSION_TYPE = PUDS_SVC_PARAM_DSC_DS;
s = UDS_SetValue( ch, PUDS_PARAM_SESSION_INFO, &session, sizeof(TPUDSSessionInfo));
std::cout << "set session: " << PcanUdsUtils::toMessage( s ).toString() << std::endl;
Do you have any hints, what is the problem here?
Thanks,
Tobias
Re: Disable TesterPresent
Posted: Fri 25. Sep 2015, 11:33
by F.Vergnaud
Hello Tobias,
You need to specify the Network Address Information you want to retrieve when you pass the session parameter to your GetValue function (as it is possible to have multiple sessions with different ECUs at the same time) :
Code: Select all
TPUDSSessionInfo session = {};
// TODO: set the value to your specific case
session.NETADDRINFO.PROTOCOL = PUDS_PROTOCOL_ISO_15765_2_11B;
session.NETADDRINFO.SA = 0xF1;
session.NETADDRINFO.TA = 0x01;
session.NETADDRINFO.TA_TYPE = PUDS_ADDRESSING_PHYSICAL;
session.NETADDRINFO.RA = 0x00;
TPUDSStatuss = UDS_GetValue( ch, PUDS_PARAM_SESSION_INFO, &session, sizeof(TPUDSSessionInfo));
std::cout << "get session: " << PcanUdsUtils::toMessage( s ).toString() << std::endl;
session.SESSION_TYPE = PUDS_SVC_PARAM_DSC_DS;
s = UDS_SetValue( ch, PUDS_PARAM_SESSION_INFO, &session, sizeof(TPUDSSessionInfo));
std::cout << "set session: " << PcanUdsUtils::toMessage( s ).toString() << std::endl;
Re: Disable TesterPresent
Posted: Fri 25. Sep 2015, 13:14
by tr.gt
Great, thanks.
Re: Disable TesterPresent
Posted: Fri 7. Jul 2017, 14:56
by Pascal S.
Hello,
How is it possible to disable the automatic TesterPresent Messages while working with an Extended diagnostic session opened on the ECU?
As mentioned into the ECU documentation, the ECU requires an Extended diagnostic session to run some functions (which cannot been started using a Default session) on it, but the TesterPresent Messages will still been sent every 2 secs. This may cause some communication problems between my test Equipment (PC) and the ECU.
I assume I will have to keep alive the active session on my own. In the ideal case I would be able to set a specific Parameter using setValue().
I will be pleased for any help, screenshots or code snippets and examples about this Topic.
Thank you.
Re: Disable TesterPresent
Posted: Fri 7. Jul 2017, 15:16
by F.Vergnaud
Hello Pascal,
Just check the above discussion which is related to that matter and refer to the documentation on parameter
PUDS_PARAM_SESSION_INFO:
PUDS_PARAM_SESSION_INFO
Description: This parameter is used to read or override the current diagnostic session. The diagnostic session
information is a value which is internally updated when the UDS service UDS_SvcDiagnosticSessionControl is
invoked: it keeps track of the active session and its associated timeouts. If a non‐default diagnostic session is
active, a keep‐alive mechanism (using physically addressed TesterPresent service requests with the “suppress
positive response message” flag) is automatically activated according to UDS standard. If a user wants to
deactivate this mechanism, he/she will have to get the current session information of the client and change the
session type to PUDS_SVC_PARAM_DSC_DS (the default diagnostic session). Be careful that this change will
only affect the client side and the ECU will not be aware of it, moreover the client will have to keep alive the
active session by its own. The user can also define a different session with custom networking parameters, for
instance setting back a non‐default session and providing a NETADDRINFO parameter with functional
addressing will send functionally addressed TesterPresent requests.
And here is a code example:
Code: Select all
// At some point in your application, you must be changing UDS session like such:
result = UDS_SvcDiagnosticSessionControl(Channel, &MsgUDS_WRITE, PUDS_SVC_PARAM_DSC_ECUPS);
if (result == PUDS_ERROR_OK)
result = UDS_WaitForService(Channel, &MsgUDS_READ[0], &MsgUDS_WRITE);
printf(" UDS_SvcDiagnosticSessionControl: %i\n", (int)result);
// Only then the API will send automatic TesterPrent messages !
[...]
// then you can specify to disable it:
TPUDSSessionInfo session;
// 1. You MUST specify the Protocol, SA, TA, etc. to retrieve the corresponding Network Address Information
session.NETADDRINFO.PROTOCOL = PUDS_PROTOCOL_ISO_15765_2_11B;
session.NETADDRINFO.SA = 0xFB;
session.NETADDRINFO.TA = 0x00;
session.NETADDRINFO.TA_TYPE = PUDS_ADDRESSING_PHYSICAL;
session.NETADDRINFO.RA = 0x00;
// 2. You SHOULD ALSO check the result value of this function, if you get PUDS_ERROR_NOT_INITIALIZED, it means that the corresponding session information was not found.
result = UDS_GetValue(Channel, PUDS_PARAM_SESSION_INFO, &session, sizeof(TPUDSSessionInfo));
[...]
//3. Now lure the API by overriding the current session information to a diagnostic session
session.SESSION_TYPE = PUDS_SVC_PARAM_DSC_DS;
result = UDS_SetValue(Channel, PUDS_PARAM_SESSION_INFO, &session, sizeof(TPUDSSessionInfo));
// Check that the automatic TesterPresent is disabled
Re: Disable TesterPresent
Posted: Mon 31. Jul 2017, 15:56
by Pascal S.
Works great. Thank you.
