Author Topic: USB port strange behaviour  (Read 14614 times)

CAUCHARD

  • Member
  • ***
  • Posts: 4
USB port strange behaviour
« on: January 10, 2012, 04:28:33 am »
We face a problem with a device which we develop: it is an interface converter CAN Bus/USB .
It is based on an ST µPSD 3454A processor at 24 MHz. This µProc has a USB V1.1 low speed internal port.The device is bus Powered (150 mA). The device is recognized as an HID device. It uses HID reports with various lengths. I use the USB routines as given by ST for this µProc.
When our device hangs (it happens from time to time):
- some times Windows PnP "crashes" (this happens under XP, not Visa and W7), and the user need to restart device discovery service or reboot PC,
- some times when W doesn't crash it's not enough to restart our device by unpugging/plugging it (making an internal reset) but also there is the need to change the USB port (Hub ou PC)
Should be appreciated if anybody has some ideas on what happens.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB port strange behaviour
« Reply #1 on: January 10, 2012, 11:37:57 am »
You can keep the application from handing by using asynchronous (overlapped) ReadFiles with a timeout. See my HID code for examples:

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

If the device firmeware is crashing, you need to debug that. A hardware protocol analyzer can offer clues about what is happening on the bus.

Jan

CAUCHARD

  • Member
  • ***
  • Posts: 4
Re: USB port strange behaviour
« Reply #2 on: January 11, 2012, 04:25:33 am »
Thanks Jan for your quick answer !
My problem is more related to Windows behaviour: How can I prevent Pnp to carsh ? What is the reason why I'm obliged to change from USP port ?
My application has no problem: it doesn't signal any error except when the converter is disconnected.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB port strange behaviour
« Reply #3 on: January 11, 2012, 09:23:05 am »
If Windows crashes when device communications hang, the solution is to prevent communications from hanging. And that requires finding out why the communications are hanging.

Jan

CAUCHARD

  • Member
  • ***
  • Posts: 4
Re: USB port strange behaviour
« Reply #4 on: January 12, 2012, 03:14:18 am »
I agree with you.
I think the best is to use a USB protocole analyser such as (those available on french market):
   - USB MObile T2 Standard LeCroy but old PCMCIA slot
   - Beagle USB 12 Protocol Analyzer USB distrib (box)
       Part Number:  TP320221
    - USB Explorer 260 Analyzer (Ellisys) Basic or Standard (box)
Do you have any experience of it, in terms of avantages/disavantages ?