Delphi CCP Problem

A free API for the Communication with Control Units based on the CAN Calibration Protocol (CCP) by ASAM for Windows®
Post Reply
tj_40071
Posts: 7
Joined: Fri 6. Jul 2012, 00:13

Delphi CCP Problem

Post by tj_40071 » Wed 5. Sep 2012, 18:15

Hello,

I purchased the USB/CAN adapter. I have an ECU I am testing. I know it has CCP loaded because of the results in PCAN-View (see attached).

CRO: $18EF02F9, DOT: $18EFF902, ECU Address: $FFFF, Baud Rate: 250K

Using your PCAN-CCP Example written in Delphi I have made the necessary adjustments to the form create (button connect has no adjustments):

procedure TForm1.FormCreate(Sender: TObject);
begin
m_PccpHandle := 0;
m_Channel := TPCANBasic.PCAN_USBBUS1; // PCAN Channel to use
m_Baudrate := PCAN_BAUD_250K;
m_SlaveData.EcuAddress := $FFFF; // ECU Data
m_SlaveData.IdCRO := $18ef02f9;
m_SlaveData.IdDTO := $18eff902;
m_SlaveData.IntelFormat := True;
end;
procedure TForm1.btnConnectClick(Sender: TObject);
var
bConnected: boolean;
ccpResult: TCCPResult;
begin
ccpResult := CCP_Connect(m_Channel, m_SlaveData, m_PccpHandle, 0);
bConnected := ccpResult = CCP_ERROR_ACKNOWLEDGE_OK;
btnConnect.Enabled := (not bConnected);
btnDisconnect.Enabled := bConnected;
btnGetVersion.Enabled := bConnected;
btnExchange.Enabled := bConnected;
btnGetId.Enabled := false;
if (not bConnected) then
if (ccpResult > CCP_ERROR_PCAN) then
ShowMessage(Format('PCAN Error: 0x%X', [(ccpResult and $FFFFFFF)]))
else
ShowMessage(Format('CCP Error: 0x%X', [ccpResult]));
end;

I start the program. The device is recognized. However, when I press "Connect" I get an error:

CCP Error: 0x12

What have I done wrong?
Attachments
PCAN-View.jpg
PCAN-View.jpg (67.56 KiB) Viewed 8113 times

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

Re: Delphi CCP Problem

Post by K.Wagner » Thu 6. Sep 2012, 08:45

Hello tj_40071,

Please check the value of the CRO/DTO Ids you are using. They seem to be Extended-Ids, but their extended bit (Most Significant Bit on each) are not set:
CRO: $18EF02F9 --> $98EF02F9
DTO: $18EFF902 --> $98EFF902

Please check also that you are using the last version of the CCP Api. Here you find information about changes/releases of the PCCP-Api. Using this link you can download the last version 1.0.1.7. Older versions were able to use only one byte for the ECU address (and yours has two, 0xFFFF).

Subscribe to the RSS-Feed to be informed about the latest publications on our website like news, version information, and downloads.
Best regards,
Keneth

tj_40071
Posts: 7
Joined: Fri 6. Jul 2012, 00:13

Re: Delphi CCP Problem

Post by tj_40071 » Fri 7. Sep 2012, 04:47

I have progress. Guess I need to add an extended option.

Connect works. Disconnects works. Test states "ECU is available for connect.

What does not work is
1. Get Version error 0x36 (not available)
2. Exchange Ids error 0x32 (param out of range)
3. Get Slave Id is disabled

Using PCAN-View
1. Get Version - I sent a message and it returned FF,00,01,02,01,00,00,00 which is 2.1 which is correct
2. Exchange Ids - I sent a message and it returned FF,32,00,00,41,40,00 which I guess is the same as 0x32.
3. Get Slave Id - Not sure which command to use.

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

Re: Delphi CCP Problem

Post by K.Wagner » Fri 7. Sep 2012, 09:30

Hello tj_40071,
tj_40071 wrote:1. Get Version error 0x36 (not available)
This error is returned when the ccpHandle passed to the function is invalid. Check what are you passing to the function.
tj_40071 wrote:2. Exchange Ids error 0x32 (param out of range)
This error is returned in two cases: If you try to send more than 6 data bytes within this function, the Api catch this and returns the error 0x32. If the data sent to the ECU is for it to much (configuration dependent), then the ECU returns the error 0x32.
tj_40071 wrote:3. Get Slave Id is disabled
The command EXCHANGE_ID must be first successfully executed. This returns the length of the ID and sets the Memory Transfer Address 0 to the place from where the ID will be read.
tj_40071 wrote:Using PCAN-View
1. Get Version - I sent a message and it returned FF,00,01,02,01,00,00,00 which is 2.1 which is correct
2. Exchange Ids - I sent a message and it returned FF,32,00,00,41,40,00 which I guess is the same as 0x32.
3. Get Slave Id - Not sure which command to use
1. Please connect the PCAN-View to the same Bus your application is using, so that you can see all messages being sent from your application, i.e. from the CCP Api. If you see no messages when asking for the version, then it means (as explained above) that the handle passed to the function is wrong/corrupt/invalid, or you have disconnected the client at this point.
2. The data being sent to the ECU is not OK. Please check the ECU documentation to see what it is expecting.
3. You have to use UPLOAD after successfully calling of EXCHANGE_ID. Please read/get the CCP Documentation if you want to learn more about CCP. The name is "CCP_V2.1.pdf" and can be adquired by http://www.asam.net/.
Best regards,
Keneth

tj_40071
Posts: 7
Joined: Fri 6. Jul 2012, 00:13

Re: Delphi CCP Problem

Post by tj_40071 » Sat 8. Sep 2012, 07:32

I was talking about your sample Delphi program. I changed no code for those functions that failed.

The only code that I changed was in the form create that I stated earlier.

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

Re: Delphi CCP Problem

Post by K.Wagner » Mon 10. Sep 2012, 08:31

Hello,

I have just tested the Delphi demo project and I cannot get such an error as you described. Please check your ECU configuration. I have recorded a trace while I tested the project. The following picture shows pairs of CROs and DTOs. Please compare these with those of your ECU:
Delphi Project Data-Traffic
Delphi Project Data-Traffic
CCPDemo.jpg (112.28 KiB) Viewed 8088 times
As you, I only changed the data within the FormCreate procedure:
// PCAN Channel to use
//
m_Channel := TPCANBasic.PCAN_USBBUS1;
m_Baudrate := PCAN_BAUD_250K;

// ECU Data
//
m_SlaveData.EcuAddress := $FFFF;
m_SlaveData.IdCRO := $98EF02F9;
m_SlaveData.IdDTO := $98EFF902;
m_SlaveData.IntelFormat := True;
If the problem persists, please try to record a trace as I did, so that we can interpret the data and see why this is happening.
Best regards,
Keneth

Post Reply