cancel
Showing results for 
Search instead for 
Did you mean: 

USB Set/get report control transfer failing on STM32G4

EGu.1
Associate

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.

  1. USBlyzer results where you can see the device receiving and then sending back the report, but the transfer then fails on the host side due to no ACKs.0693W00000Sue2GQAR.png
  2. Code inside setup stage of USBD_Class that handles set/get report requests.
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;

0 REPLIES 0