AnsweredAssumed Answered

Problem adding OUT Endpoint to PE USB HID

Question asked by Sean Bolton on Feb 5, 2016

Hi NXP

 

I have been trying now for several days to configure a USB OUT Endpoint as an addition to an existing PE Demo HID.

 

So far I have failed to send any data via the Endpoint or via the Control Channel (EP0) to the processor.

 

I am using KDS 3.0.0 with SDK 1.3.0 on Windows 10 platform building for MK20DX256VLK10 processor.

 

Attached is my project file in a zip archive.

 

This is my workflow.

 

Firstly I generate the basic PE configuration for the processor with the USB HID Demo (Thermometer).

 

This works fine and with the USB Analyser I can see the USB device is detected and sends the periodic 2 byte temperature reports.

 

From the PC I am using the   hidapi  library to access the HID device (using QT Creator & C++).

 

I can open the HID device     hidHandle = hid_open( 0x04D8, 0xFC40, NULL );   and it is OK.

 

If I do a read of the device I get the 2 byte temperature report OK.    hid_read ( hidHandle, TestReport,3 ) ;

 

If I do a write to the device I always get -1 (error)  hid_write ( hidHandle, TestReport, 3 ) ;

 

Also if I try to send or read from the Control port this also always gives me an error.

 

    hid_get_feature_report ( hidHandle, TestReport, 3 );

 

    hid_send_feature_report ( hidHandle, TestReport, 3 ) ;

 

I expect when I do the get and send feature report to see the following requestIDs activated in the callback function ;

 

  case USB_HID_GET_REPORT_REQUEST:

or

  case USB_HID_SET_REPORT_REQUEST:

 

but I never see the callback called for these request IDs when I try to do a get/send from the PC.

 

On the processor side I have added an additional endpoint using PE to give an EP1 OUT  using INTERRUPT.

 

I am now struggling to understand how I can get the processor to receive and reply to SET/GET_REPORT_REQUESTs.

 

Any advice you can give me to make progress on this would be very much appreciated.

 

Kind regards


Sean

 

 

 

p.s. one modification I tried with the stack code is in usb_framework.c  as described in this discussion

 

usb generic hid multiple endpoints sdk 1.20 KL 26

 

I added the line to set the data parameter.  (The thread said this is fixed in SDK 1.3.0 but in my file the data assignment was still not there, or maybe the problem is fixed in a different way).

 

Line

   448   /* class or vendor request */
   449size = event->len + USB_SETUP_PKT_SIZE;
      data = event->buffer_ptr;   // DLK added this bug fix
   450error = usb_fw_ptr->request_notify_callback(

Original Attachment has been moved to: USB_K20TEST.zip

Outcomes