<?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: USB re-enumeration</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1137095#M42140</link>
    <description>&lt;P&gt;And what's really strange that&amp;nbsp;usb_echo("usbReEnumerate\r\n"); line fixes this issue. I can't explain this phenomenon.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Sep 2020 16:42:59 GMT</pubDate>
    <dc:creator>emblink182</dc:creator>
    <dc:date>2020-09-03T16:42:59Z</dc:date>
    <item>
      <title>USB re-enumeration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1050425#M40685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have a question about USB HS enumeration on LPC54605J512 MCU.&lt;/P&gt;&lt;P&gt;I need to change the polling rate of the USB device in runtime. In order to do that I need to force the host to re-enumerate the device. I have tried to call USB_DeviceStop() and USB_DeviceRun() right after, but most of the time device fails to enumerate. Reboot MCU and start with a new configuration is not an option for my particular case.&lt;/P&gt;&lt;P&gt;Is there any way to do that with USB stack functions or maybe manual registers settings?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal; font-size: 14px;"&gt;&lt;DIV&gt;&lt;DIV style="background-color: #1e1e1e; font-weight: normal;"&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Aug 2020 15:42:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1050425#M40685</guid>
      <dc:creator>emblink182</dc:creator>
      <dc:date>2020-08-20T15:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: USB re-enumeration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1050426#M40686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;What I do to re-enumerate w/o MCU reset (USB0 or USB1):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;To bring the stack up:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;a)call&amp;nbsp;USB_DeviceInit()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;b)enable USB's IRQ&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;c)call USB_DeviceRun()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;to bring the stack down:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;a)call&amp;nbsp;USB_DeviceStop()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;b)disable USB's IRQ&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;c)call USB_DeviceDeinit()&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Aug 2020 21:03:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1050426#M40686</guid>
      <dc:creator>belmontbob59</dc:creator>
      <dc:date>2020-08-20T21:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: USB re-enumeration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1134251#M42128</link>
      <description>&lt;P&gt;Hi, thanks for your suggestion and sorry for the late response.&lt;/P&gt;&lt;P&gt;I figured out that this method is working well on non-RTOS examples. But unfortunately, it doesn't with the FreeRTOS example.&amp;nbsp;If I call usbReEnumerate() from other contexts, such as the timer task, the USB fails to enumerate. And I'm struggling to answer why that happening. I used&amp;nbsp; lpcxpresso54628_dev_hid_mouse_freertos project with minor modifications as an experimental ground.&lt;/P&gt;&lt;P&gt;#define USB_DEVICE_CONFIG_LPCIP3511HS (1U)&lt;/P&gt;&lt;P&gt;#define USB_DEVICE_CONFIG_USE_TASK (1U)&lt;/P&gt;&lt;P&gt;#define USB_DEVICE_CONFIG_COMPLIANCE_TEST (1U)&lt;/P&gt;&lt;P&gt;#define USB_DEVICE_CONFIG_DETACH_ENABLE (1U)&lt;/P&gt;&lt;P&gt;In mouse.c I have added&amp;nbsp;// TEST_CODE comment in places where example was modified. Basically I created a one shot 1 sec software timer, starting it after usb got configured and call usbReEnumerate() in timer callback. Modified files are in attachment.&lt;/P&gt;&lt;P&gt;static void usbReEnumerate(TimerHandle_t xTimer) // TEST_CODE&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (void) xTimer;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; usb_status_t res = kStatus_USB_Success;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; // usb_echo("usbReEnumerate\r\n");&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; if (g_UsbDeviceHidMouse.attach) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; USB_DeviceStop(g_UsbDeviceHidMouse.deviceHandle); // always returns kStatus_USB_Error&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_UsbDeviceHidMouse.attach = 0; // allows ignoring suspend event after re-enable.&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NVIC_DisableIRQ(USB1_IRQn);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; usb_status_t res = USB_DeviceClassDeinit(CONTROLLER_ID);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // usb_status_t res = USB_DeviceDeinit(g_UsbDeviceHidMouse.deviceHandle);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // res |= USB_DeviceInit(CONTROLLER_ID, USB_DeviceCallback,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;g_UsbDeviceHidMouse.deviceHandle);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;res |= USB_DeviceClassInit(CONTROLLER_ID, &amp;amp;g_UsbDeviceHidConfigList,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;amp;g_UsbDeviceHidMouse.deviceHandle);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NVIC_ClearPendingIRQ(USB1_IRQn);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NVIC_EnableIRQ(USB1_IRQn);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;USB_DeviceRun(g_UsbDeviceHidMouse.deviceHandle); // always returns kStatus_USB_Error&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; assert(kStatus_USB_Success == res);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;I also tried to use directly&amp;nbsp;&lt;SPAN&gt;USB_DeviceInit() and&amp;nbsp;USB_DeviceDeinit() but that didn't work also.&amp;nbsp;USB_DeviceClassInit and USB_DeviceClassDeinit eventually call those functions so I think it's not a big deal here.&amp;nbsp;Strange thing happens if uncomment&amp;nbsp;// usb_echo("usbReEnumerate\r\n"); After that usb re-enumerates succesfully. And that's confusing.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 12:56:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1134251#M42128</guid>
      <dc:creator>emblink182</dc:creator>
      <dc:date>2020-09-02T12:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: USB re-enumeration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1136594#M42138</link>
      <description>&lt;P&gt;The call to &lt;SPAN&gt;NVIC_ClearPendingIRQ(USB1_IRQn);&amp;nbsp; is invalid&amp;nbsp;&lt;/SPAN&gt;after the call to USB_DeviceClassInit() because you are messing up with lpcip3511.c workflow at that point.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 15:57:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1136594#M42138</guid>
      <dc:creator>belmontbob59</dc:creator>
      <dc:date>2020-09-03T15:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: USB re-enumeration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1136827#M42139</link>
      <description>&lt;P&gt;I ran this code on a non-RTOS example and it works fine. I also tried not to call NVIC_ClearPendingIRQ(USB1_IRQn); in the RTOS example but the behavior didn't change.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 16:25:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1136827#M42139</guid>
      <dc:creator>emblink182</dc:creator>
      <dc:date>2020-09-03T16:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: USB re-enumeration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1137095#M42140</link>
      <description>&lt;P&gt;And what's really strange that&amp;nbsp;usb_echo("usbReEnumerate\r\n"); line fixes this issue. I can't explain this phenomenon.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 16:42:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1137095#M42140</guid>
      <dc:creator>emblink182</dc:creator>
      <dc:date>2020-09-03T16:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: USB re-enumeration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1170357#M42640</link>
      <description>&lt;P&gt;Solved this problem by adding a custom notification and device event.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="notification.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/127848iF4DC3C400E70B326/image-size/large?v=v2&amp;amp;px=999" role="button" title="notification.png" alt="notification.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="event.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/127852i737AB5D0F4FF9821/image-size/large?v=v2&amp;amp;px=999" role="button" title="event.png" alt="event.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Add a case&amp;nbsp;&lt;SPAN&gt;kUSB_DeviceNotifyRestart&amp;nbsp;&lt;/SPAN&gt;in &lt;SPAN&gt;USB_DeviceNotification and call&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;USB_DeviceRestartNotification from there.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="device callback.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/127855i8B0BFBFEB2005275/image-size/large?v=v2&amp;amp;px=999" role="button" title="device callback.png" alt="device callback.png" /&gt;&lt;/span&gt;&lt;P&gt;&lt;SPAN&gt;Eventually,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;USB_DeviceCallback gets called with event param&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;kUSB_DeviceEventRestart from USB task context.&lt;/SPAN&gt;&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="device callback event.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/127856i406E8B9DFA6FE1D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="device callback event.png" alt="device callback event.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="usb restart.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/127859i563AC988444C972A/image-size/large?v=v2&amp;amp;px=999" role="button" title="usb restart.png" alt="usb restart.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sendUsbRestartCommand&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;called manually from other task context and&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;pushes re-enumeration notification to the internal queue.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="func.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/127851iD503B80345B8495E/image-size/large?v=v2&amp;amp;px=999" role="button" title="func.png" alt="func.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This code is not breaking the internal queue of the driver.&lt;/P&gt;&lt;P&gt;Re enumeration worked fine after that.&amp;nbsp;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 12:51:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USB-re-enumeration/m-p/1170357#M42640</guid>
      <dc:creator>emblink182</dc:creator>
      <dc:date>2020-10-20T12:51:48Z</dc:date>
    </item>
  </channel>
</rss>

