2022-01-07 12:07 AM
Hi all,
I am newbie in this field.
Using the STM32CubeMX V6.3 to create a virtual memory stick and working well under win7/10.
Using the sample code I can easily to send data to host as following
function sendDataToHost(...)
{
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassData;
hmsc->bot_data[0] = 0x01;
hmsc->bot_data[1] = 0x02;
hmsc->bot_data[2] = 0x03;
hmsc->bot_data[3] = 0x03;
hmsc->bot_data_length = 4U;
return 0;
}
And I want to receive data from host, what should i do?
My test code cause the timeout error and it seems like host don't know the data is received complete.
PS. Host Will send 8 bytes to device
function(...)
{
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *) pdev->pClassData;
USBD_LL_PrepareReceive(pdev, MSC_EPOUT_ADDR, hmsc->bot_data, 8);
}
can anyone give me some idea?
Thanks
2022-01-07 02:51 AM
There are a lot of MSC examples out there. Look at the code that receives data from the host. Perhaps LL has also an example
2022-01-07 09:39 AM
Thanks for your opinion! I will check the sample of USBD_LL_PrepareReceive().