2015-04-08 01:00 PM
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!2016-12-09 09:02 AM
(Old thread, so I put my answer just like a 'memo reminder')
I had the same problem and found out it was caused by not having allocated (enough) heap.
=> USB libraries rely on dynamic memory allocation!