cancel
Showing results for 
Search instead for 
Did you mean: 

My USB HID is processing reports one report behind - any thoughts?

RobG
Associate III

IN the function USBD_HID_setup for a class requese I added a case for send report.

					case HID_REQ_SET_REPORT:
						Debug::Instance()->printf(Debug::ALLWAYS, (char *) "Set report %X\n", req->wValue);
						Debug::Instance()->printf(Debug::ALLWAYS, (char *) "Received:  ");
						for (int ii = 0; ii < req->wLength; ii++)
							Debug::Instance()->printf(Debug::ALLWAYS, (char *) "%02X ", CtlEP0OutData[ii]);
						Debug::Instance()->printf(Debug::ALLWAYS, (char *) "\n");
						Report::Instance()->ProcessReport(CtlEP0OutData);
						USBD_CtlPrepareRx(pdev, CtlEP0OutData, sizeof(CtlEP0OutData));
							
						return USBD_OK; 
						break;

The first time I get here the buffer is empty, the second time is shows data from 1st transfer. Bus analysis says the data is being transferred as exepected. Moving USBD_CtlPrepareRx before the print (even with a delay) does not change the behavior.

Thanks for looking,

Rob

1 ACCEPTED SOLUTION

Accepted Solutions
RobG
Associate III

SOLVED

That part was just fine. You need to add an EP0 Rx Ready handler in the ClassTypeDef declaration. This is much clearer in the custom HID example.

View solution in original post

1 REPLY 1
RobG
Associate III

SOLVED

That part was just fine. You need to add an EP0 Rx Ready handler in the ClassTypeDef declaration. This is much clearer in the custom HID example.