CanTpApi.Initialize takes very long (+30s)

A free API for the transfer of data packages according to ISO-TP (ISO 15765-2)
Post Reply
User avatar
barry
Posts: 16
Joined: Mon 18. May 2015, 14:17

CanTpApi.Initialize takes very long (+30s)

Post by barry » Thu 30. Mar 2017, 09:09

Any idea why the first time for every channel the cantpapi.init takes ages (+30s).... we have 4 can cards in our pc... so it will take up to 4x30s ....

Code is very simple ... see below ...

public int SetupCommunication(int channel)
{
//----------------------------
// setup uds connection
//----------------------------
byte canchannel = (byte)(0x40 | channel);

//init UDS connection

TPCANTPStatus sts;

// Connects to the selected PCAN-ISO-TP channel.
sts = CanTpApi.Initialize(canchannel, TPCANTPBaudrate.PCANTP_BAUD_33K);
Trace.WriteLine(string.Format("CANTP INIT : {0}",sts));

//do mappings
sts = CanTpApi.Reset(canchannel);
Trace.WriteLine(string.Format("CANTP RESET : {0}", sts));
sts = CanTpApi.RemoveMapping(canchannel, 0x24c);
sts = CanTpApi.RemoveMapping(canchannel, 0x64c);

sts = CanTpApi.AddMapping(canchannel, 0x24c, 0x64c,
TPCANTPIdType.PCANTP_ID_CAN_11BIT, TPCANTPFormatType.PCANTP_FORMAT_NORMAL,
TPCANTPMessageType.PCANTP_MESSAGE_DIAGNOSTIC,
0x1a,
0x1b,
TPCANTPAddressingType.PCANTP_ADDRESSING_PHYSICAL, 0x00);
Trace.WriteLine(string.Format("CANTP MAP1 : {0}", sts));

sts = CanTpApi.AddMapping(canchannel, 0x64c, 0x24c,
TPCANTPIdType.PCANTP_ID_CAN_11BIT, TPCANTPFormatType.PCANTP_FORMAT_NORMAL,
TPCANTPMessageType.PCANTP_MESSAGE_DIAGNOSTIC,
0x1b,
0x1a,
TPCANTPAddressingType.PCANTP_ADDRESSING_PHYSICAL, 0x00);
Trace.WriteLine(string.Format("CANTP MAP2 : {0}", sts));
return 0;
}

K.Wagner
Software Development
Software Development
Posts: 767
Joined: Wed 22. Sep 2010, 13:36

Re: CanTpApi.Initialize takes very long (+30s)

Post by K.Wagner » Thu 30. Mar 2017, 09:38

Hello,

we have tested your code on a PC running Windows 10 - x64 (PCI-Express FD), compiled with C++ and C#. Both works without problems, i.e. there is no delay at connect. Please check the following on your side:
  • PCAN-Basic version being used. The last verison is 4.1.0. If your version is older, please update it.
  • PCAN-ISO-TP verison being used. The last version is 2.0.0. If your version is older, please update it.
Which Windows verison and platform are you using? Please note that in some systems (Windows Vista, Windows 7) .NET Framework can sometimes get kind of corrupted, so things don't work propertly. Repairing or re-installing .NET may help.
Best regards,
Keneth

User avatar
barry
Posts: 16
Joined: Mon 18. May 2015, 14:17

Re: CanTpApi.Initialize takes very long (+30s)

Post by barry » Thu 30. Mar 2017, 10:03

We will update the APIs... they seems to be very old ... keep you posted...

csgyorgy
Posts: 5
Joined: Thu 1. Dec 2016, 17:16

Re: CanTpApi.Initialize takes very long (+30s)

Post by csgyorgy » Tue 12. Feb 2019, 11:38

Hi Barry,
We have similar issue, have you succeeded to solve it? We have installed the newest APIs but without success. Interestlingly is somehow related to the network connection. Some stations at development phase in the development shoplfloor never had this problem but once moved to production floor where the network is limited the issue started, but not all stations, this is again weird.

K.Wagner
Software Development
Software Development
Posts: 767
Joined: Wed 22. Sep 2010, 13:36

Re: CanTpApi.Initialize takes very long (+30s)

Post by K.Wagner » Tue 12. Feb 2019, 12:20

Hello,

are you also using the PCAN-UDS API?
Best regards,
Keneth

Post Reply