AnsweredAssumed Answered

Cube USB Library

Question asked by schuch.lucas on Apr 8, 2015
Latest reply on Dec 9, 2016 by Andrea Coccon
Hi,

I have a STM32F4-Discovery board and I am trying to detect a memory stick using the USB library generated by CubeMX (Mass Storage Class).

The USB process state machine have the following states:
/* Following states are used for gState */
typedef enum 
{
  HOST_IDLE =0,
  HOST_DEV_WAIT_FOR_ATTACHMENT,  
  HOST_DEV_ATTACHED,
  HOST_DEV_DISCONNECTED,  
  HOST_DETECT_DEVICE_SPEED,
  HOST_ENUMERATION,
  HOST_CLASS_REQUEST,  
  HOST_INPUT,
  HOST_SET_CONFIGURATION,
  HOST_CHECK_CLASS,
  HOST_CLASS,
  HOST_SUSPENDED,
  HOST_ABORT_STATE,  
}HOST_StateTypeDef;

When I attach my memory stick in the board, the state machine goes to the HOST_CLASS_REQUEST state and never leaves it.

The problem is that I never get a OK status, but I never get a ABORT also.

case HOST_CLASS_REQUEST:  
    /* process class standard control requests state machine */
    if(phost->pActiveClass != NULL)
    {
      status = phost->pActiveClass->Requests(phost);
      
      if(status == USBH_OK)
      {
        phost->gState  = HOST_CLASS;        
      }  
    }
    else
    {
      phost->gState  = HOST_ABORT_STATE;
      USBH_ErrLog ("Invalid Class Driver.");
    
#if (USBH_USE_OS == 1)
    osMessagePut ( phost->os_event, USBH_STATE_CHANGED_EVENT, 0);
#endif       
    }
    
    break;


What can I do?

Thanks in advance!

Outcomes