<?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>MCUXpresso SDK中的主题 Re: USB stack device task option</title>
    <link>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/1558110#M4017</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm in the process of migrating a project from a Kinetis part to an LPC55S69 using SDK version 2.8.2 and once again I've run into the problem of lack of documentation for this feature. I can't find any examples that use the USB task mode.&lt;/P&gt;&lt;P&gt;I see that there's a macro for&amp;nbsp;USB_DeviceLpcIp3511TaskFunction(). Like the KHCI and EHCI macros, it evaluates to USB_DeviceTaskFunction(). Do I just call this function from the task? Should I be calling USB_DeviceTaskFunction() directly? Is there an example?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2022 02:51:09 GMT</pubDate>
    <dc:creator>scottm</dc:creator>
    <dc:date>2022-11-23T02:51:09Z</dc:date>
    <item>
      <title>USB stack device task option</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884652#M1420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working on porting a project from the old Freescale bare metal USB stack v5 to the current SDK version mostly for the sake of improving compatibility with FreeRTOS (the v5 stack never had the OS support finished) and I've got it running, but I can't find the information I'm looking for on how it interacts with an RTOS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm mostly interested in&amp;nbsp;USB_DEVICE_CONFIG_USE_TASK.&amp;nbsp; Based on what I remember of the v4 stack and what I can see in the code, I&amp;nbsp;&lt;EM&gt;think&lt;/EM&gt; the option sets it up to use a queue so that the USB ISR just passes messages to a dedicated task.&amp;nbsp; Is this documented somewhere?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of the things I'm looking for is the required stack size.&amp;nbsp; The example is set to 5000 bytes.&amp;nbsp; How much is required by the stack itself?&amp;nbsp; And I'm assuming that the application callbacks are made from this task.&amp;nbsp; Is that right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've skimmed through&amp;nbsp;all of the USB stack user's guide, device reference manual, and composite device reference manual, and searched all over for details on the task setup, and I'm just not finding anything.&amp;nbsp; I've been at it for 12 hours today and I'm running out of steam.&amp;nbsp; If someone could point me in the direction of the appropriate documentation, I'd really appreciate it.&amp;nbsp; Or if it doesn't exist yet, that'd be good to know too and I can dive in to the source code and figure it out when I'm not so tired - I just can't take any more searching for documentation that might not exist tonight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Mar 2019 04:13:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884652#M1420</guid>
      <dc:creator>scottm</dc:creator>
      <dc:date>2019-03-24T04:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: USB stack device task option</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884653#M1421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I know, the usb stack v5 is integrated into MQX 4.2.&lt;/P&gt;&lt;P&gt;I think you can refer to the docs under the MQX 4.2 installation folder.&lt;/P&gt;&lt;P&gt;C:\Freescale\Freescale_MQX_4_2\doc\usb_v2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/67687i4FE2F8144CC8F79E/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2019 07:04:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884653#M1421</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2019-03-26T07:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: USB stack device task option</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884654#M1422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Current SDK has USB support with FreeRTOS.&amp;nbsp; I would suggest you try the new USB stack. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2019 07:11:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884654#M1422</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2019-03-26T07:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: USB stack device task option</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884655#M1423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's the new USB stack that I'm talking about.&amp;nbsp; The version I'm porting the project&amp;nbsp;&lt;EM&gt;from&lt;/EM&gt; is the bare metal v5 stack.&amp;nbsp; That stack has some issues, like a major bug in the composite device handling due to an uninitialized variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question still stands - where can I find information on&amp;nbsp;USB_DEVICE_CONFIG_USE_TASK?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2019 15:58:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884655#M1423</guid>
      <dc:creator>scottm</dc:creator>
      <dc:date>2019-03-26T15:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: USB stack device task option</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884656#M1424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, the document not mention this macro. I will report this to the develop team.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If&amp;nbsp; &lt;SPAN style="font-size: 12.0pt;"&gt;USB_DEVICE_CONFIG_USE_TASK &lt;/SPAN&gt;is 0 &amp;nbsp;&amp;nbsp; , it means CPU is in interrupted mode when USB Callback is servicing.&lt;/P&gt;&lt;P&gt;If&amp;nbsp; USB_DEVICE_CONFIG_USE_TASK is 1,&amp;nbsp; it means&amp;nbsp; CPU is in normal (not interrupt ) mode when USB Callback is servicing.&lt;/P&gt;&lt;P&gt;In other words, this macro is defined to check whether the callback is called&amp;nbsp; by a task, or by an interrupt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2019 12:49:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884656#M1424</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2019-03-27T12:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: USB stack device task option</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884657#M1425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've got the new stack working with the&amp;nbsp;USB_DEVICE_CONFIG_USE_TASK option enabled.&amp;nbsp; My understanding of its operation is this:&amp;nbsp; Set&amp;nbsp;&lt;SPAN&gt;USB_DEVICE_CONFIG_USE_TASK=1 in your USB device configuration to configure the USB stack to use a dedicated task to process USB events.&amp;nbsp; You must create an OS task that calls&amp;nbsp;USB_DeviceKhciTaskFunction() in a loop, and this function blocks indefinitely while waiting for messages from the USB ISR.&amp;nbsp; (This is important in case the user was planning to try to do anything else in that task loop.)&amp;nbsp; The USB stack makes all&amp;nbsp;callbacks from this task.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is that correct?&amp;nbsp; It'd still be nice to have a little more discussion on the architecture and the flow of messages, but I think this is the essential information I was looking for.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You've also provided an example of one of my most frequent complaints about the documentation:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;If&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 12pt;"&gt;USB_DEVICE_CONFIG_USE_TASK&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;is 0 &amp;nbsp;&amp;nbsp; , it means CPU is in interrupted mode when USB Callback is servicing.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;I can't imagine how difficult it must be to write technical documentation in a non-native language - I can barely ask for directions in any language other than English - but an experienced tech writer once gave me an easy piece of advice that lots of native speakers overlook: When describing an action, say who does what to whom.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;To say "If x is 0, it means..." doesn't say who sets x.&amp;nbsp; The same words could describe a status bit rather than a configuration setting.&amp;nbsp; The phrase "it means" sounds more likely to describe a status than an action.&amp;nbsp; That's why my phrasing was "Set&amp;nbsp;&lt;SPAN style="color: #3d3d3d;"&gt;USB_DEVICE_CONFIG_USE_TASK=1 in your USB configuration to...", so the reader knows they're the one who sets it and what the result will be.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #3d3d3d; "&gt;I think using active voice and imperative mood ("do this" vs "this is to be done") sounds rude or demanding in some languages, but honestly I'd be fine with the documentation calling me names and mocking my fashion choices as long as the important parts were clear and unambiguous.&amp;nbsp; :smileywink:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #3d3d3d; "&gt;Even if there was a community-maintained wiki or something, that might be a start.&amp;nbsp; I'd be happy to share my notes there, where they might do some good for others, rather than complain about it here.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #3d3d3d; "&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #3d3d3d; "&gt;Scott&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2019 15:56:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884657#M1425</guid>
      <dc:creator>scottm</dc:creator>
      <dc:date>2019-03-27T15:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: USB stack device task option</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884658#M1426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks you for correcting my English. About the &lt;SPAN style="background-color: #ffffff; color: #3d3d3d; "&gt;USB_DEVICE_CONFIG_USE_TASK, your understanding is right. Please be kindly noted that there is an OSA folder in USB stack, this folder includes the adapter interfaces for various OSes. You can use it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;middleware\usb\osa\usb_osa_freertos.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2019 14:37:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/884658#M1426</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2019-03-28T14:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: USB stack device task option</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/1558110#M4017</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm in the process of migrating a project from a Kinetis part to an LPC55S69 using SDK version 2.8.2 and once again I've run into the problem of lack of documentation for this feature. I can't find any examples that use the USB task mode.&lt;/P&gt;&lt;P&gt;I see that there's a macro for&amp;nbsp;USB_DeviceLpcIp3511TaskFunction(). Like the KHCI and EHCI macros, it evaluates to USB_DeviceTaskFunction(). Do I just call this function from the task? Should I be calling USB_DeviceTaskFunction() directly? Is there an example?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 02:51:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/USB-stack-device-task-option/m-p/1558110#M4017</guid>
      <dc:creator>scottm</dc:creator>
      <dc:date>2022-11-23T02:51:09Z</dc:date>
    </item>
  </channel>
</rss>

