Physically disconnected PCAN USB condition = Occupied

This forum covers issues concerning multiple software products.

Physically disconnected PCAN USB condition = Occupied

Postby kkregger » Tue 25. Jul 2017, 00: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
kkregger
 
Posts: 5
Joined: Mon 24. Jul 2017, 23:49

Re: Physically disconnected PCAN USB condition = Occupied

Postby K.Wagner » Tue 25. Jul 2017, 07: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
K.Wagner
Software Development
Software Development
 
Posts: 683
Joined: Wed 22. Sep 2010, 12:36
Location: Darmstadt, Germany


Return to Software



This website uses cookies for analytics, for logins to the online shop and the forum, and for the handling of an order. By browsing this website you agree to the use of cookies. Detailed information on their use can be found in our privacy policy.

OKPrivacy Policy