Page 1 of 1

XCP error message as human readable strings

Posted: Mon 25. Sep 2017, 12:02
by msoum
Hello,

I am using both the PCAN Basic APIs and the PXCP APIs. I have noticed that PCAN Basic provide a method (CAN_GetErrorText in C++) to which we give a return code and it gives back a human readable message about the error code.
This feature is both useful for the developer (debugging process) and for the end user to see what's wrong when something is.
But I did not see an equivalent method in the PXCP APIs.
Did I miss it or did it just not exist ?
I tried using the PCAN Basic API but it does not return the correct message for a given error code (e.g. XCP_ERR_OK gives "The test of the CAN controller hardware registers failed (no hardware found)").

Re: XCP error message as human readable strings

Posted: Tue 26. Sep 2017, 12:38
by K.Wagner
Hello,
msoum wrote:Did I miss it or did it just not exist ?
you are right. Neither XCP API nor CCP API have such a function. This was actually not a requirement at the time those APIs were written.
msoum wrote:But I did not see an equivalent method in the PXCP APIs.
The application area for XCP/CCP APIs were different. The function exists for PCAN-Basic since that API was thought to be used mainly with an User Interface. The other APIs were thoughts to be used for flashing (service oriented), so normal codes should be enough for error handle within the flash process.
msoum wrote:I tried using the PCAN Basic API but it does not return the correct message for a given error code (e.g. XCP_ERR_OK gives "The test of the CAN controller hardware registers failed (no hardware found)")
You can use error codes of XCP with PCAN-Basic only if the error was in the transport channel, i.e. the error code is marked with the flag XCP_ERR_TRANSPORT_CHANNEL. This means, the returned value (ignoring the flag) represents in this case a PCAN-Basic error. More information in the chapter "Introduction/About PCAN-XCP/Return Codes" of the PCAN-XCP documentation.

Nevertheless, it would indeed be helpful to have such a function within the other APIs. We will take this into consideration. Thanks for your recommendation.