<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MQX Software SolutionsのトピックUSB Host HID Detach Error</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/USB-Host-HID-Detach-Error/m-p/248595#M7155</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using the following:&lt;/P&gt;&lt;P&gt;MQX 4.0&lt;/P&gt;&lt;P&gt;Custom board based on TWR-K60F120M&lt;/P&gt;&lt;P&gt;Keil uV 4.60&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to talk to an XBOX Controller (not my choice) using the TWR-K60F120M as a HOST HID Device.&amp;nbsp; I took the example hid_mouse project and modified it by changing the USB_HOST_DRIVER_INFO class/subclass/protocol to 0xFF.&amp;nbsp; In the main loop under case USB_DEVICE_INUSE I added:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tx_pipe = _usb_hostdev_find_pipe_handle(hid_device.DEV_HANDLE, hid_device.INTF_HANDLE, USB_INTERRUPT_PIPE, USB_SEND);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to get a pipe handle to send data to the XBOX controller.&amp;nbsp; In the process_mouse_buffer function, I added:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tr.G.TX_BUFFER = VIBRATE_ON;&lt;/P&gt;&lt;P&gt;tr.G.TX_LENGTH = 0x08;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;_usb_host_send_data(host_handle, tx_pipe, &amp;amp;tr);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to send data to respond to XBOX controller button inputs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works fine.&amp;nbsp; I can send packets that control the leds and rumble motors no problem.&amp;nbsp; The problem arises when I detach the controller from the micro.&amp;nbsp; The micro seems to get stuck.&amp;nbsp; I plug it back in and it doesn't responds.&amp;nbsp; So I rebuild the USB library with the debug output turned on and I get the following output on the serial port when I detach the controller before the crash:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;usb_host_driver_info_nonzero&lt;/P&gt;&lt;P&gt;usb_host_driver_info_nonzero FAILURE&lt;/P&gt;&lt;P&gt;usb_host_driver_info_scan SUCCESSFUL&lt;/P&gt;&lt;P&gt;usb_hostdev_attach_detach SUCCESSFUL&lt;/P&gt;&lt;P&gt;usb_dev_list_close_pipe&lt;/P&gt;&lt;P&gt;_usb_host_close_pipe&lt;/P&gt;&lt;P&gt;_usb_host_close_pipe SUCCESSFUL&lt;/P&gt;&lt;P&gt;usb_dev_list_close_pipe SUCCESSFUL&lt;/P&gt;&lt;P&gt;usb_dev_list_free_memlist&lt;/P&gt;&lt;P&gt;usb_hostdev_validate&lt;/P&gt;&lt;P&gt;usb_hostdev_validate SUCCESSFUL&lt;/P&gt;&lt;P&gt;usb_hostdev_delete_interface&lt;/P&gt;&lt;P&gt;usb_dev_list_close_pipe_bundle&lt;/P&gt;&lt;P&gt;usb_dev_list_close_pipe&lt;/P&gt;&lt;P&gt;_usb_host_close_pipeGoing to idle state&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like with it tries to execute the function _usb_host_close_pipe in host_close.c but it never makes it out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have any idea what is wrong?&amp;nbsp; Are there any examples of an usb hosting a HID device like a joystick showing IN/OUT comms on two interrupt endpoints?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any info would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Jul 2013 18:57:07 GMT</pubDate>
    <dc:creator>mo_tron</dc:creator>
    <dc:date>2013-07-01T18:57:07Z</dc:date>
    <item>
      <title>USB Host HID Detach Error</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/USB-Host-HID-Detach-Error/m-p/248595#M7155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using the following:&lt;/P&gt;&lt;P&gt;MQX 4.0&lt;/P&gt;&lt;P&gt;Custom board based on TWR-K60F120M&lt;/P&gt;&lt;P&gt;Keil uV 4.60&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to talk to an XBOX Controller (not my choice) using the TWR-K60F120M as a HOST HID Device.&amp;nbsp; I took the example hid_mouse project and modified it by changing the USB_HOST_DRIVER_INFO class/subclass/protocol to 0xFF.&amp;nbsp; In the main loop under case USB_DEVICE_INUSE I added:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tx_pipe = _usb_hostdev_find_pipe_handle(hid_device.DEV_HANDLE, hid_device.INTF_HANDLE, USB_INTERRUPT_PIPE, USB_SEND);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to get a pipe handle to send data to the XBOX controller.&amp;nbsp; In the process_mouse_buffer function, I added:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tr.G.TX_BUFFER = VIBRATE_ON;&lt;/P&gt;&lt;P&gt;tr.G.TX_LENGTH = 0x08;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;_usb_host_send_data(host_handle, tx_pipe, &amp;amp;tr);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to send data to respond to XBOX controller button inputs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works fine.&amp;nbsp; I can send packets that control the leds and rumble motors no problem.&amp;nbsp; The problem arises when I detach the controller from the micro.&amp;nbsp; The micro seems to get stuck.&amp;nbsp; I plug it back in and it doesn't responds.&amp;nbsp; So I rebuild the USB library with the debug output turned on and I get the following output on the serial port when I detach the controller before the crash:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;usb_host_driver_info_nonzero&lt;/P&gt;&lt;P&gt;usb_host_driver_info_nonzero FAILURE&lt;/P&gt;&lt;P&gt;usb_host_driver_info_scan SUCCESSFUL&lt;/P&gt;&lt;P&gt;usb_hostdev_attach_detach SUCCESSFUL&lt;/P&gt;&lt;P&gt;usb_dev_list_close_pipe&lt;/P&gt;&lt;P&gt;_usb_host_close_pipe&lt;/P&gt;&lt;P&gt;_usb_host_close_pipe SUCCESSFUL&lt;/P&gt;&lt;P&gt;usb_dev_list_close_pipe SUCCESSFUL&lt;/P&gt;&lt;P&gt;usb_dev_list_free_memlist&lt;/P&gt;&lt;P&gt;usb_hostdev_validate&lt;/P&gt;&lt;P&gt;usb_hostdev_validate SUCCESSFUL&lt;/P&gt;&lt;P&gt;usb_hostdev_delete_interface&lt;/P&gt;&lt;P&gt;usb_dev_list_close_pipe_bundle&lt;/P&gt;&lt;P&gt;usb_dev_list_close_pipe&lt;/P&gt;&lt;P&gt;_usb_host_close_pipeGoing to idle state&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like with it tries to execute the function _usb_host_close_pipe in host_close.c but it never makes it out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have any idea what is wrong?&amp;nbsp; Are there any examples of an usb hosting a HID device like a joystick showing IN/OUT comms on two interrupt endpoints?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any info would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Jul 2013 18:57:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/USB-Host-HID-Detach-Error/m-p/248595#M7155</guid>
      <dc:creator>mo_tron</dc:creator>
      <dc:date>2013-07-01T18:57:07Z</dc:date>
    </item>
  </channel>
</rss>

