Page 1 of 1
PCANBasic. C++. CAN FD. PCAN_ERROR_ILLCLIENT
Posted: Tue 14. Mar 2023, 09:55
by Alex V
Hello,
I am trying to receive frames from my PEAK USB CAN FD Hardware. I have built the C++ program using some examples as well as PCANBasic API.
However I obtain the ERROR code 7168 (1C00 hex) as a return of the function "CAN_ReadFD". I´ve read on Internet that it could be caused because I´m not using the correct FD channel, but I´ve tried with each one of the 16 avaiable.
Is there any other thing which can cause this error code (PCAN_ERROR_ILLCLIENT)?
Thank you for your help!!
Re: PCANBasic. C++. CAN FD. PCAN_ERROR_ILLCLIENT
Posted: Tue 14. Mar 2023, 10:19
by Alex V
Hello again,
I update info. I have solved finally this error, and now I recognize the hardware.. OKEY
The error have turned into "PCAN_ERROR_INITIALIZE". That means that when I try to use the CAN FD Channel, it is already in use so I have to Uninitialize it but the error continues... The strucutre I am using now on the C++ code in:
VARIABLE DECLARATIONS
MAIN FUNCTION ()
- Initialize channel
- TPCAN Status=CAN_ReadFD
- Uninitialize channel
Thank again
Re: PCANBasic. C++. CAN FD. PCAN_ERROR_ILLCLIENT
Posted: Tue 14. Mar 2023, 10:26
by K.Wagner
Hello,
yes, you need to first initialize a channel to be able to read. And yes, you need to uninitialize it to be able to initialize it from andere applicaitons or with different configuration (CAN vs CAN-FD for instance). This information can be read in the help file, chapter "Introduction/Understanding PCAN-Basic).
Please check the help and the example prokjects. There is all what you need to write your own application.
Re: PCANBasic. C++. CAN FD. PCAN_ERROR_ILLCLIENT
Posted: Tue 14. Mar 2023, 10:57
by Alex V
Hi,
Thank you for your quick response..
Yes, I know that, I follow that steps but the return that "CAN_Uninitialize" gives me it´s PCAN_ERROR_INITIALIZE (see screenshot error).
It´s like the code does not recognize the hardware, am i true??
Gretings
Re: PCANBasic. C++. CAN FD. PCAN_ERROR_ILLCLIENT
Posted: Tue 14. Mar 2023, 12:53
by K.Wagner
Hello,
as the help states, ERROR_INITIALIZE is only returned, if the channel passed was not initialized first. Probably you are either calling the funciton twice, or you are using different channel values for CAN_Initialize and CAN_Uninitialize.
You can call CAN_Uninitialize using the channel PCAN_NONEBUS, which causes de uninitialization of all initialized channel by the application, but I recommend to debug and cehck the channel value used in both functions.
If still no luck, please post here the code used for initialize and uninitialize the channel.