AnsweredAssumed Answered

USB Bus Reset - Bug on USB Stack - SDK 2.3

Question asked by Bruno Albrecht on Mar 19, 2018
Latest reply on Mar 28, 2018 by Bruno Albrecht

Hello,

I have an application using MK22FN512VLH12, SDK 2.3 and KDS 3.2, FreeRTOS 9.0.0, custom board, Win 10 Pro.

 

Over USB (device), I implement one USB Mass Storage Device and 2 Virtual COM Ports. The MSD works as should (i.e I can write stuff to the memory and read it back, etc), the VCOM ports also work as expected.

 

The problem is that the USB BUS is being reset once in a while. I managed to debug the problem and realized the reset happens after a specific command is sent from the host to the MSD:

 

If I just connect the USB (physically), after the whole enumeration, the host keeps sending to the MSD a "test unit ready" (0x00) command (kUSB_DeviceMscEventTestUnitReady on the class callback function), for which I respond normally. Once in a while, I receive the following commands:

 

  1. Read Capacity (10) - 0x25 - Callback function is not called
  2. Read Capacity (10) - 0x25 - again
  3. Inquiry - 0x12 - kUSB_DeviceMscEventInquiry
  4. Log Sense - 0x4D - Unsupported command, answered directly by the USB_DeviceMscProcessUfiCommand (callback function is not called)

 

After the log sense, I receive a bus reset interrupt on the microcontroller. The MSD filesystem continues working on windows and if I weren't having problems, I'd never see those commands (or the bus reset). But the problem is that sometimes I have to stream data through one of the VCOM ports and if the Bus Reset happens during the streaming, the VCOM that is streaming gets stuck.

 

My question is: why is the bus being reset? How do I prevent that from happening?

Outcomes