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!!
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:
MAIN FUNCTION ()
- Initialize channel
- TPCAN Status=CAN_ReadFD
- Uninitialize channel
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.
- PCB_Help.PNG (60.86 KiB) Viewed 1333 times
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??
- Error.JPG (16.49 KiB) Viewed 1328 times
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.