We have a custom board with a Kinetis MK60DN512VLQ10 running an MQX 4.0.0 application.
Our application uses the USB HostMSC feature with the MFS library. We tested several different USB mass storage devices successfully.
Now we have a series of 8GB devices which SOMETIMES do not enumerate.
When the enumeration fails, the following sequence happens: We get a bus timeout in the setup phase of the first control transfer (get device descriptor). The USB Host driver (MQX KHCI low lever driver) retries and emits the token 15 times (NAK_COUNT) and gets bus-timeout (PID 0x00) repeatedly. When the device is unplugged and plugged in again, then it is sometimes enumerated and sometimes not. Once the device is enumerated, the MSC class driver and the MFS driver work with no problems!
Has anyone seen this before or has any ideas where to search for the solution?
USB stack works with all the mass storage devices that meet MSD class specifications, if a device is not compliant with these specs it is possible that USB stack is not able to read it. There are some specific cases where USB stack implements a workaround to support some devices that are not compliant with USB MSD class, unfortuantely there is not an universal work around. I recommend to work with devices which are compliant with the spec.
thanks for your reply. I share your opinion of using compliant devices only. Unfortunately, the mentioned USB Key appears to be compliant with the USB chapter 9 tests (verified with USB-IF Command verifier tool). Is there another compliance-check that verifies the basic USB device capabilities?
Although it is not fully compliant with the MSD class specs (according to the verifier tool), this should not yet be a problem in this case. The MFS driver does not even get informed when inserting the key, no MSD transactions take place. The timeout occurs on the very first token (Setup token of the "get device descriptor" control transfer) that's triggered by the "usb_dev_list_attach_device()" function, right after detecting the USB device speed.
Sequence: Key insert --> Interrupt(ISTAT.ATTACH) --> KHCI Attach call --> GetDeviceDescriptor --> Setup Token --> Bus Timeout
The GetDeviceDescriptor transfer is repeated 15 times.
In the USB-IF Command verifier tool, there is an enumeration test, which does 150 enumerations of the device. This test succeeds with the mentioned device... The enumeration of the device seems to be no problem on windows. One difference from windows USB to MQX USB is, that the windows stack sends as first transfer a get device descriptor with 64Bytes requested data, MQX requests 8Bytes. According to the spec. this makes no difference because the device must return the requested amount of data or - if the requested size is larger than the available data - the size of the requested descriptor.
This is what I know so far, maybe this information helps to get closer to where the problem lies...