UDS API
-
- Posts: 7
- Joined: Mon 7. Jan 2019, 07:05
UDS API
Dear Friend
Recently I have used UDS API to send some services.I have a question confusing me .when I send UDS_SvcDiagnosticSessioncontrol service TesterPresent service will be send in periods.The testerPresent service's ID is physical .I want to know How to change its Id to function. I don't see API used testerPresent service but it send this service. I hope you can help me solve this problem.Thank you very much
best wishes
Recently I have used UDS API to send some services.I have a question confusing me .when I send UDS_SvcDiagnosticSessioncontrol service TesterPresent service will be send in periods.The testerPresent service's ID is physical .I want to know How to change its Id to function. I don't see API used testerPresent service but it send this service. I hope you can help me solve this problem.Thank you very much
best wishes
Re: UDS API
Best regards,
Keneth
Keneth
-
- Posts: 7
- Joined: Mon 7. Jan 2019, 07:05
Re: UDS API
Dear
Maybe I don't express my request clearly. I don't want to know how to mapping between ECU and Client.After I send 0x10 03 service 0x3E 80 service will be following .And the type of ID 0x3e service is physical ,I want to change this service's Id type only .I want to know how 0x3E service worked.
best wishes
Maybe I don't express my request clearly. I don't want to know how to mapping between ECU and Client.After I send 0x10 03 service 0x3E 80 service will be following .And the type of ID 0x3e service is physical ,I want to change this service's Id type only .I want to know how 0x3E service worked.
best wishes
-
- Posts: 7
- Joined: Mon 7. Jan 2019, 07:05
Re: UDS API
Dear
As we all know ,after send 0x10 service,0x3e service send automatic.I want to know how to change this automatic service 's AddressingType
As we all know ,after send 0x10 service,0x3e service send automatic.I want to know how to change this automatic service 's AddressingType
Re: UDS API
Hello,
ok, if I (now) understand well, you want to configure your diagnostic session to use a functional address for tester present, right? For this, you need to re-configure the current session information to specify the functional address. This is done using the function UDS_SetValue and the parameter PUDS_PARAM_SESSION_INFO - (PCAN-UDS API - User Manual, page 35).
ok, if I (now) understand well, you want to configure your diagnostic session to use a functional address for tester present, right? For this, you need to re-configure the current session information to specify the functional address. This is done using the function UDS_SetValue and the parameter PUDS_PARAM_SESSION_INFO - (PCAN-UDS API - User Manual, page 35).
Best regards,
Keneth
Keneth
-
- Posts: 7
- Joined: Mon 7. Jan 2019, 07:05
Re: UDS API
Dear
like this ?
like this ?
Code: Select all
TPUDSStatus status;
status = UDSApi.SvcDiagnosticSessionControl(m_PcanHandle, ref UDSMsg, UDSApi.TPUDSSvcParamDSC.PUDS_SVC_PARAM_DSC_ECUEDS);
if (status == TPUDSStatus.PUDS_ERROR_OK)
{
status = UDSApi.WaitForService(m_PcanHandle, out ResponseMsg, ref UDSMsg, out UDSMsg);
if (status == TPUDSStatus.PUDS_ERROR_OK)
{
TPUDSSessionInfo sessionInfo = new TPUDSSessionInfo();
int sessionSize;
IntPtr sessionPtr;
sessionInfo.NETADDRINFO.SA = 0xF1;
sessionInfo.NETADDRINFO.TA = 0x00;
sessionInfo.NETADDRINFO.TA_TYPE = TPUDSAddressingType.PUDS_ADDRESSING_PHYSICAL;
sessionInfo.NETADDRINFO.RA = 0x00;
sessionInfo.NETADDRINFO.PROTOCOL = TPUDSProtocol.PUDS_PROTOCOL_ISO_15765_2_11B;
sessionSize = Marshal.SizeOf(sessionInfo);
sessionPtr = Marshal.AllocHGlobal(sessionSize);
Marshal.StructureToPtr(sessionInfo, sessionPtr, false);
status = UDSApi.GetValue(m_PcanHandle, TPUDSParameter.PUDS_PARAM_SESSION_INFO, sessionPtr, (uint)sessionSize);
sessionInfo.SESSION_TYPE = (byte)UDSApi.TPUDSSvcParamDSC.PUDS_SVC_PARAM_DSC_DS;
status = UDSApi.SetValue(m_PcanHandle, TPUDSParameter.PUDS_PARAM_SESSION_INFO, sessionPtr, (uint)sessionSize);
}
}
}
Last edited by M.Gerber on Mon 7. Jan 2019, 10:37, edited 1 time in total.
Reason: Inserted code tag for improved readability
Reason: Inserted code tag for improved readability
Re: UDS API
Hello
yes, kind of. Just remember to set the sessionInfo.NETADDRINFO.TA_TYPE to Functional.
Please note that the solution was actually in the very first answer you have received from my colleague U.Wilhelm: [Disable TesterPresent].
yes, kind of. Just remember to set the sessionInfo.NETADDRINFO.TA_TYPE to Functional.
Please note that the solution was actually in the very first answer you have received from my colleague U.Wilhelm: [Disable TesterPresent].
Best regards,
Keneth
Keneth
-
- Posts: 7
- Joined: Mon 7. Jan 2019, 07:05
Re: UDS API
Dear
need I to change sessionInfo.SESSION_TYPE = (byte)UDSApi.TPUDSSvcParamDSC.PUDS_SVC_PARAM_DSC_ECUEDS or PUDS_SVC_PARAM_DSC_ECUPS? if I set it as PUDS_SVC_PARAM_DSC_DS,is it mean disable TesterPresent Automatic?
best wishes
need I to change sessionInfo.SESSION_TYPE = (byte)UDSApi.TPUDSSvcParamDSC.PUDS_SVC_PARAM_DSC_ECUEDS or PUDS_SVC_PARAM_DSC_ECUPS? if I set it as PUDS_SVC_PARAM_DSC_DS,is it mean disable TesterPresent Automatic?
best wishes
Re: UDS API
You need to disable it in order to configured again. Basically, you need to follow these staps
- Get the current session:
Code: Select all
UDS_GetValue(Channel, PUDS_PARAM_SESSION_INFO, &sessionInfo, sizeof(TPUDSSessionInfo));
- Disable the TesterPresent
Code: Select all
sessionInfo.SESSION_TYPE = PUDS_SVC_PARAM_DSC_DS; result = UDS_SetValue(Channel, PUDS_PARAM_SESSION_INFO, &sessionInfo, sizeof(TPUDSSessionInfo));
- Configure the NETADDRINFO as needed, e.g. as functional:
Code: Select all
... sessionInfo.NETADDRINFO.TA_TYPE = TPUDSAddressingType.PUDS_ADDRESSING_FUNCTIONAL; sessionInfo.NETADDRINFO.TA = 0xXX; // needs to match with your defined mapping ...
- Set the SESSION_TYPE to anything different than "PUDS_SVC_PARAM_DSC_DS" to activate the TesterPresent again with the new parameters.
Code: Select all
sessionInfo.SESSION_TYPE = PUDS_SVC_PARAM_XXX; result = UDS_SetValue(Channel, PUDS_PARAM_SESSION_INFO, &session, sizeof(TPUDSSessionInfo));
- Check that the automatic TesterPresent is enabled and using functional addressing
Best regards,
Keneth
Keneth
-
- Posts: 7
- Joined: Mon 7. Jan 2019, 07:05
Re: UDS API
Dear
Unluckly,I set it like you follwing s,but it is not worked ,the AddressType unchanged.
I don't know where is wrong?
Unluckly,I set it like you follwing s,but it is not worked ,the AddressType unchanged.
Code: Select all
TPUDSSessionInfo sessionInfo = new TPUDSSessionInfo();
int sessionSize;
IntPtr sessionPtr;
sessionInfo.NETADDRINFO.SA = 0xF1;
sessionInfo.NETADDRINFO.TA = (byte)TPUDSAddress.PUDS_ISO_15765_4_ADDR_OBD_FUNCTIONAL;
sessionInfo.NETADDRINFO.TA_TYPE = TPUDSAddressingType.PUDS_ADDRESSING_FUNCTIONAL;
sessionInfo.NETADDRINFO.RA = 0x00;
sessionInfo.NETADDRINFO.PROTOCOL = TPUDSProtocol.PUDS_PROTOCOL_ISO_15765_2_11B;
sessionSize = Marshal.SizeOf(sessionInfo);
sessionPtr = Marshal.AllocHGlobal(sessionSize);
Marshal.StructureToPtr(sessionInfo, sessionPtr, false);
status = UDSApi.GetValue(m_PcanHandle, TPUDSParameter.PUDS_PARAM_SESSION_INFO, sessionPtr, (uint)sessionSize);
sessionInfo.SESSION_TYPE = (byte)UDSApi.TPUDSSvcParamDSC.PUDS_SVC_PARAM_DSC_DS;
status = UDSApi.SetValue(m_PcanHandle, TPUDSParameter.PUDS_PARAM_SESSION_INFO, sessionPtr, (uint)sessionSize);
sessionInfo.SESSION_TYPE = (byte)UDSApi.TPUDSSvcParamDSC.PUDS_SVC_PARAM_DSC_ECUEDS;
status = UDSApi.SetValue(m_PcanHandle, TPUDSParameter.PUDS_PARAM_SESSION_INFO, sessionPtr, (uint)sessionSize);