AnsweredAssumed Answered

KDS3.1 + KSDK1.3 USB HID interrupt out endpoint causes enumeration errors (k22f)

Question asked by TERRY COOKE on Jan 19, 2016

I have been struggling with USB HID generic + MSD drivers for the K22F for months, and believe I have tracked it down to the composite drivers.

 

Some background:

I had a previous thread USB Generic HID+MSD Composite enumeration problems ) in which I had thought that I had tracked down the issues of using semi-hosting for print debugging within the USB drivers was causing the enumeration to fail. It turns out that disabling semi-hosting only fixed the enumeration issues for a specific type of USB controller (

Renesas Electronics USB 3.0 Host Controller). Enumeration always fails using other USB controllers like Intel.

 

Projects Demonstrating the problem:

I have 3 projects attached that demonstrate when it works, or fails. (for the Freedom K22F board). These were all created with Processor Expert, then disabling it by renaming the '.pe' file to '.pe.bak'. This was done because I need to use a HID descriptor which is not supported by PE. (Note: this descriptor is ported from a Microchip processor and works perfectly so I know the descriptor is compliant)

  1. usb_hidonly_inouteps_works.zip
    1. This is an HID generic only example. This project works with both Interrupt in and out endpoints. So a base HID only custom project works fine on all computers.
  2. usb_msd_hidineponly_works.zip
    1. This is an HID generic + MSD ram drive composite example. This project works but only has an Interrupt in endpoint for the HID,
  3. usb_msd_hidinouteps_fail.zip
    1. This is an HID generic + MSD ram drive composite example. This project does not work with both an Interrupt in and out endpoint for the HID,

 

It always fails with the 3rd project on Intel USB Controllers (Win7 64bit), or on any apple computers. If you use software USB analyzer, it always fails at the URB_FUNCTION_SELECT_CONFIGURATION phase. It will try this three times and then timeout.

 

@Mark Butcher found using a hardware USB analyzer:

Your problem is that when the host sends a SetConfiguration (interface 1) your device is responding with a zero data paket (correct) but is it responding with a DATA0 packet, rather than a DATA1 packet and the host rejects this because it is incorrect.

After 5s or so of waiting (the device doesn't send anything else) the host restets the connection and tries again. The same repeats after the reset but sometimes also the SetAddress fails with the device returning malformed frames back - this again causes reset and it goes on forever like this (randomly failing on the SetAddress or the SetInterface).

 

What I don't know now is how to debug what is going on, where and how it sends it as a DATA0 packet, etc. I am hoping that these three demonstration projects can be used to point me in the right direction.

 

Thanks,

Terry Cooke

Original Attachment has been moved to: usb_msd_hidouteponly_works.zip

Original Attachment has been moved to: usb_msd_hidinoutep_fail.zip

Original Attachment has been moved to: usb_hidonly_inouteps_works.zip

Outcomes