<?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 Device driver core defect</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/USB-Device-driver-core-defect/m-p/247664#M7093</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;During my testing which consisted of disconnecting and reconnecting a Kinetis K60DN512 (MQX 4.0) USB port to Windows XP machine repeatedly, I was able to repeatedly generate a hard fault which locked up my processor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I traced the defect to the khci_dev_main.c file specifically in the _usb_device_usbfs_service_tk_dne_intr function &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My testing caused this function to be called with the direction set to USB_RECV. When this happened, It was possible to have&lt;/P&gt;&lt;P&gt;USB_XD_QUEUE_GET_HEAD(&amp;amp;state_ptr-&amp;gt;EP_INFO[ep_num].xd_queue_recv,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;amp;xd_ptr);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;return the xd_ptr as a NULL. The code isn't hardened against this and it crashed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By adding: &lt;/P&gt;&lt;P&gt;if (xd_ptr != NULL)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;} &amp;lt;- put this before: " &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;if ( _usb_device_usbfs_process_receive_request(state_ptr,ep_num,stat,&amp;amp;buffer_ptr)!=USB_OK)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seems to prevent the crash, it needs to be reviewed by the developers, becasue I think a more elegant solution is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a similar problem seems to be in _usb_device_usbfs_service_tk_dne_intr, but my testing didn't indicate that that function was being called on quick reconnects.&lt;/P&gt;&lt;P&gt;This problem also exists in MQX 3.8, but the file name is different&lt;/P&gt;&lt;P&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;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Feb 2013 17:24:22 GMT</pubDate>
    <dc:creator>timias</dc:creator>
    <dc:date>2013-02-04T17:24:22Z</dc:date>
    <item>
      <title>USB Device driver core defect</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/USB-Device-driver-core-defect/m-p/247664#M7093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;During my testing which consisted of disconnecting and reconnecting a Kinetis K60DN512 (MQX 4.0) USB port to Windows XP machine repeatedly, I was able to repeatedly generate a hard fault which locked up my processor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I traced the defect to the khci_dev_main.c file specifically in the _usb_device_usbfs_service_tk_dne_intr function &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My testing caused this function to be called with the direction set to USB_RECV. When this happened, It was possible to have&lt;/P&gt;&lt;P&gt;USB_XD_QUEUE_GET_HEAD(&amp;amp;state_ptr-&amp;gt;EP_INFO[ep_num].xd_queue_recv,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;amp;xd_ptr);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;return the xd_ptr as a NULL. The code isn't hardened against this and it crashed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By adding: &lt;/P&gt;&lt;P&gt;if (xd_ptr != NULL)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;} &amp;lt;- put this before: " &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;if ( _usb_device_usbfs_process_receive_request(state_ptr,ep_num,stat,&amp;amp;buffer_ptr)!=USB_OK)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seems to prevent the crash, it needs to be reviewed by the developers, becasue I think a more elegant solution is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a similar problem seems to be in _usb_device_usbfs_service_tk_dne_intr, but my testing didn't indicate that that function was being called on quick reconnects.&lt;/P&gt;&lt;P&gt;This problem also exists in MQX 3.8, but the file name is different&lt;/P&gt;&lt;P&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;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2013 17:24:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/USB-Device-driver-core-defect/m-p/247664#M7093</guid>
      <dc:creator>timias</dc:creator>
      <dc:date>2013-02-04T17:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: USB Device driver core defect</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/USB-Device-driver-core-defect/m-p/247665#M7094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Robert Hodson,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Firstly thank you for taking time to report this :smileywink:&amp;nbsp; I am going to find out more about these bugs in code . I will let you know the result eventually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;MartinK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Feb 2013 06:12:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/USB-Device-driver-core-defect/m-p/247665#M7094</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2013-02-05T06:12:54Z</dc:date>
    </item>
  </channel>
</rss>

