<?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>LPCXpresso IDEのトピックSDHC card Interface, taking long time while writing</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/SDHC-card-Interface-taking-long-time-while-writing/m-p/594577#M31016</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aamir ali on Thu Dec 13 04:49:08 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 have written SDHC code,for writing block of data.Problem is block,italic part took long time i.e around 2ms.Return byte took long time to get to zero so that condition exits, My other code has 1ms interrupt in which it has to do other task, those tasks cannot be written in interrupt. Can someone suggest me some way how to deal with this. So that when control reaches here,I can jump to take my reading of 1ms &amp;amp; return here after 2 ms to try again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or I am doing some mistake here in code &amp;amp; it should not take 2ms .&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rest my code is working fine, writing &amp;amp; reading SD card are OK. &lt;/SPAN&gt;&lt;BR /&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;response = SD_Command(CMD24_WRITE_SINGLE_BLOCK , startBlock,0x00);&amp;nbsp;&amp;nbsp; // if reponse not zero then there is error&amp;nbsp;&amp;nbsp;&amp;nbsp; // try calling sdhc_write_block again

if(response != 0)

return response; 


SD_CSenable(); //enable chip select by setting it zero

SPI_Byte( 0xfe ); // start block token 11111110b


for(i = 0; i &amp;lt; 512; i++) //write globally defined buffer into sd card
{
SPI_Byte(buffer1&lt;I&gt;); 
}


SPI_Byte(0xff); // bogus CRC (16-bit), CRC ignored
SPI_Byte(0xff);

response = SPI_Byte(0xff);

if( (response &amp;amp; 0x1f) != 0x05)
{
SD_CSdisable();
return response;
}

count = 0xfffe;
while(!SPI_Byte(0xff)) // wait for write complete and go idle
{
if(count-- &amp;lt; 10)
{
SD_CSdisable();
return SDHC_ERR_W_TIMEOUT;
}
}

SD_CSdisable();

SPI_Byte(0xff); // 8 clock cycle delay while SS line high

SD_CSenable(); // reset SS line low to verify if card still busy

[B][U]count = 0;
while(!SPI_Byte(0xff)) // wait for write complete and go idle
{
if(count++ &amp;gt; 0xfffe)
{
SD_CSdisable(); 
return SDHC_ERR_W_TIMEOUT;}
}
SD_CSdisable();[/U][/B]


return SDHC_ERR_NONE;&lt;/I&gt;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 01:32:14 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T01:32:14Z</dc:date>
    <item>
      <title>SDHC card Interface, taking long time while writing</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/SDHC-card-Interface-taking-long-time-while-writing/m-p/594577#M31016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aamir ali on Thu Dec 13 04:49:08 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 have written SDHC code,for writing block of data.Problem is block,italic part took long time i.e around 2ms.Return byte took long time to get to zero so that condition exits, My other code has 1ms interrupt in which it has to do other task, those tasks cannot be written in interrupt. Can someone suggest me some way how to deal with this. So that when control reaches here,I can jump to take my reading of 1ms &amp;amp; return here after 2 ms to try again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or I am doing some mistake here in code &amp;amp; it should not take 2ms .&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rest my code is working fine, writing &amp;amp; reading SD card are OK. &lt;/SPAN&gt;&lt;BR /&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;response = SD_Command(CMD24_WRITE_SINGLE_BLOCK , startBlock,0x00);&amp;nbsp;&amp;nbsp; // if reponse not zero then there is error&amp;nbsp;&amp;nbsp;&amp;nbsp; // try calling sdhc_write_block again

if(response != 0)

return response; 


SD_CSenable(); //enable chip select by setting it zero

SPI_Byte( 0xfe ); // start block token 11111110b


for(i = 0; i &amp;lt; 512; i++) //write globally defined buffer into sd card
{
SPI_Byte(buffer1&lt;I&gt;); 
}


SPI_Byte(0xff); // bogus CRC (16-bit), CRC ignored
SPI_Byte(0xff);

response = SPI_Byte(0xff);

if( (response &amp;amp; 0x1f) != 0x05)
{
SD_CSdisable();
return response;
}

count = 0xfffe;
while(!SPI_Byte(0xff)) // wait for write complete and go idle
{
if(count-- &amp;lt; 10)
{
SD_CSdisable();
return SDHC_ERR_W_TIMEOUT;
}
}

SD_CSdisable();

SPI_Byte(0xff); // 8 clock cycle delay while SS line high

SD_CSenable(); // reset SS line low to verify if card still busy

[B][U]count = 0;
while(!SPI_Byte(0xff)) // wait for write complete and go idle
{
if(count++ &amp;gt; 0xfffe)
{
SD_CSdisable(); 
return SDHC_ERR_W_TIMEOUT;}
}
SD_CSdisable();[/U][/B]


return SDHC_ERR_NONE;&lt;/I&gt;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:32:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/SDHC-card-Interface-taking-long-time-while-writing/m-p/594577#M31016</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:32:14Z</dc:date>
    </item>
  </channel>
</rss>

