<?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 LPC4337 SDIO Read_Direct for instance card size in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-SDIO-Read-Direct-for-instance-card-size/m-p/654094#M25992</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using SDIO to store data on a SD card and I would like to get the SD card size/capacity [in GB] (which corresponds to CMD9 with SD protocol and SPI). In the example ''periph_SDIO'', there is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SDIO_Read_Direct(LPC_SDMMC, 1, 0x1C, &amp;amp;val) and&amp;nbsp;SDIO_Read_Direct(LPC_SDMMC, 1, 0x1D, &amp;amp;val)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where do the 0x1C or 0x1D come from ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I look into the file "simplified_SDIO_card_spec.pdf" but cannot make sense of it to answer the question above. I understand that the information should be in the FBR -&amp;gt; CIS register (right?). &amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking further in the "periph_SDIO" example, there is&amp;nbsp;&lt;SPAN&gt;SDIO_Read_Direct(LPC_SDMMC, 1, 0x04, &amp;amp;val) (clear the interrupt). Again, I am not able to understand or to calculate the 0x04 address.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you explain or point to a good document in order to understand these addresses?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you very much.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Feb 2017 21:24:31 GMT</pubDate>
    <dc:creator>valeremar</dc:creator>
    <dc:date>2017-02-20T21:24:31Z</dc:date>
    <item>
      <title>LPC4337 SDIO Read_Direct for instance card size</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-SDIO-Read-Direct-for-instance-card-size/m-p/654094#M25992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using SDIO to store data on a SD card and I would like to get the SD card size/capacity [in GB] (which corresponds to CMD9 with SD protocol and SPI). In the example ''periph_SDIO'', there is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SDIO_Read_Direct(LPC_SDMMC, 1, 0x1C, &amp;amp;val) and&amp;nbsp;SDIO_Read_Direct(LPC_SDMMC, 1, 0x1D, &amp;amp;val)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where do the 0x1C or 0x1D come from ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I look into the file "simplified_SDIO_card_spec.pdf" but cannot make sense of it to answer the question above. I understand that the information should be in the FBR -&amp;gt; CIS register (right?). &amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking further in the "periph_SDIO" example, there is&amp;nbsp;&lt;SPAN&gt;SDIO_Read_Direct(LPC_SDMMC, 1, 0x04, &amp;amp;val) (clear the interrupt). Again, I am not able to understand or to calculate the 0x04 address.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you explain or point to a good document in order to understand these addresses?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you very much.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Feb 2017 21:24:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-SDIO-Read-Direct-for-instance-card-size/m-p/654094#M25992</guid>
      <dc:creator>valeremar</dc:creator>
      <dc:date>2017-02-20T21:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4337 SDIO Read_Direct for instance card size</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-SDIO-Read-Direct-for-instance-card-size/m-p/654095#M25993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Valeremar,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I checked the SDIO_Read_Direct function, it is using the CMD52 to access the according register.&lt;/P&gt;&lt;P&gt;From the CMD52 command description, we can get the CMD52 can access a signal register within the&amp;nbsp; total 128K of register space in any I/O function, including the common I/O area (CIA).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/15444i26FA33133F8C1C7C/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As you know, CIS is included in the CIA register.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/15404i24223FECAB2C9D81/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I think the 0X1D, 0X1C, 0X04 is not the address, it should be the SDIO register.&lt;/P&gt;&lt;P&gt;More details, you also can refer to the SDIO card spec:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://ugweb.cs.ualberta.ca/~c274/resources/hardware/SDcards/SD_SDIO_specsv1.pdf" title="http://ugweb.cs.ualberta.ca/~c274/resources/hardware/SDcards/SD_SDIO_specsv1.pdf"&gt;http://ugweb.cs.ualberta.ca/~c274/resources/hardware/SDcards/SD_SDIO_specsv1.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://www.sdcard.org/developers/overview/sdio/sdio_spec/Simplified_SDIO_Card_Spec.pdf" title="https://www.sdcard.org/developers/overview/sdio/sdio_spec/Simplified_SDIO_Card_Spec.pdf"&gt;https://www.sdcard.org/developers/overview/sdio/sdio_spec/Simplified_SDIO_Card_Spec.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Associated with these code to find the according SDIO register which is controlled by the CMD52:&lt;/P&gt;&lt;P&gt;int SDIO_Write_Direct(LPC_SDMMC_T *pSDMMC, uint32_t func, uint32_t addr, uint32_t data)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int ret;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ret = SDIO_Send_Command(pSDMMC, CMD52, &lt;STRONG&gt;(func &amp;lt;&amp;lt; 28) | (addr &amp;lt;&amp;lt; 9) | (data &amp;amp; 0xFF) | (1UL &amp;lt;&amp;lt; 31)&lt;/STRONG&gt;);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (ret) return ret;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Check response for errors */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(sdioif-&amp;gt;response[0] &amp;amp; 0xcb00){&lt;BR /&gt;&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;/* COM_CRC_ERROR */&lt;BR /&gt;&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;/* ILLEGAL_CRC_ERROR */&lt;BR /&gt;&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;/* ERROR */&lt;BR /&gt;&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;/* RFU FUNCTION_NUMBER */&lt;BR /&gt;&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;/* OUT_OF_RANGE */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Response flag error */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return SDIO_ERR_READWRITE;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return data != (sdioif-&amp;gt;response[0] &amp;amp; 0xFF);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;uint32_t SDIO_Send_Command(LPC_SDMMC_T *pSDMMC, uint32_t cmd, uint32_t arg)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;uint32_t ret, ival;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;uint32_t imsk = pSDMMC-&amp;gt;INTMASK;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ret = sdioif-&amp;gt;wait_evt(pSDMMC, SDIO_START_COMMAND, (void *)(cmd &amp;amp; 0x3F));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ival = SDIO_CMD_INT_MSK &amp;amp; ~ret;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Set data interrupts for data commands */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (cmd &amp;amp; SDIO_CMD_DATA) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ival |= SDIO_DATA_INT_MSK;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;imsk |= SDIO_DATA_INT_MSK;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Chip_SDIF_SetIntMask(pSDMMC, ival);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Chip_SDIF_SendCmd(pSDMMC, cmd, arg);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ret = sdioif-&amp;gt;wait_evt(pSDMMC, SDIO_WAIT_COMMAND, 0);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (!ret &amp;amp;&amp;amp; (cmd &amp;amp; SDIO_CMD_RESP_R1)) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Chip_SDIF_GetResponse(pSDMMC, &amp;amp;sdioif-&amp;gt;response[0]);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Chip_SDIF_SetIntMask(pSDMMC, imsk);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return ret;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 10:37:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-SDIO-Read-Direct-for-instance-card-size/m-p/654095#M25993</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2017-02-22T10:37:19Z</dc:date>
    </item>
  </channel>
</rss>

