Author Topic: HID Locks up  (Read 9219 times)

866JR

  • Member
  • ***
  • Posts: 5
HID Locks up
« on: December 04, 2011, 08:40:40 am »
I am working on a new product that uses a PIC32 processor and HID. Each time I program the chip, I disconnect the USB from the PC then reconnect after programming. The board uses a PIC32MX534, and is not a starter kit or development device. Everything seems to work fine and I am deeply into the firmware, I do have successful USB communication using Microchip's USB framework; I am working on communicating with an external flash memory chip and an audio DAC.

After just a few disconnects and reconnects, the PC thinks the USB is still connected when I unplug it. My PC program sees the device as connected because windows has the driver open and device manager thinks the board is there even though it is disconnected. I cannot do anything to close the PC HID driver, including driver uninstall. The driver uninstall just locks up and I have to restart the computer. (The computer functions normally except the driver won't close). I am running XP and programming in VC. net. I am working on both programs (VC.net and PIC32) at the same time so I am running the VC program from within the development environment. Stopping the program does not seem to help. 

This really slows development down and any suggestions would be greatly appreciated.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: HID Locks up
« Reply #1 on: December 04, 2011, 11:21:03 am »
Does the host application use device notifications to detect when the device detaches and then close the handle?

In my example code, see the DeviceManagement modules and WndProc function.

http://www.lvr.com/hidpage.htm#MyExampleCode

Jan

866JR

  • Member
  • ***
  • Posts: 5
Re: HID Locks up
« Reply #2 on: December 11, 2011, 06:37:45 pm »
Thanks for your help.

I think you may be right because of the way it acts. If close program before detaching it never locks up. I am using Microchip's HID example because it is in C.net and I have just started using C. I have not dug very deeply into how the handle is opened and closed. The port status is reported by polling with a timer -MCHPHIDClass::USBHIDIsConnected () - on Microchips form and I used similar code to show the status on the forms and code that I created. When the device is detached it shows that it is detached but sometimes it does not detect it. I wonder if it is because there is more than one form open at the same time, I think it was doing it before I started in with my own programming though.

I really appreciate your comment it got me started on where I need to look. I am not going to work on the problem right now because, I may change to another USB class in place of HID because I have quite a lot of data to write to a 32MBit flash chip along with all of the other low throughput control functions.