Page 1 of 1

How to disabled TesterPresent

Posted: Thu 10. Jan 2019, 10:45
by H.Tina
Dear sir or Mrs

I have a question want to ask for help ,after send SvcDiagnosticSessionControl(10 03) services,then TesterPresent Sevices will be send Automatic in period. I have see someone ask for this question and solve it .so I did as the example by the step .but Why I did not worked
my code as follwing,can you help me changed it

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 = (byte)TPUDSAddress.PUDS_ISO_15765_4_ADDR_ECU_1;
                   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 = (TPUDSSessionInfo)Marshal.PtrToStructure(sessionPtr, typeof(TPUDSSessionInfo));                 
                   Marshal.FreeHGlobal(sessionPtr);
                   sessionInfo.SESSION_TYPE = (byte)UDSApi.TPUDSSvcParamDSC.PUDS_SVC_PARAM_DSC_DS;
                   status = UDSApi.SetValue(m_PcanHandle, TPUDSParameter.PUDS_PARAM_SESSION_INFO, sessionPtr, (uint)sessionSize);                
               }
            }    
I hope can solve this problem,this confusing me a long time

best wishes

Re: How to disabled TesterPresent

Posted: Thu 10. Jan 2019, 12:47
by H.Tina
Dear
Can someone help me .I did like you said in form ,but the result is like this
2F 44 00 44 00 44 00 44
4326) 241919.0 Rx 0706 8 20 00 44 00 44 00 44 00
4327) 241929.3 Rx 0706 8 21 44 00 44 00 44 00 44
4328) 241939.3 Rx 0706 8 22 00 44 00 44 00 55 55
4329) 241939.6 Rx 0706 8 02 3E 80 55 55 55 55 55
4330) 241942.3 Rx 0716 8 03 7F 36 78 00 00 00 00
4331) 241952.3 Rx 0716 8 03 7F 76 11 00 00 00 00
4332) 243802.5 Rx 0706 8 02 3E 80 55 55 55 55 55
3E 30 is still active.How to solve it .Thank you very much

best wishes

Re: How to disabled TesterPresent

Posted: Thu 10. Jan 2019, 15:32
by K.Wagner
Dear,

within the UDS package you will find two sample projects in C++, "PCUClient" and "PCUServer". The PCUClient has in its _tmain function several test-function calls. One of them is "testDiagnosticSessionControl". You can comment out the others and check the behavior of it by starting the server on a PCAN channel and the cleint ina second channel.
Main function of PCUClient.cpp
Main function of PCUClient.cpp
PUDS.PNG (38.68 KiB) Viewed 6014 times
when this function runs, it will first configure a programming session, so that it will start sending the TesterPresent message.
Transmitting TesterPresent
Transmitting TesterPresent
UDS_Transmitting.PNG (47.44 KiB) Viewed 6014 times
After hitting a key it will disable again by configuring the session as DEFAULT. You will see, TesterPresent messages are not transmitted anymore.
TesterPresent is disabled again
TesterPresent is disabled again
UDS_Not_Transmitting.PNG (39.22 KiB) Viewed 6014 times
Please check and understand the code and then port it to your programming language as needed (C#)

Re: How to disabled TesterPresent

Posted: Fri 11. Jan 2019, 07:40
by H.Tina
Dear Sir
I have see the example servel times and did as the example,but TesterPresent still active. the following is my code ,can you take a time to see,and check it ,if is wrong please help me corrected it .Then i will be deeply greetful.Thank you very very very much

Code: Select all

          
TPUDSNetAddrInfo N_AI = new TPUDSNetAddrInfo();
N_AI.SA =(byte)TPUDSAddress.PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ;
N_AI.TA =(byte)TPUDSAddress .PUDS_ISO_15765_4_ADDR_OBD_FUNCTIONAL;
N_AI.TA_TYPE = TPUDSAddressingType.PUDS_ADDRESSING_FUNCTIONAL;
N_AI.RA = 0x00;
N_AI.PROTOCOL = TPUDSProtocol.PUDS_PROTOCOL_ISO_15765_2_11B;
TPUDSMsg UDSMsg = new TPUDSMsg();
TPUDSMsg ResponseMsg = new TPUDSMsg();
UDSMsg.NETADDRINFO = N_AI;
TPUDSStatus status;

status = UDSApi.SvcDiagnosticSessionControl(ch,refUDSMsg,UDSApi.TPUDSSvcParamDSC.PUDS_SVC_PARAM_DSC_ECUEDS);//10 03

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 = (byte)TPUDSAddress.PUDS_ISO_15765_4_ADDR_ECU_1;
        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(ch, TPUDSParameter.PUDS_PARAM_SESSION_INFO, sessionPtr, (uint)sessionSize);
                   sessionInfo.SESSION_TYPE = (byte)UDSApi.TPUDSSvcParamDSC.PUDS_SVC_PARAM_DSC_DS; 
        status = UDSApi.SetValue(ch, TPUDSParameter.PUDS_PARAM_SESSION_INFO, sessionPtr ,(uint)sessionSize);                 
    }
}


best wishes

Re: How to disabled TesterPresent

Posted: Fri 11. Jan 2019, 08:56
by H.Tina
Dear
I have solved this question .Thank you very mush
best wishes

Re: How to disabled TesterPresent

Posted: Tue 15. Sep 2020, 16:48
by omg991
Hi,
i've the same problem that the "tester present" doesn't stopping, how did you solve?

Re: How to disabled TesterPresent

Posted: Wed 16. Sep 2020, 15:22
by K.Wagner
Hello,

please see this post: viewtopic.php?f=182&t=6031