2022-09-06 02:06 PM
I'm using STM32G473 with the STM32_USB_Device_Library files. I set up a custom HID device with 1 IN EP. It is enumerating correctly and can successfully communicate bulk transfers with the host (proprietary software proven to work with other STM32 MCUs).
However when the host sends a set report request it fails to receive an ACK from the device. All other control transfer requests from the host (e.g. get descriptor) succeeds so I'm at a loss to why only the set report request fails. Are there any working examples for USB customHID projects with control transfers out there? Any help is appreciated.
case HID_REQ_GET_REPORT:
reportID = uint8_t (req->wValue & 0x00FF);
uint8_t packetSize = PackConfigReports(reportID, (uint8_t*)&DataToHost, \
COMM_INTERFACE_USB);
if(packetSize > 0)
{
USBD_CtlSendData(&hUsbDeviceFS, DataToHost, packetSize);
}
else
{
USBD_CtlError (&hUsbDeviceFS, req);
}
break;
case HID_REQ_SET_REPORT:
reportID = uint8_t (req->wValue & 0x00FF);
USBD_CtlPrepareRx(&hUsbDeviceFS, DataFromHost, packetSize);
break;