Author Topic: Host Immediately Set Device To Unconfigured  (Read 6301 times)

nobbyv

  • Member
  • ***
  • Posts: 14
Host Immediately Set Device To Unconfigured
« on: March 20, 2014, 04:07:27 pm »
I'm still learning USB here, so please bear with me if I am leaving out vital info.

I am trying to implement a HS USB HID-class device on a STM32F427 from STMicro using a SMSC USB3300 external PHY IC. I have succesfully implemented a similar setup previously, except it was based on an STM32F205. I have this device handy for comparison. 

Using my Beagle USB protocol analyzer, when I plug in the HS USB cable there appears to be MOST of the traffic I would expect: HS handshaking, setting an address, get config descriptors, etc. I have compared this against my working device, and all is fine until just after the host does a Set Config = 1 (configured). Both devices do a brief Set Idle, then there is a Get Report Descriptor. What I expect next is a Get Feature Report; on my "working" device I see multiple Get Feature Reports. However, on my new device, the next packet I get is the host doing another Set Configuration, but this time to 0. This is then followed by a Suspend, and is the last transmission.

My question is: why would the host come through and unconfigure my device?

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Host Immediately Set Device To Unconfigured
« Reply #1 on: March 20, 2014, 04:42:15 pm »
My guess would be it doesn't like something about the last successful transaction. The last successful transaction you say is a Get Report Descriptor, so I'd expect there's something about that descriptor it doesn't like. what's different between the two descriptors?

nobbyv

  • Member
  • ***
  • Posts: 14
Re: Host Immediately Set Device To Unconfigured
« Reply #2 on: March 24, 2014, 01:51:44 pm »
Thanks for the reply. They are very similar (almost exactly the same). The only thing that jumps out is that on the device which is then getting configured to "0)', it NAKs to the host a few more times than the "working" device. Might this be significant?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Host Immediately Set Device To Unconfigured
« Reply #3 on: March 24, 2014, 02:09:23 pm »
Devices must return ACK in the Setup stage of a control transfer. NAKing the Data and Status stages is allowed.

Tsuneo

  • Frequent Contributor
  • ****
  • Posts: 145
Re: Host Immediately Set Device To Unconfigured
« Reply #4 on: March 25, 2014, 06:44:37 am »
Quote
nobbyv:

They are very similar (almost exactly the same).

That is, they are different ;-)
If you would have changed the report descriptor, tune its size on this macro.

Ah, one more library from ST,
Code: [Select]
\STM32_USB-Host-Device_Lib_V2.1.0\Libraries\STM32_USB_Device_Library\Class\hid\inc\usbd_hid_core.h

#define HID_MOUSE_REPORT_DESC_SIZE    74

OR

Code: [Select]
\STM32_USB-FS-Device_Lib_V4.0.0\Projects\Custom_HID\inc\usb_desc.h

#define CUSTOMHID_SIZ_REPORT_DESC               163

OR

Code: [Select]
\STM32Cube_FW_F4_V1.1.0\Middlewares\ST\STM32_USB_Device_Library\Class\HID\Inc\usbd_hid.h

#define HID_MOUSE_REPORT_DESC_SIZE    74

You asked the same question on the STM32 forum in ST site.

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex%5fmx%5fstm32%2fUSB%20HS%20Host%20Unconfigures%20Device

As you don’t reply to my answer, which suggested to check the size of the returned report descriptor on the Beagle log, I gave further answer, here.

Tsuneo
« Last Edit: March 25, 2014, 06:55:32 am by Tsuneo »