problem with USB HID device library from libstock

General discussion on mikroBasic PRO for PIC32.
Post Reply
Author
Message
phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

problem with USB HID device library from libstock

#1 Post by phil31 » 08 Jan 2020 17:21

Dear,

i'm faced with a strange problem !
some of my products was working since several years with windows 7 and 10.
it is an USB HID device with a VB.NET application.
i don't modify anything since several months/years.

since some weeks, i notice that under Windows 10, the windows application hang on startup up (on the Onplugg events from the mcHID.dll).

after several search on google, i found maybe the cause :
https://www.google.com/search?q=windows ... e&ie=UTF-8

with Windows 7, no problem, it continue to work as before.

after some investigation on my PIC32 code, i found that the USB events (from the USB library libstock) are differents now (again only with W10)

USBDev_GetDeviceState() will never go to _USB_DEV_STATE_CONFIGURED when i plug the usb cable !!
i found even that USBDev_GetDeviceState() return the code x20, which is not documented


please anyone notice something like that ?
may i get some advice from Mikroe team, about the event value x20 ?

thaks, regards

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: problem with USB HID device library from libstock

#2 Post by stefan.filipovic » 27 Jan 2020 16:35

Hi Phil,

The USBDev_GetDeviceState() function returns current USB Device state, and it will return 0x20 when the device is suspended (_USB_DEV_STATE_SUSPEND constant).
This condition may occur if the Idle condition is detected (constant Idle state of 3 ms or more), i.e. if the IDLEIF bit of the U1IR register is set.

Kind regards,
Stefan Filipović

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: problem with USB HID device library from libstock

#3 Post by phil31 » 04 Feb 2020 17:30

thanks stepfan,

may i clear the IDLEIF bit during my init procedure ? : IDLEIF_bit : 0
to avoid this state .. or is it a Windows feature ?


i notice than when i plug/unplug the usb cable, a ton of "_USB_DEV_EVENT_ATTACHED" events appears .. is that normal ?

which events can i use to be sure when the device is right connected and when he is right unconnected ( i mean ready to exchange data) ?

_USB_DEV_EVENT_ATTACHED ==> i'm sure that the device is right connected and configured to the PC ?
_USB_DEV_EVENT_DISCONNECTED ==> i'm sure that the device is not anymore connected to the PC ?

where can i find the full definition list of the differents events code ?
where i can see that _USB_DEV_STATE_SUSPEND = 0x20 !?

regards

Post Reply

Return to “mikroBasic PRO for PIC32 General”