2015-06-01 02:27 AM
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;
}
}
2015-06-15 03:30 AM
Hi,
You can refer to the application inSTM32Cube_FW_F4_V1.6.0\Projects\STM324xG_EVAL\Applications\USB_Device\MSC_Standalone, also have a look at the user manual UM1720, specially the section 4.2