Problem adding OUT Endpoint to PE USB HID

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem adding OUT Endpoint to PE USB HID

1,334 Views
seanbolton
Contributor III

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

Labels (1)
0 Kudos
Reply
2 Replies

986 Views
isaacavila
NXP Employee
NXP Employee

Hello Sean,

In this post, there was also some advices about handling these requests: How can I configure an USB HID Keyboard Output Endpoint with KDS processor expert ?  Indeed, in KSDK 1.3, the previous bug was fixed and it worked well.

Could you please validate if this can solve your issue?

Best regards,

Isaac Avila

986 Views
seanbolton
Contributor III

Hi Isaac

Apologies for my late response, I missed your reply to my original query.

I now have an Out Endpoint configured in my software.  The important thing was to add the   (void)USB_Class_HID_Recv_Data( );  call to both the application_callback and class_callback functions as per the Send_Data() function.  Also configure the additional out endpoint correctly in the descriptor tables.  Also the size of the report descriptors is important and must line up on the host and device sides.

Once everything is in place the USB out endpoint works fine.

Thanks again for getting back to me on this, I am now making progress with our project and USB is working OK.

regards

Sean

0 Kudos
Reply