Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The MSC task handler implements the MSC protocol, responsible for the communication between the device and the host. The task handler is initialized when USBD_MSC_Init() is called. The MSC protocol is handled by a state machine comprised of 9 states. The transition between these states are detailed in Figure - MSC State Machine.

Anchor
Figure - MSC State Machine
Figure - MSC State Machine

Panel
borderWidth0
titleFigure - MSC State Machine

MSC State MachineImage Added


Upon detecting that the MSC device is connected, the device enters an infinite loop, waiting to receive the first CBW from the host. Depending on the command received, the device will either enter the data phase or transmit CSW phase. In the event of any stall conditions in the data phase, the host must clear the respective endpoint before transitioning to the CSW phase. If an invalid CBW is received from the host, the device enters the reset recovery state, where both endpoints are stalled, to complete the full reset with the host issuing the Bulk-Only Mass Storage Reset Class Request. After a successful CSW phase or a reset recovery, the task will return to receive the next CBW command. If at any stage the device is disconnected from the host, the state machine will transition to the None state.

...