<?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中的主题 Re: SD card benchmark and bus speed problem</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SD-card-benchmark-and-bus-speed-problem/m-p/519637#M3271</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wella-tabor on Fri May 24 04:16:20 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Your source code did not pass throught the test (see below). Do not worry, either my driver did not pass with the 4-wire interface. It seems that card or PL180 (arm prime cell used in nxp) is buggy. The lpcopen uses checking of state before sending the STOP command, maybe there is the catch.&lt;/P&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;hr /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;P&gt;my modification to your source code was to set&amp;nbsp; max_transfer_sectors = 8 and speed to 1.000.000 Hz&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Test code:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;BR /&gt;static uint8_t buffer[512*32];&lt;BR /&gt;#define SIZE_OF_ARRAY(array)(sizeof(array) / sizeof(array[0]))&lt;BR /&gt;&lt;BR /&gt;#define SECTOR_BURST_MAX(23)&lt;BR /&gt;#define BLOCK_SIZE(512)&lt;BR /&gt;&lt;BR /&gt;const unsigned int sector_bursts[] = {1,2,3,7,16,17,20, SECTOR_BURST_MAX};&lt;BR /&gt;const unsigned int sector_addresses[] =&lt;BR /&gt;{ 0, 1, 23, 500, 1235, 10689, 39784 };&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt;int error;&lt;BR /&gt;mmc_inithardware();&lt;BR /&gt;mmc_init_card();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// write&lt;BR /&gt;for (unsigned i = 0; i &amp;lt; SIZE_OF_ARRAY(sector_addresses); ++i)&lt;BR /&gt;{&lt;BR /&gt;for (unsigned j = 0; j &amp;lt; SIZE_OF_ARRAY(sector_bursts); ++j)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;//fill buffer to a known number.&lt;BR /&gt;memset(buffer, (i+1)*(j+1), BLOCK_SIZE * sector_bursts[j]);&lt;BR /&gt;&lt;BR /&gt;error =mmc_writemultiplesector(buffer,sector_addresses&lt;I&gt;, sector_bursts[j]);&lt;BR /&gt;if(error != 0)&lt;BR /&gt;{&lt;BR /&gt;__asm("BKPT 1\n");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//clear buffer.&lt;BR /&gt;memset(buffer, 0, BLOCK_SIZE * sector_bursts[j]);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;//read block&lt;BR /&gt;error =mmc_readmultiplesector(buffer,sector_addresses&lt;I&gt;, sector_bursts[j]);&lt;BR /&gt;if(error != 0)&lt;BR /&gt;{&lt;BR /&gt;__asm("BKPT 1\n");&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// Here comes checking&lt;BR /&gt;for (unsigned k = 0; k &amp;lt; BLOCK_SIZE * sector_bursts[j]; ++k)&lt;BR /&gt;{&lt;BR /&gt;if (buffer[k] != (i+1)*(j+1))&lt;BR /&gt;{&lt;BR /&gt;__asm("BKPT 1\n");&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;return 1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/code&amp;gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:41:09 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:41:09Z</dc:date>
    <item>
      <title>SD card benchmark and bus speed problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SD-card-benchmark-and-bus-speed-problem/m-p/519635#M3269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wlamers on Thu May 16 07:29:14 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;P&gt;I have done some extensive benchmarking of the SD interface on a LPC1778 and found some intersting things.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;First of all the specs:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;- crystal: 12 Mhz&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;- CPU clock 96 MHz (set to be able to come as close as possible to 50 MHz for the SD card (96/2 = 48 MHz)&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;- SD card: Apacer industrial SD SLC chips memory 4 GB&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I have done both RAW multi-sector writes (64x512 bytes at a time) and FAT32 (Chan FatFs) writes.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;First I see that when I do writes on the start of the card's adresses (sector 0) during RAW writes I get a considerable lower speed than at an offset of say 1 GB. The results are for 1 MB writes 2.81 MB/s vs 14.96 MB/s. This is with a bus speed off 48 Mhz.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;But this is the problem. I can not do any FAT writes on this bus speed. Things go wrong when checking the FAT table during opening of a new file. All goes well at a 20 MHz bus speed.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Anyone seen this before?&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;BTW speeds are comparable at 20 MHz for RAW vs FAT writes (multi-sector writes, cluster aligned, and writing 1MB or more at a time).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:41:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SD-card-benchmark-and-bus-speed-problem/m-p/519635#M3269</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: SD card benchmark and bus speed problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SD-card-benchmark-and-bus-speed-problem/m-p/519636#M3270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wmues on Thu May 16 08:50:34 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;P&gt;You may want to try my driver:&lt;/P&gt;&lt;BR /&gt;&lt;P&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%2Flpc1788-mci-problems%23comment-1866" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/forum/lpc1788-mci-problems#comment-1866&lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;(Please post results if you do!)&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;regards&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Wolfgang&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:41:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SD-card-benchmark-and-bus-speed-problem/m-p/519636#M3270</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: SD card benchmark and bus speed problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SD-card-benchmark-and-bus-speed-problem/m-p/519637#M3271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wella-tabor on Fri May 24 04:16:20 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Your source code did not pass throught the test (see below). Do not worry, either my driver did not pass with the 4-wire interface. It seems that card or PL180 (arm prime cell used in nxp) is buggy. The lpcopen uses checking of state before sending the STOP command, maybe there is the catch.&lt;/P&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;hr /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;P&gt;my modification to your source code was to set&amp;nbsp; max_transfer_sectors = 8 and speed to 1.000.000 Hz&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Test code:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;BR /&gt;static uint8_t buffer[512*32];&lt;BR /&gt;#define SIZE_OF_ARRAY(array)(sizeof(array) / sizeof(array[0]))&lt;BR /&gt;&lt;BR /&gt;#define SECTOR_BURST_MAX(23)&lt;BR /&gt;#define BLOCK_SIZE(512)&lt;BR /&gt;&lt;BR /&gt;const unsigned int sector_bursts[] = {1,2,3,7,16,17,20, SECTOR_BURST_MAX};&lt;BR /&gt;const unsigned int sector_addresses[] =&lt;BR /&gt;{ 0, 1, 23, 500, 1235, 10689, 39784 };&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt;int error;&lt;BR /&gt;mmc_inithardware();&lt;BR /&gt;mmc_init_card();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// write&lt;BR /&gt;for (unsigned i = 0; i &amp;lt; SIZE_OF_ARRAY(sector_addresses); ++i)&lt;BR /&gt;{&lt;BR /&gt;for (unsigned j = 0; j &amp;lt; SIZE_OF_ARRAY(sector_bursts); ++j)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;//fill buffer to a known number.&lt;BR /&gt;memset(buffer, (i+1)*(j+1), BLOCK_SIZE * sector_bursts[j]);&lt;BR /&gt;&lt;BR /&gt;error =mmc_writemultiplesector(buffer,sector_addresses&lt;I&gt;, sector_bursts[j]);&lt;BR /&gt;if(error != 0)&lt;BR /&gt;{&lt;BR /&gt;__asm("BKPT 1\n");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//clear buffer.&lt;BR /&gt;memset(buffer, 0, BLOCK_SIZE * sector_bursts[j]);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;//read block&lt;BR /&gt;error =mmc_readmultiplesector(buffer,sector_addresses&lt;I&gt;, sector_bursts[j]);&lt;BR /&gt;if(error != 0)&lt;BR /&gt;{&lt;BR /&gt;__asm("BKPT 1\n");&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// Here comes checking&lt;BR /&gt;for (unsigned k = 0; k &amp;lt; BLOCK_SIZE * sector_bursts[j]; ++k)&lt;BR /&gt;{&lt;BR /&gt;if (buffer[k] != (i+1)*(j+1))&lt;BR /&gt;{&lt;BR /&gt;__asm("BKPT 1\n");&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;return 1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/code&amp;gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:41:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SD-card-benchmark-and-bus-speed-problem/m-p/519637#M3271</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:41:09Z</dc:date>
    </item>
  </channel>
</rss>

