<?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: write to sd card via mass storage class using nxpusblib in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/write-to-sd-card-via-mass-storage-class-using-nxpusblib/m-p/524556#M7192</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Gonzalo_Sipel on Wed Dec 31 07:09:12 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;HI!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the same problem, I can read my Sd card without problem but I can´t write on it. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any news about it? Have you been able to write files in the SD?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 16:52:47 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T16:52:47Z</dc:date>
    <item>
      <title>write to sd card via mass storage class using nxpusblib</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/write-to-sd-card-via-mass-storage-class-using-nxpusblib/m-p/524554#M7190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Madara on Sun Nov 24 08:09:02 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am able to read and browse the sd card via usb mass storage but when i try to write the process fails and the card gets corrupted.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using bulk only transport and SCSi protocol. I am using nxpusblib&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The read and write code is&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if (IsDataRead == DATA_READ)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&amp;nbsp;&amp;nbsp; while(TotalBlocks--){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sdmmc_read(Buffer,BlockAddress,1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(!Endpoint_IsReadWriteAllowed());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Endpoint_Write_Stream_LE((void *)Buffer, 512, ((void *)0));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Endpoint_ClearIN();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BlockAddress++;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(TotalBlocks--){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(!Endpoint_IsReadWriteAllowed());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Endpoint_Read_Stream_LE((void *)Buffer, 512, ((void *)0));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sdmmc_write(Buffer,BlockAddress,1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BlockAddress++; ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can some body help me&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:52:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/write-to-sd-card-via-mass-storage-class-using-nxpusblib/m-p/524554#M7190</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: write to sd card via mass storage class using nxpusblib</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/write-to-sd-card-via-mass-storage-class-using-nxpusblib/m-p/524555#M7191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Madara on Mon Nov 25 03:29:33 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I changed the code to following where instead of requesting 512 bytes of data using Endpoint_Read_Stream_LE((void *)Buffer, 512, ((void *)0)); I am using Endpoint_Read_8() inside USB_get_data to reveive 16 bytes of out transfer.But the result is the same.I have ran out of options.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;while(TotalBlocks--){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;offset = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;length = 512;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;memset(Buffer,0,512);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(!Endpoint_IsReadWriteAllowed());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(length &amp;gt; 0){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;bytestowrite = USB_get_data(temp);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TRACE("B%d",bytestowrite);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if(!bytestowrite)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;break;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;memcpy(Buffer + offset, temp, bytestowrite);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;offset += bytestowrite;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;length -= bytestowrite;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sdmmc_write(Buffer, BlockAddress,1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (MSInterfaceInfo-&amp;gt;State.IsMassStoreReset)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; return 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BlockAddress++;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (!(Endpoint_IsReadWriteAllowed()))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Endpoint_ClearOUT();&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:52:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/write-to-sd-card-via-mass-storage-class-using-nxpusblib/m-p/524555#M7191</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: write to sd card via mass storage class using nxpusblib</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/write-to-sd-card-via-mass-storage-class-using-nxpusblib/m-p/524556#M7192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Gonzalo_Sipel on Wed Dec 31 07:09:12 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;HI!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the same problem, I can read my Sd card without problem but I can´t write on it. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any news about it? Have you been able to write files in the SD?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:52:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/write-to-sd-card-via-mass-storage-class-using-nxpusblib/m-p/524556#M7192</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: write to sd card via mass storage class using nxpusblib</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/write-to-sd-card-via-mass-storage-class-using-nxpusblib/m-p/524557#M7193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Gonzalo_Sipel on Thu Jan 29 08:07:44 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Madara&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been able to write my sd, I had to&amp;nbsp; make some modifications to usblibrary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt; I post this here &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fforum%2Fsample-code-lpc1347-and-usb-msd-sd-card%23comment-1143210" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/forum/sample-code-lpc1347-and-usb-msd-sd-card#comment-1143210&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:52:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/write-to-sd-card-via-mass-storage-class-using-nxpusblib/m-p/524557#M7193</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:52:47Z</dc:date>
    </item>
  </channel>
</rss>

