Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Error codes from CCP library functions

I have troble getting my CCP communication to work. Functions return error codes that I do not know how to interpret. I have run the following simple testprogram:

#include
#include
#include "nicanccp.h"

int main (void)
{
i32 status_i32;
u32 ccpTaskHandle_u32;

status_i32 = CCPOpen (0x18FFA019, 0x18FFA000, 1, 0, 0, &ccpTaskHandle_u32);
PrintStat(status_i32, "CCPOpen");
status_i32 = CCPTest (ccpTaskHandle_u32, 0x6678);
PrintStat(status_i32, "CCPTest");
status_i32 = CCPClose (ccpTaskHandle_u32);
PrintStat(status_i32, "CCPClose");
GetKey();
return 0;
}

void PrintStat(NCTYPE_STATUS status_S32, char *source)
{
char statusString[512];
if (status_S32 != 0)
{
ncStatusToString(status_S32, sizeof(statusString), (NCTYPE_STRING)statusString);
printf("\n%s\nSource = %s\n", statusString, source);
}
}

The screen output from the program is:

Error 0xbff621af ; Unknown NI-CAN status code
Source = CCPTest

In other words, something goes wrong in the call to CCPTest, but I have no idea what it is. I get a similar result if a call the CCPConnect function instead of CCPTest.
0 Kudos
Message 1 of 6
(4,364 Views)
Hello Johann,

When running your code, I cannot reproduce the 0xBFF621AF error.
Could you create a log file with NI Spy when you execute your code and post the logfile? NI Spy will log all calls to the underlying NI-CAN driver and we can get a better idea where this error is originated from.
You can find NI Spy here:
Start » Programs » National Instruments » NI Spy
Please make sure that only 'NI-CAN' is checked for logging: menu bar » Spy » Options... » View Selections

-B2k
0 Kudos
Message 2 of 6
(4,356 Views)
Hello! Thanks for the help, i logged with NI-Spy (see attached file). My conclusion is that i simply didn't get any response from my ECU. And after some experimenting with the stationAdress argument (switched the byte order) it seems to work! Then I tried the CCPConnect function. That also worked after switching the byte order in the stationAdress argument. But I thought the argument "byteOrder" should take care of that. When I log the CAN traffic i can see that the byte order is actually not altered when changing the "byteOrder" argument in the call to CCPConnect. Another question is why the CCPTest function does not have that argument at all.
0 Kudos
Message 3 of 6
(4,351 Views)
Hello Johann,

could you try to reattach the logfile? It got lost somewhere (actually the Preview Post function of the message editor 'looses' the link to the attachment....).
I will look into the problem with the "byte order".

Regards,
-B2k
0 Kudos
Message 4 of 6
(4,347 Views)
Hello! Hopefully the attachment is still there this time (I had to zip the file to make it work).

Now I know more why my program didn't get any response at all the first time. The ECU I used had only CCP 1.01 implemented, and the "Test" command is not specified in that version so it is quite obvious that I do not get a the expected response. What is more strange is that the Test command in 2.1 uses the same CRO command code (0x05) as the command for "allocate DAQ list" in version 1.01.

I guess the CCP command set does not support the older version (<2.0) of CCP? There seems to be a great lack of compatibility between the older and the newer variant.

Another comment: The nicanccp.h file in the installation has to be updated to make the code compile:
The last argument in the prototype to the CCPOpen function is defined as "u32 &CCPTaskRef", this must be changed to "u32 *CCPTaskRef".

Regards,
Johan
0 Kudos
Message 5 of 6
(4,343 Views)
You are correct, the CCP Toolset supports the last recent CCP standard 2.1
0 Kudos
Message 6 of 6
(4,335 Views)