Physically disconnected PCAN USB condition = Occupied

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
kkregger
Posts: 7
Joined: Tue 25. Jul 2017, 00:49

Physically disconnected PCAN USB condition = Occupied

Post by kkregger » Tue 25. Jul 2017, 01:08

I've found that if a PCAN USB device is physically disconnected after my VB application initializes it, that subsequent calls to retrieve the device condition return a value of PCAN_CHANNEL_OCCUPIED. Calls to read the bit rate return a value of 0x11c (250k).
Because of this I can't determine if the device is connected or not.
Is there a work around for this?

Peak Driver: PCAN_USB 4.0.15.15857

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

Re: Physically disconnected PCAN USB condition = Occupied

Post by K.Wagner » Tue 25. Jul 2017, 08:21

Hello,
kkregger wrote:I've found that if a PCAN USB device is physically disconnected after my VB application initializes it, that subsequent calls to retrieve the device condition return a value of PCAN_CHANNEL_OCCUPIED

This is normal. The parameter PCAN_CHANEL_CONDITION is used to know if a channel is avilable to connect or not. Since you have already connected it, then it is OCCUPPIED. You will receive that status because that channel is reserved for your application. If you plug in the device again, then your program will continue to work normally.
kkregger wrote:Because of this I can't determine if the device is connected or not.
Is there a work around for this?
In order to know if the channel is still active, then use the function CAN_GetStatus. This function returns PCAN_ERROR_ILLHW if the device is not physically connected.
Best regards,
Keneth

Post Reply