AnsweredAssumed Answered

usb host MSC send&receiveData

Question asked by tran.khoa on Jun 1, 2015
Latest reply on Jun 15, 2015 by chahrayar.chahrazed
I made a project with stm32cude mx for stm32f401 discovery,
discovery board is usb msc host, send a command to devide (usb msc device) then receive data form device
my project connected and saw all infomation of device, but a don't know how to send command (2 byte) to device. what 's library can do it.
i try 
 USBH_BulkSendData (USBH_HandleTypeDef *phost, 
                                uint8_t *buff, 
                                uint16_t length,
                                uint8_t pipe_num,
                                uint8_t do_ping )
and 
USBH_BulkReceiveData(USBH_HandleTypeDef *phost, 
                                uint8_t *buff, 
                                uint16_t length,
                                uint8_t pipe_num)
....
but it not send/recive data
please help me!!!!
HAL_Init();
SystemClock_Config();
MX_GPIO_Init(); 
  USBH_Init(&hUSB_Host, USBH_UserProcess, 0);
   
  USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS);
   
  USBH_Start(&hUSB_Host);
   
  while (1)
  {
    /* USB Host Background task */
    USBH_Process(&hUSB_Host);
    HAL_Delay(1);
    /* Mass Storage Application State Machine */
    switch(Appli_state)
    {
    case APPLICATION_START:
      while(USBH_BulkSendData(&hUSB_Host,(uint8_t*)tx,2,1,1)!=USBH_OK);
      while(USBH_BulkReceiveData(&hUSB_Host, (uint8_t *)rx, 64,1)!=USBH_OK); 
      Appli_state = APPLICATION_IDLE;
      break;
       
    case APPLICATION_IDLE:
    default:
      break;     
    }
  }

Outcomes