<?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 Re: USB msd not sticking in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-msd-not-sticking/m-p/577331#M23167</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Rob65 on Mon Jun 13 23:50:36 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you Gbm,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;you just hit Beto with a stick into a corner of which he apparently does not return anymore.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks! This is the best way to make sure that there will be not too many newby questions on this forum. Very professional attitude &lt;SPAN class="lia-unicode-emoji" title=":disappointed_face:"&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just read Beto's question and I think it is pretty clear:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt; [B][COLOR=Red]usb msd example[/COLOR][/B] on a LPC1343.&lt;BR /&gt;&lt;BR /&gt;When I drag a bin file to the drive does it go to ram or flash.&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;Which sample project? Dear Gbm, please read the first sentence: [B]USB MSD example[/B] for the lpc1343. In my version of the example projects this is called usbmsd.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or, to almost quote your (Gbm's) own words: The questions are generally written for the people who want to read and understand English. If this isn't your goal, or you do not want to help out a new LPCXpresso programmer you don't need to reply at all. (Yes, I can be professional too :D)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But now all flaming aside and back to the question ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is indeed not too much information given with the example projects, you have to read through the source code to discover what this does.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The USB source code is split over a number of logically names C files. Logical ... if you know how the USB code is written and what it does. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The files named usb...c contain the core USB stack, files with msc...c add the mass storage class and the other two files (DiskImg.c and memory.c) contain the user code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DiskImg contains just the file system with the .txt file, the user program can be found in memory.c.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you read through that file you will find the following:&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;int main (void) {
&amp;nbsp; uint32_t n;

&amp;nbsp; for (n = 0; n &amp;lt; MSC_ImageSize; n++) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Copy Initial Disk Image */
&amp;nbsp;&amp;nbsp;&amp;nbsp; Memory[n] = DiskImage[n];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&amp;nbsp;&amp;nbsp; from Flash to RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */
&amp;nbsp; }
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;That should answer your question: the initial disk image is copied from flash to RAM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Looking further in mscuser.c you will find the following function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;void MSC_MemoryWrite (void) {
&amp;nbsp; uint32_t n;

&amp;nbsp; if ((Offset + BulkLen) &amp;gt; MSC_MemorySize) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; BulkLen = MSC_MemorySize - Offset;
&amp;nbsp;&amp;nbsp;&amp;nbsp; BulkStage = MSC_BS_CSW;
&amp;nbsp;&amp;nbsp;&amp;nbsp; MSC_SetStallEP(MSC_EP_OUT);
&amp;nbsp; }

[COLOR=Red][B]&amp;nbsp; for (n = 0; n &amp;lt; BulkLen; n++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; Memory[Offset + n] = BulkBuf[n];
&amp;nbsp; }
[/B][/COLOR]
&amp;nbsp; Offset += BulkLen;
&amp;nbsp; Length -= BulkLen;

&amp;nbsp; CSW.dDataResidue -= BulkLen;

&amp;nbsp; if ((Length == 0) || (BulkStage == MSC_BS_CSW)) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; CSW.bStatus = CSW_CMD_PASSED;
&amp;nbsp;&amp;nbsp;&amp;nbsp; MSC_SetCSW();
&amp;nbsp; }
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;And all at the top of that file you will find the definition for Memory[] which is an array of uint8_t in RAM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 23:56:33 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T23:56:33Z</dc:date>
    <item>
      <title>USB msd not sticking</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-msd-not-sticking/m-p/577327#M23163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by beto on Mon Jun 06 21:12:17 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;re:&amp;nbsp; usb msd example on a LPC1343.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I drag a bin file to the drive does it go to ram or flash. My bin file does not seem stick after a reboot, the txt file reappears.&amp;nbsp; :mad:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 23:56:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-msd-not-sticking/m-p/577327#M23163</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T23:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: USB msd not sticking</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-msd-not-sticking/m-p/577328#M23164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by gbm on Mon Jun 06 21:58:59 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The examples are generally written for the people who want to read and understand the sample code. If this isn't your goal, you don't need to touch them at all.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 23:56:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-msd-not-sticking/m-p/577328#M23164</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T23:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: USB msd not sticking</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-msd-not-sticking/m-p/577329#M23165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by beto on Tue Jun 07 09:13:01 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;So...are you telling me that everybody who uses the usb code understands the details of it....and everyone that uses the free rtos understands that also....you must be quite the expert....&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone know where I can ask questions on LPCexpresso sample code:mad:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 23:56:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-msd-not-sticking/m-p/577329#M23165</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T23:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: USB msd not sticking</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-msd-not-sticking/m-p/577330#M23166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by gbm on Tue Jun 07 11:01:05 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;First, you didn't write anything about WHICH sample project you are trying to use. Second, there should be a C source file implementing block device interface for MSD - check the name of the file - maybe it contains the information you are looking for. If not - have a look inside.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 23:56:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-msd-not-sticking/m-p/577330#M23166</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T23:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: USB msd not sticking</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USB-msd-not-sticking/m-p/577331#M23167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Rob65 on Mon Jun 13 23:50:36 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you Gbm,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;you just hit Beto with a stick into a corner of which he apparently does not return anymore.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks! This is the best way to make sure that there will be not too many newby questions on this forum. Very professional attitude &lt;SPAN class="lia-unicode-emoji" title=":disappointed_face:"&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just read Beto's question and I think it is pretty clear:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt; [B][COLOR=Red]usb msd example[/COLOR][/B] on a LPC1343.&lt;BR /&gt;&lt;BR /&gt;When I drag a bin file to the drive does it go to ram or flash.&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;Which sample project? Dear Gbm, please read the first sentence: [B]USB MSD example[/B] for the lpc1343. In my version of the example projects this is called usbmsd.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or, to almost quote your (Gbm's) own words: The questions are generally written for the people who want to read and understand English. If this isn't your goal, or you do not want to help out a new LPCXpresso programmer you don't need to reply at all. (Yes, I can be professional too :D)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But now all flaming aside and back to the question ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is indeed not too much information given with the example projects, you have to read through the source code to discover what this does.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The USB source code is split over a number of logically names C files. Logical ... if you know how the USB code is written and what it does. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The files named usb...c contain the core USB stack, files with msc...c add the mass storage class and the other two files (DiskImg.c and memory.c) contain the user code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DiskImg contains just the file system with the .txt file, the user program can be found in memory.c.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you read through that file you will find the following:&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;int main (void) {
&amp;nbsp; uint32_t n;

&amp;nbsp; for (n = 0; n &amp;lt; MSC_ImageSize; n++) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Copy Initial Disk Image */
&amp;nbsp;&amp;nbsp;&amp;nbsp; Memory[n] = DiskImage[n];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&amp;nbsp;&amp;nbsp; from Flash to RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */
&amp;nbsp; }
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;That should answer your question: the initial disk image is copied from flash to RAM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Looking further in mscuser.c you will find the following function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;void MSC_MemoryWrite (void) {
&amp;nbsp; uint32_t n;

&amp;nbsp; if ((Offset + BulkLen) &amp;gt; MSC_MemorySize) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; BulkLen = MSC_MemorySize - Offset;
&amp;nbsp;&amp;nbsp;&amp;nbsp; BulkStage = MSC_BS_CSW;
&amp;nbsp;&amp;nbsp;&amp;nbsp; MSC_SetStallEP(MSC_EP_OUT);
&amp;nbsp; }

[COLOR=Red][B]&amp;nbsp; for (n = 0; n &amp;lt; BulkLen; n++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; Memory[Offset + n] = BulkBuf[n];
&amp;nbsp; }
[/B][/COLOR]
&amp;nbsp; Offset += BulkLen;
&amp;nbsp; Length -= BulkLen;

&amp;nbsp; CSW.dDataResidue -= BulkLen;

&amp;nbsp; if ((Length == 0) || (BulkStage == MSC_BS_CSW)) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; CSW.bStatus = CSW_CMD_PASSED;
&amp;nbsp;&amp;nbsp;&amp;nbsp; MSC_SetCSW();
&amp;nbsp; }
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;And all at the top of that file you will find the definition for Memory[] which is an array of uint8_t in RAM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 23:56:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USB-msd-not-sticking/m-p/577331#M23167</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T23:56:33Z</dc:date>
    </item>
  </channel>
</rss>

