C# CCP Connect with Key

A free API for the Communication with Control Units based on the CAN Calibration Protocol (CCP) by ASAM for Windows®
Post Reply
sammonsd
Posts: 2
Joined: Tue 26. Aug 2014, 14:17

C# CCP Connect with Key

Post by sammonsd » Fri 31. Oct 2014, 16:12

Is it possible to add to the commands?

For instance if i'm trying to connect to a specific loader using the connect command with a key in bytes 3-8 similar to:
01 00 23 58 D2 22 90 99

How would I go about building this message using your C# CCP API?

Thanks

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

Re: C# CCP Connect with Key

Post by K.Wagner » Fri 31. Oct 2014, 16:27

Hello,

This information is passed to the PCAN-CCP Api using a structure defined for it. The Api comes together with sample code in different programming languages, one of them is C#. Please look at it for more information.
Best regards,
Keneth

sammonsd
Posts: 2
Joined: Tue 26. Aug 2014, 14:17

Re: C# CCP Connect with Key

Post by sammonsd » Fri 31. Oct 2014, 17:06

Hi there,

Thanks for the quick reply.

I have reviewed the included C# materials in great detail but I am still missing something then. With the following code:

CCPResult result = new CCPResult(CCPApi.Connect(m_Channel, ref m_SlaveData, out m_PccpHandle, 1000));

Connect is merely looking for:

[DllImport("PCCP.dll", EntryPoint = "CCP_Connect")]
public static extern TCCPResult Connect(
[MarshalAs(UnmanagedType.U1)]
TPCANHandle Channel,
ref TCCPSlaveData SlaveData,
out TCCPHandle CcpHandle,
ushort TimeOut);


the CCPApi command constructors do not include a "Data" field to include additional data - so I can only assume that the first 3 data bytes matter (Command Code, Command Counter, Station Address) and the remaining cannot be edited.

If i'm mistaken I would love help understanding how to do this.

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

Re: C# CCP Connect with Key

Post by K.Wagner » Fri 31. Oct 2014, 17:25

OK, now I understand what you mind. First of all, each function of CCP represents each CCP Command. For this, CCP commands are sent automatically. Here the introduction Text of the companion Help from PCAN-CCP API:

PCAN-CCP Documentation->Introduction->About PCAN-CCP->CCP Commands vs. API Funcitons

Code: Select all

Command Transmission: 

The CCP API provides one function for each CCP command described within the document “CAN Calibration Protocol Version 2.1” from ASAP. In this way, calling a function causes:

*The sending of the associated command with its parameters, if it has some. 
*The synchronnous wait for the DTO (response) to the command sent. 
*In case of a positive response, the return of the information associated to that command. 
*In case of a negative response, the error code as function returned code. 
From your first example:
sammonsd wrote:01 00 23 58 D2 22 90 99
  • 01 is automatically sent withint the function command CCP_Connect. 01 --> Command Code CONNECT 0x01
  • 00 is internally used, that is, you don't need to pass this neather.00 --> Command Counter = CTR
  • 23 58 is the ECU Address which receives the command (included within the TCCPSlaveData structure passed to the CCP_Connect function). 23 58 --> station address
  • D2 22 90 99 This is not used. The Specification says: "4...7 bytes don't care"
Please understand that we apply the specifications. We don't want to force things that are not defined in the document.
Best regards,
Keneth

Post Reply