<?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>LPC MicrocontrollersのトピックRe: Possible issue with USBD when multiple connects?</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Possible-issue-with-USBD-when-multiple-connects/m-p/523973#M6609</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Tsuneo on Tue Jan 06 03:14:54 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Disconnect the device by removing the cable, the device remains powered&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you close the COM port on the PC "terminal program", before the USB cable is pulled off?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It may be a problem on the host side, when the "terminal program" still grabs the COM port while disconnection / reconnection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you would have a hardware analyzer, you could tell which one has the problem, host or device, at once ..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tsuneo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 16:47:09 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T16:47:09Z</dc:date>
    <item>
      <title>Possible issue with USBD when multiple connects?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Possible-issue-with-USBD-when-multiple-connects/m-p/523972#M6608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by simonhaines on Tue Jan 06 00:35:45 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using the USB device ROM stack from the lpc_chip_43xx project to enable CDC communication from my board to Windows (using usbser.sys) based on the VCOM examples.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am able to connect to my board and send/receive data OK. However, after disconnecting and reconnecting the device (which is separately powered and so remains running during disconnect), subsequent calls to &lt;/SPAN&gt;&lt;STRONG&gt;USBD_API-&amp;gt;hw-&amp;gt;WriteEP&lt;/STRONG&gt;&lt;SPAN&gt; do not call the &lt;/SPAN&gt;&lt;STRONG&gt;VCOM_bulk_in_hdlr&lt;/STRONG&gt;&lt;SPAN&gt; code to notify that a write has been completed. After a reconnect, the first call to &lt;/SPAN&gt;&lt;STRONG&gt;USBD_API-&amp;gt;hw-&amp;gt;WriteEP&lt;/STRONG&gt;&lt;SPAN&gt; correctly returns the number of bytes in the message, but because no subsequent call to the &lt;/SPAN&gt;&lt;STRONG&gt;VCOM_bulk_in_hdlr&lt;/STRONG&gt;&lt;SPAN&gt; is made, the &lt;/SPAN&gt;&lt;STRONG&gt;VCOM_TX_BUSY&lt;/STRONG&gt;&lt;SPAN&gt; flag is never cleared.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This only occurs after a disconnect and reconnect (it works as expected during the first session), and must be reset by uninstalling the driver under Windows, and removing and re-inserting the device (which somehow seems to reset the USB stack on my device).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this an issue with the USBD stack, which may not accommodate separately-powered devices? Or am I missing something? Here is how I reproduce my problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*] Connect device to Windows, it is recognised and a COM port is created&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*] Open the COM port, the device's &lt;/SPAN&gt;&lt;STRONG&gt;VCOM_SetLineCode&lt;/STRONG&gt;&lt;SPAN&gt; function is called (8 times)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*] Use a terminal program to send/receive data OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*] Disconnect the device by removing the cable, the device remains powered&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*] Connect the device by inserting the cable, it is recognised and a COM port is created&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*] Open the COM port, as above the device's &lt;/SPAN&gt;&lt;STRONG&gt;VCOM_SetLineCode&lt;/STRONG&gt;&lt;SPAN&gt; function is called&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*] Use a terminal program to send data: the data is received OK and the device echoes it back by calling &lt;/SPAN&gt;&lt;STRONG&gt;USBD_API-&amp;gt;hw-&amp;gt;WriteEP&lt;/STRONG&gt;&lt;SPAN&gt; which returns the correct number of bytes, but no subsequent call to &lt;/SPAN&gt;&lt;STRONG&gt;VCOM_bulk_in_hdlr&lt;/STRONG&gt;&lt;SPAN&gt; is made, so that the &lt;/SPAN&gt;&lt;STRONG&gt;VCOM_TX_BUSY&lt;/STRONG&gt;&lt;SPAN&gt; flag is never cleared&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*] To recover, uninstall the driver under Windows (without deleting the driver software), disconnect and re-connect the device&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks for any suggestions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:47:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Possible-issue-with-USBD-when-multiple-connects/m-p/523972#M6608</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Possible issue with USBD when multiple connects?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Possible-issue-with-USBD-when-multiple-connects/m-p/523973#M6609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Tsuneo on Tue Jan 06 03:14:54 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Disconnect the device by removing the cable, the device remains powered&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you close the COM port on the PC "terminal program", before the USB cable is pulled off?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It may be a problem on the host side, when the "terminal program" still grabs the COM port while disconnection / reconnection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you would have a hardware analyzer, you could tell which one has the problem, host or device, at once ..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tsuneo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:47:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Possible-issue-with-USBD-when-multiple-connects/m-p/523973#M6609</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Possible issue with USBD when multiple connects?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Possible-issue-with-USBD-when-multiple-connects/m-p/523974#M6610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by simonhaines on Wed Jan 07 01:33:06 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Tsuneo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes I've been closing the COM port on the terminal program (RealTerm). I don't have a hardware analyzer, but using packet capture (Usblyzer) I've been able to determine that a write on the CDC_IN endpoint from device to host does not arrive at the USB hub on the host, after a disconnect/reconnect event.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As it works OK under Linux for multiple disconnects/reconnects, I believe there is a subtle issue with the way the CDC part of the USBD stack interacts with the Windows usbser.sys driver when the device is separately powered. I think there is some state being retained, or some specific configuration sequence not occurring, when the device disconnects but doesn't power down, then reconnects to usbser.sys. I've tried calling &lt;/SPAN&gt;&lt;STRONG&gt;USBD_API-&amp;gt;hw-&amp;gt;ResetEP(pVcom-&amp;gt;hUsb, USB_CDC_IN_EP)&lt;/STRONG&gt;&lt;SPAN&gt; from the &lt;/SPAN&gt;&lt;STRONG&gt;USBD_API_INIT_PARAM_T.USB_Configure_Event&lt;/STRONG&gt;&lt;SPAN&gt; callback, which is reliably called on cable insertion, but this has no effect.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;I'm not sure what else I can try. I'd like to know if the problem is reproducible on other Windows systems (I'm using 8.1). The 'usbd_rom_cdc_vcom' example from the LPCOpen package (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fnxpfile%2Flpcopen-platform" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/nxpfile/lpcopen-platform&lt;/A&gt;&lt;SPAN&gt;) should be enough to test with Windows drivers from here: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fblog%2Fusb-cdcacm-drivers-windows" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/blog/usb-cdcacm-drivers-windows&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Further suggestions much appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:47:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Possible-issue-with-USBD-when-multiple-connects/m-p/523974#M6610</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Possible issue with USBD when multiple connects?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Possible-issue-with-USBD-when-multiple-connects/m-p/523975#M6611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by simonhaines on Sun Feb 22 22:23:28 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The correct resolution to this issue is to abandon using VCOM with the Windows usbser.sys driver, and instead implement a WCID device (WinUSB). Better for all concerned. See the wiki for the 'libwdi' (pbatard) project on GitHub for invaluable information.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:47:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Possible-issue-with-USBD-when-multiple-connects/m-p/523975#M6611</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:47:10Z</dc:date>
    </item>
  </channel>
</rss>

