<?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 LPCxxxx as MassStorageDevice using external memory in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPCxxxx-as-MassStorageDevice-using-external-memory/m-p/568880#M19459</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by diegotrex on Tue Apr 23 10:11:27 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want my uC application behaves as a simple&amp;nbsp; USB stick when connected to a USB host as a PC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I implemented the example in NXPUSBLib(&lt;/SPAN&gt;&lt;A href="http://"&gt;http://www.lpcware.com/content/project/nxpusblib&lt;/A&gt;&lt;SPAN&gt;) for LPC11U14&amp;nbsp; on LPCxpresso EVB stick..It works,i can see on PC the new drive&amp;nbsp; and open the example text file&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to read a bigger file,it could be 10MB in size,and it should reside in an EEPROM,or in a RAM with backup battery.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't have any idea on how doing it,despite i already did Filesystem stuff using other uCs. I ask for hints or links,please.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;About the above example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In DataRam.c i found thedisk image and the txt file content&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in DataRam.h i have&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#if&amp;nbsp; defined(__LPC11UXX__)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[COLOR=Sienna]#define DATA_RAM_START_ADDRESS&amp;nbsp; 0x20080000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define DATA_RAM_PHYSICAL_SIZE 0xa00&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define&amp;nbsp; DATA_RAM_VIRTUAL_SIZE 0x4000 /*fake size to trick windows*/[/COLOR]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but i can't find nowhere else [COLOR=Sienna]DATA_RAM_START_ADDRESS[/COLOR]&amp;nbsp; or 0x[COLOR=Sienna]20080000[/COLOR]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My question is:how can the linker place the virtual disk and the txt file without this reference?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the address i hav just empty locations&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead i found data having to do with FAT table at address&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;0x1000 0000,at the beginning of 4KBi SRAM&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can i have some help to understand it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 01:03:52 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T01:03:52Z</dc:date>
    <item>
      <title>LPCxxxx as MassStorageDevice using external memory</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPCxxxx-as-MassStorageDevice-using-external-memory/m-p/568880#M19459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by diegotrex on Tue Apr 23 10:11:27 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want my uC application behaves as a simple&amp;nbsp; USB stick when connected to a USB host as a PC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I implemented the example in NXPUSBLib(&lt;/SPAN&gt;&lt;A href="http://"&gt;http://www.lpcware.com/content/project/nxpusblib&lt;/A&gt;&lt;SPAN&gt;) for LPC11U14&amp;nbsp; on LPCxpresso EVB stick..It works,i can see on PC the new drive&amp;nbsp; and open the example text file&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to read a bigger file,it could be 10MB in size,and it should reside in an EEPROM,or in a RAM with backup battery.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't have any idea on how doing it,despite i already did Filesystem stuff using other uCs. I ask for hints or links,please.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;About the above example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In DataRam.c i found thedisk image and the txt file content&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in DataRam.h i have&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#if&amp;nbsp; defined(__LPC11UXX__)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[COLOR=Sienna]#define DATA_RAM_START_ADDRESS&amp;nbsp; 0x20080000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define DATA_RAM_PHYSICAL_SIZE 0xa00&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define&amp;nbsp; DATA_RAM_VIRTUAL_SIZE 0x4000 /*fake size to trick windows*/[/COLOR]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but i can't find nowhere else [COLOR=Sienna]DATA_RAM_START_ADDRESS[/COLOR]&amp;nbsp; or 0x[COLOR=Sienna]20080000[/COLOR]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My question is:how can the linker place the virtual disk and the txt file without this reference?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the address i hav just empty locations&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead i found data having to do with FAT table at address&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;0x1000 0000,at the beginning of 4KBi SRAM&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can i have some help to understand it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:03:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/LPCxxxx-as-MassStorageDevice-using-external-memory/m-p/568880#M19459</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: LPCxxxx as MassStorageDevice using external memory</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPCxxxx-as-MassStorageDevice-using-external-memory/m-p/568881#M19460</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 Thu Apr 25 08:51:35 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Firstly, you have to touch to "#if 0" in this routine, so that the stack reads/writes your media calling MassStorage_Read() / MassStorage_Write()&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;nxpUSBlib v0.98b\applications\examples\LPCUSBlib\Example_MassStorageDevice\Lib\SCSI.c

static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; const bool IsDataRead)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...
&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
#if 0&amp;nbsp;&amp;nbsp; // &amp;lt;---------------------- 1&amp;nbsp;&amp;nbsp;&amp;nbsp; enable this #if clause
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (IsDataRead == DATA_READ)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&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;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And then, implement MassStorage_Read() / MassStorage_Write() routines, so that they accesses to your media.&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;nxpUSBlib v0.98b\libraries\BSP\bsp.c

void MassStorage_Write(uint32_t diskpos, void* buffer, uint32_t size)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; // write to your media: diskpos - start address in byte on your media
}

void MassStorage_Read(uint32_t diskpos, void* buffer, uint32_t size)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; // read from your media: diskpos - start address in byte on your media
}

/** Get Mass Storage Size */
uint32_t MassStorage_GetCapacity(void)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; return DATA_RAM_VIRTUAL_SIZE;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; return the size of your media in bytes, instead of DATA_RAM_VIRTUAL_SIZE
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, modify MassStorage_GetCapacity(), so that it returns the size of your media.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Optionally, you may change the serial number and INQUIRY strings, to make your device unique.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The example gives hard-coded MBR, boot sector, FAT and directories on its media (DiskImage[] RAM array on \libraries\BSP\DataRam.c). As you have an external media, DiskImage[] is not needed any more. You may make up the disk format (including MBR) using PC utilities on your media, for example,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- Windows disk management utility&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"How to Manage Your Disks using the Disk Management Utility"&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.7tutorials.com/how-manage-your-disks-using-disk-management-utility&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- SD Formatter on sdcard.org (by Panasonic)&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://" rel="nofollow noopener noreferrer" target="_blank"&gt;https://www.sdcard.org/downloads/formatter_3/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;etc.&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:03:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/LPCxxxx-as-MassStorageDevice-using-external-memory/m-p/568881#M19460</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: LPCxxxx as MassStorageDevice using external memory</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPCxxxx-as-MassStorageDevice-using-external-memory/m-p/568882#M19461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by diegotrex on Tue Apr 30 04:25:18 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks,by now Tsuneo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:03:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/LPCxxxx-as-MassStorageDevice-using-external-memory/m-p/568882#M19461</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: LPCxxxx as MassStorageDevice using external memory</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPCxxxx-as-MassStorageDevice-using-external-memory/m-p/568883#M19462</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 05:34:59 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Dear Tsuneo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to read and write a SD card using USBmassStoragedevice. I have modified the library as you say and I can&amp;nbsp; read my SD card without problem but when I try to write&amp;nbsp; the library goes into an infinity loop. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you been able to write files without problems?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:03:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/LPCxxxx-as-MassStorageDevice-using-external-memory/m-p/568883#M19462</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:03:54Z</dc:date>
    </item>
  </channel>
</rss>

