AnsweredAssumed Answered

USBH_HID_SetReport issue

Question asked by Luca Giuliodori on May 10, 2018

I'm developing an HID USB Host application. I have already opened a discussion (Problems with HID Host and STM32F4) about HID USB Host and I applied all the suggested patches in forum, but now I have another problem.

 

When I try to send data to device (is a HID custom device that work fine if connected to PC) with SBH_HID_SetReport() function, it return "USBH_BUSY" every time I try to send message.
The problem seems to be inside the USBH_HandleControl() function: the state machine reaches the "CTRL_DATA_OUT_WAIT" state but, when it call USBH_LL_GetURBState(), return "USBH_URB_STALL" status and than the USBH_HID_SetReport() function return "USBH_BUSY".

 

This is the code used to send data:

#define MAX_USBDATASIZE (64)

.

.

.

static uint8_t USBBufToSend[MAX_USBDATASIZE];

static uint16_t lenUSBBufToSend;

.

.

.
USBH_StatusTypeDef res;

.

.

.

res=USBH_HID_SetReport(&hUsbHostFS,0x02,0x00,USBBufToSend,lenUSBBufToSend);

Why the device state is "USBH_URB_STALL"? Is it my mistake?
Is possible to resume the correct state?

Outcomes