<?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>topic USB ROM Resource Usage in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534316#M4036</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rsargant on Tue Jul 24 10:00:27 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I'm working with an LPC1347 chip and the USB ROM CDC example project. Everything seems pretty straightforward but had a few questions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#1) Are the end point handler functions registered via RegisterEpHandler called under USB interrupt context?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#2) In addition to memory usage (which seems to be explicitly configured), what hardware resources (if any) is the ROM stack using? Any timers?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 01:44:58 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T01:44:58Z</dc:date>
    <item>
      <title>USB ROM Resource Usage</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534316#M4036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rsargant on Tue Jul 24 10:00:27 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I'm working with an LPC1347 chip and the USB ROM CDC example project. Everything seems pretty straightforward but had a few questions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#1) Are the end point handler functions registered via RegisterEpHandler called under USB interrupt context?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#2) In addition to memory usage (which seems to be explicitly configured), what hardware resources (if any) is the ROM stack using? Any timers?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:44:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534316#M4036</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: USB ROM Resource Usage</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534317#M4037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by NXP_Europe on Wed Jul 25 13:33:06 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi rsargant,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[COLOR=#1f497d][FONT=Calibri]The answers are:[/FONT][/COLOR]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[COLOR=#1f497d][FONT=Calibri]#1 yes[/FONT][/COLOR]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[COLOR=#1f497d][FONT=Calibri]#2 only memory[/FONT][/COLOR]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:44:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534317#M4037</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: USB ROM Resource Usage</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534318#M4038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rsargant on Tue Aug 07 10:05:48 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ran into some issues because I believe I had the ROM stack using an area of memory that overlapped with the heap. I changed the USB ROM RAM configuration to point at the dedicated usbram region on LPC1347.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It definitely fixed my problems but is this safe to do? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; usb_param.usb_reg_base = LPC_USB_BASE;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//&amp;nbsp; usb_param.mem_base = 0x10001000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // usb_param.mem_size = 0x1000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; usb_param.mem_base = 0x20004000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; usb_param.mem_size = 0x800;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:45:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534318#M4038</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: USB ROM Resource Usage</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534319#M4039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by slocke on Fri Nov 30 08:16:27 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry to resurrect a dead thread, but I'm looking for the same information as rsargant asked in his final message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it safe to pass the USB Ram location to the on-chip ROM drivers?&amp;nbsp; I'm using an LPC11U24 with the on-chip CDC driver.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After reading rsargant's post, I assumed it was safe, and passed it to the driver, but I was having issues with enumeration failing.&amp;nbsp; I changed it to use 0x10001000, and enumeration passes, but that leaves a big chunk of RAM (usb ram) sitting there "unused".&amp;nbsp; Do the on-chip ROM drivers already know about this RAM location and use it all for themselves?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:45:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534319#M4039</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: USB ROM Resource Usage</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534320#M4040</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 Sat Dec 01 10:14:48 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe the USB on-chip driver assigns the Endpoint command/status list (EPLISTSTART) and endpoint Data buffer (DATABUFSTART) at the start of the USB RAM (0x20004000).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To confirm it, break on debugger while your LPC11U24 runs the ROM driver example, and read out EPLISTSTART and DATABUFSTART registors. Unfortunately, I can't do it by myself, because I'm working on a place, far from my office.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I believe you may assign the rest of the USB RAM to the memory for the instances of USBD and CDC APIs, because CDC implementation doesn't use all of the USB RAM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tsuneo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:45:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534320#M4040</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: USB ROM Resource Usage</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534321#M4041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by slocke on Mon Dec 03 08:25:42 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't have a debugger attached to my board, but I printed out those two registers, and they are:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;EPLISTSTART: 10001000
DATABUFSTART: 10000000&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;This is after I've initialized both the USB core and CDC class, then called 'Connect()'.&amp;nbsp; I can see were EPLISTSTART comes from, as I pass 0x10001000 to the USB core initialization, but I can't see why DATABUFSTART is set to 0x10000000 unless it hasn't been properly initialized yet?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm starting to get pretty frustrated with the lack of (seemingly correct) documentation for the USB ROM drivers.&amp;nbsp; Thanks to posts by members like Tsuneo, and many years of embedded development experience, I've been able to forge ahead, but I would really appreciate it if someone from NXP could chime in with some real answers.&amp;nbsp; Other than this particular memory issue, three other nuisances that I've run across:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. The documentation says that mem_base and mem_size will be updated with the reference to the next mem_base and remaining 'size' so that calls to follow-on classes can be cascaded. What I've found:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;//as per USB ROM CDC Example
usb_param.mem_base = 0x10001000
usb_param.mem_size = 0x1000&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;Produces a next base/size pair of 0x10001700 and 0x0BC0, respectively.&amp;nbsp; I'm not exactly sure how this math works...it seems that 0x700 bytes are used, but 0x0BC0 bytes of the 0x1000 are remaining?&amp;nbsp; Is there some stack/heap allocation difference going on that I should know about?&amp;nbsp; The CDC class API behaves slightly better.&amp;nbsp; When I pass it the output above (0x10001700/0x0BC0), it claims the next base/size pair is 0x10001748/0x0B78, which I expect is correct.&amp;nbsp; Both of these, though, are different than the amount of RAM reported as 'needed' by the USB core (0x02C0) and the CDC layer (0x004C).&amp;nbsp; Admittedly, the CDC layer is pretty close to the actual use, so I'll give them a break on that one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Even using the demo CDC ROM application, sometimes the device fails to enumerate correctly.&amp;nbsp; It seems quite random to me.&amp;nbsp; I put a reset button on the processor and it might take 4 or 5 resets to get the Communications Port device in Windows 7 to come up without a 'This device cannot start' error.&amp;nbsp; The error seems to happen when Windows requests the configuration descriptor, and the device only returns the first 64 bytes, leaving the tail end of the transfer incomplete with a STALL error (according to a windows USB driver trace).&amp;nbsp; It's not a hardware issue, as I can reset the device constantly in bootload mode and it never fails to enumerate correctly as a MSC device.&amp;nbsp; It doesn't seem that anything I do in firmware can make it as reliable as the MSC enumeration.&amp;nbsp; Has anyone else tried this or replicated this issue?&amp;nbsp; Even in the error state, if I uninstall the driver in device manager, and re-discover hardware, it shows up correctly without having to perform a hardware reset.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. I can't get the CDC class EP handlers (CDC_BulkIN_Hdlr or CDC_BulkOUT_Hdlr) to trigger.&amp;nbsp; It seems that this should be the *correct* way to handle CDC bulk IN/OUT transfers, but I've had zero luck.&amp;nbsp; I can force data out the EP with WriteEP, but no BulkIN handler trigger.&amp;nbsp; Is this normal?&amp;nbsp; Under what circumstances should the handler be called with a USB_EVT_IN event (or any other, for that matter)?&amp;nbsp; Same with the BulkOUT handler.&amp;nbsp; I can register the very same handler function using RegisterEpHandler, and it works fine.&amp;nbsp; But I get no triggers with CDC_BulkOUT_Hdlr.&amp;nbsp; Actually, from a windows driver trace, it appears that the device isn't even accepting OUT transfers from the host.&amp;nbsp; Is there something I'm missing? Do I have to 'enable' the CDC endpoint handlers somehow?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:45:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534321#M4041</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: USB ROM Resource Usage</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534322#M4042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by slocke on Mon Dec 03 08:31:28 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Just an update:&amp;nbsp; I know why DATABUFSTART is 0x10000000....it simply points to the start *page* of the data buffers&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:45:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534322#M4042</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: USB ROM Resource Usage</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534323#M4043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rsargant on Sat Jan 05 08:01:56 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm back and looking for more guidance on this issue.&amp;nbsp; For several months, our code worked fine on LPC1347 with this configuration :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;usb_param.mem_base = 0x20004000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;usb_param.mem_size = 0x800;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The USB/CDC interface broke when I recently turned on compiler size optimizations. The device would enumerate on the PC but ALL terminal applications on the PC would get a generic "Error 87 Invalid Parameter" error opening the Port (on windows).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I changed the USB ROM memory configuration (I moved it past the start of USB RAM) and it started to work normally again. Of course I suspected an issue with our code, so I tried the stock NXP USB CDC ROM example and found that it failed with the above configuration as well even though it worked with our code "around" until the compiler size optimizations were enabled. Crazy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It really seems like&amp;nbsp; there are several undocumented nuances related to configuring the stack "safely" or possibly an issue with the stack itself.&amp;nbsp;&amp;nbsp; I've observed the same oddities with the mem_base/mem_size chaining that sloke alluded to and I'm not even relying on that anymore because I can't understand what its doing. My new configuration is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;usb_param.mem_base = 0x20004100;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;usb_param.mem_size = 0x500;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For USB Core and&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;usb_param.mem_base = 0x20004600;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;usb_param.mem_size = 0x200;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for CDC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is working for stock example and our software. With so many unknowns I have no idea how long it will last though..&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:45:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-ROM-Resource-Usage/m-p/534323#M4043</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:45:03Z</dc:date>
    </item>
  </channel>
</rss>

