<?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中的主题 Can we pass buffer defined in the local SRAM to the function call USBD_API-&amp;gt;hw-&amp;gt;ReadEP when we use USBD ROM stack for generic HID device?</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Can-we-pass-buffer-defined-in-the-local-SRAM-to-the-function/m-p/880464#M35190</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;When we use the USBD ROM STACK in LPC4357, can we pass a buffer which is defined in the local SRAM (refer LP4357 memory map 0x1000 0000 -- ) to the function call USBD_API-&amp;gt;hw-&amp;gt;ReadEP&lt;/P&gt;&lt;P&gt;&amp;nbsp;or should it only be in AHB SRAM (0x2000 0000 ) . The same question for the function call USBD_API-&amp;gt;hw-&amp;gt;WriteEP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;In hid_generic .c&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Char outbuffer[64] ;&lt;/P&gt;&lt;P&gt;Char inbuffer[64];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Somewhere in our EpHandler&lt;/P&gt;&lt;P&gt;&amp;nbsp;USBD_API-&amp;gt;hw-&amp;gt;ReadEP(hUsb, pHidCtrl-&amp;gt;epout_adr, outbuffer);&lt;/P&gt;&lt;P&gt;USBD_API-&amp;gt;hw-&amp;gt;WriteEP(hUsb, pHidCtrl-&amp;gt;epin_adr, inbuffer, 64);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or do we need to do the following way.&lt;/P&gt;&lt;P&gt;uint8_t *outbuffer;&lt;/P&gt;&lt;P&gt;uint8_t *inbuffer;&lt;/P&gt;&lt;P&gt;During the initialization&lt;/P&gt;&lt;P&gt;hid_param.mem_base = USB_STACK_MEMBASE ;&amp;nbsp;&amp;nbsp; //0x2000 0000 &amp;nbsp;-- of course done much elegantly but this what the code does.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hid_param.mem_size = 0x2000;&lt;/P&gt;&lt;P&gt;outbuffer =&amp;nbsp; (uint8_t *) hid_param.mem_base;&lt;/P&gt;&lt;P&gt;hid_param.mem_base += 64;&lt;/P&gt;&lt;P&gt;hid_param.mem_size += 64;&lt;/P&gt;&lt;P&gt;inbuffer = (uint8_t *) hid_param.mem_base;&lt;/P&gt;&lt;P&gt;hid_param.mem_base += 64;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hid_param.mem_size += 64;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the sample hid_generic.c the memory size is also updated (hid_param.mem_size += 64). Why is it required?&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Mar 2019 21:24:35 GMT</pubDate>
    <dc:creator>ssudhir</dc:creator>
    <dc:date>2019-03-08T21:24:35Z</dc:date>
    <item>
      <title>Can we pass buffer defined in the local SRAM to the function call USBD_API-&gt;hw-&gt;ReadEP when we use USBD ROM stack for generic HID device?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Can-we-pass-buffer-defined-in-the-local-SRAM-to-the-function/m-p/880464#M35190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;When we use the USBD ROM STACK in LPC4357, can we pass a buffer which is defined in the local SRAM (refer LP4357 memory map 0x1000 0000 -- ) to the function call USBD_API-&amp;gt;hw-&amp;gt;ReadEP&lt;/P&gt;&lt;P&gt;&amp;nbsp;or should it only be in AHB SRAM (0x2000 0000 ) . The same question for the function call USBD_API-&amp;gt;hw-&amp;gt;WriteEP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;In hid_generic .c&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Char outbuffer[64] ;&lt;/P&gt;&lt;P&gt;Char inbuffer[64];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Somewhere in our EpHandler&lt;/P&gt;&lt;P&gt;&amp;nbsp;USBD_API-&amp;gt;hw-&amp;gt;ReadEP(hUsb, pHidCtrl-&amp;gt;epout_adr, outbuffer);&lt;/P&gt;&lt;P&gt;USBD_API-&amp;gt;hw-&amp;gt;WriteEP(hUsb, pHidCtrl-&amp;gt;epin_adr, inbuffer, 64);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or do we need to do the following way.&lt;/P&gt;&lt;P&gt;uint8_t *outbuffer;&lt;/P&gt;&lt;P&gt;uint8_t *inbuffer;&lt;/P&gt;&lt;P&gt;During the initialization&lt;/P&gt;&lt;P&gt;hid_param.mem_base = USB_STACK_MEMBASE ;&amp;nbsp;&amp;nbsp; //0x2000 0000 &amp;nbsp;-- of course done much elegantly but this what the code does.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hid_param.mem_size = 0x2000;&lt;/P&gt;&lt;P&gt;outbuffer =&amp;nbsp; (uint8_t *) hid_param.mem_base;&lt;/P&gt;&lt;P&gt;hid_param.mem_base += 64;&lt;/P&gt;&lt;P&gt;hid_param.mem_size += 64;&lt;/P&gt;&lt;P&gt;inbuffer = (uint8_t *) hid_param.mem_base;&lt;/P&gt;&lt;P&gt;hid_param.mem_base += 64;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hid_param.mem_size += 64;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the sample hid_generic.c the memory size is also updated (hid_param.mem_size += 64). Why is it required?&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2019 21:24:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Can-we-pass-buffer-defined-in-the-local-SRAM-to-the-function/m-p/880464#M35190</guid>
      <dc:creator>ssudhir</dc:creator>
      <dc:date>2019-03-08T21:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Can we pass buffer defined in the local SRAM to the function call USBD_API-&gt;hw-&gt;ReadEP when we use USBD ROM stack for generic HID device?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Can-we-pass-buffer-defined-in-the-local-SRAM-to-the-function/m-p/880465#M35191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.&lt;BR /&gt;In theory, it's okay to assign the stack in the local RAM, however, the variable values may overlap the USB stack area, it definitely would make the USB ROM API don't work normally.&lt;BR /&gt;So it's a recommended way to assign the variable values and USB stack in tow independent RAM area respectively.&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2019 06:07:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Can-we-pass-buffer-defined-in-the-local-SRAM-to-the-function/m-p/880465#M35191</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2019-03-11T06:07:08Z</dc:date>
    </item>
  </channel>
</rss>

