PCANBasic. C++. CAN FD. PCAN_ERROR_ILLCLIENT

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
Alex V
Posts: 3
Joined: Tue 14. Mar 2023, 09:43

PCANBasic. C++. CAN FD. PCAN_ERROR_ILLCLIENT

Post by Alex V » Tue 14. Mar 2023, 09:55

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!!

Alex V
Posts: 3
Joined: Tue 14. Mar 2023, 09:43

Re: PCANBasic. C++. CAN FD. PCAN_ERROR_ILLCLIENT

Post by Alex V » Tue 14. Mar 2023, 10:19

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

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

Re: PCANBasic. C++. CAN FD. PCAN_ERROR_ILLCLIENT

Post by K.Wagner » Tue 14. Mar 2023, 10:26

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.
Attachments
PCB_Help.PNG
PCB_Help.PNG (60.86 KiB) Viewed 1981 times
Best regards,
Keneth

Alex V
Posts: 3
Joined: Tue 14. Mar 2023, 09:43

Re: PCANBasic. C++. CAN FD. PCAN_ERROR_ILLCLIENT

Post by Alex V » Tue 14. Mar 2023, 10:57

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
Attachments
PCAN_ERROR_INITIALIZE
PCAN_ERROR_INITIALIZE
Error.JPG (16.49 KiB) Viewed 1976 times

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

Re: PCANBasic. C++. CAN FD. PCAN_ERROR_ILLCLIENT

Post by K.Wagner » Tue 14. Mar 2023, 12:53

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.
Best regards,
Keneth

Post Reply