Page 1 of 1

CanTpApi.Initialize takes very long (+30s)

Posted: Thu 30. Mar 2017, 09:09
by barry
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;
}

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

Posted: Thu 30. Mar 2017, 09:38
by K.Wagner
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.

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

Posted: Thu 30. Mar 2017, 10:03
by barry
We will update the APIs... they seems to be very old ... keep you posted...

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

Posted: Tue 12. Feb 2019, 11:38
by csgyorgy
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.

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

Posted: Tue 12. Feb 2019, 12:20
by K.Wagner
Hello,

are you also using the PCAN-UDS API?