<?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>Kinetis MicrocontrollersのトピックRe: K66F sdhc stat/interrupt registers won't indicate card detected</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K66F-sdhc-stat-interrupt-registers-won-t-indicate-card-detected/m-p/695624#M42801</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dinakar Kondru&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't see your SDHC initialization, are you writing to CINSIEN bit to enable card detection interrupt?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using SDK 2.x package, then you could check the example code provided frdmk66f_driver_examples_sdcard_interrupt located in SDK_2.2_FRDM-K66F\boards\frdmk66f\driver_examples\sdcard\&lt;/P&gt;&lt;P&gt;as you mentioned it uses GPIO to detect card, but all this implementation is located in fsl_host.c, which is application specific, so you could change it as needed. If you check this file you will find a definition like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;cardDetectDat3 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; false&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;endianMode &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; SDHC_ENDIAN_MODE&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dmaMode &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; SDHC_DMA_MODE&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;readWatermarkLevel &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; SDHC_READ_WATERMARK_LEVEL&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;writeWatermarkLevel &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; SDHC_WRITE_WATERMARK_LEVEL&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;SDHC_Init&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;base&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inside HOST_Init function, if you enable cardDetectDat3 as true, it will trigger the card insertion callback defined (by user) in insdhcCallback (similar to sdhcCallback.TransferComplete = SDHC_TransferCompleteCallback;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this information could help you.&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Jorge Alcala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Aug 2017 20:14:56 GMT</pubDate>
    <dc:creator>jorge_a_vazquez</dc:creator>
    <dc:date>2017-08-21T20:14:56Z</dc:date>
    <item>
      <title>K66F sdhc stat/interrupt registers won't indicate card detected</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K66F-sdhc-stat-interrupt-registers-won-t-indicate-card-detected/m-p/695623#M42800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do the following sequence (psuedo code):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;BOARD_InitPins();&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;BOARD_BootClockRUN();&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;BOARD_InitDebugConsole();&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;SIM_SCGC3.SDHC_clockgate_control.enable;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;SDHC_SYSCTL.IPGEN.enabled;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;SDHC_SYSCTL.HCKEN.enabled;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;SDHC_SYSCTL.PEREN.enabled;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; SDHC_SYSCTL.SDCLKEN.enabled;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;SDHC_IRQSTATEN.ALL_BITS.enabled;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; &amp;nbsp;while (1) {&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; &amp;nbsp;read_and_print_SDHC_IRQSTAT();&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; &amp;nbsp;read_and_print_SDHC_PRSSTAT();&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; }&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Basically I initialize pins, clock and enable sdhc clock and enable interrrupts.&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;I ran the above&amp;nbsp;code and I inserted the SD card. The SD card has an LED on it and it goes ON. But, the&amp;nbsp;&lt;SPAN&gt;IRQSTAT and&amp;nbsp;PRSSTAT don't indicate that the card is detected.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;The example code provided along with KDS for SDHC&amp;nbsp;&amp;nbsp;is based on gpio and not on the actual SD card interface so I'm not sure what I'm missing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Any help is greatly appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Dinakar&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Aug 2017 03:34:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K66F-sdhc-stat-interrupt-registers-won-t-indicate-card-detected/m-p/695623#M42800</guid>
      <dc:creator>dinakarkondru</dc:creator>
      <dc:date>2017-08-10T03:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: K66F sdhc stat/interrupt registers won't indicate card detected</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K66F-sdhc-stat-interrupt-registers-won-t-indicate-card-detected/m-p/695624#M42801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dinakar Kondru&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't see your SDHC initialization, are you writing to CINSIEN bit to enable card detection interrupt?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using SDK 2.x package, then you could check the example code provided frdmk66f_driver_examples_sdcard_interrupt located in SDK_2.2_FRDM-K66F\boards\frdmk66f\driver_examples\sdcard\&lt;/P&gt;&lt;P&gt;as you mentioned it uses GPIO to detect card, but all this implementation is located in fsl_host.c, which is application specific, so you could change it as needed. If you check this file you will find a definition like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;cardDetectDat3 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; false&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;endianMode &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; SDHC_ENDIAN_MODE&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dmaMode &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; SDHC_DMA_MODE&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;readWatermarkLevel &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; SDHC_READ_WATERMARK_LEVEL&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;writeWatermarkLevel &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; SDHC_WRITE_WATERMARK_LEVEL&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;SDHC_Init&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;base&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sdhcHost&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inside HOST_Init function, if you enable cardDetectDat3 as true, it will trigger the card insertion callback defined (by user) in insdhcCallback (similar to sdhcCallback.TransferComplete = SDHC_TransferCompleteCallback;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this information could help you.&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Jorge Alcala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Aug 2017 20:14:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K66F-sdhc-stat-interrupt-registers-won-t-indicate-card-detected/m-p/695624#M42801</guid>
      <dc:creator>jorge_a_vazquez</dc:creator>
      <dc:date>2017-08-21T20:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: K66F sdhc stat/interrupt registers won't indicate card detected</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K66F-sdhc-stat-interrupt-registers-won-t-indicate-card-detected/m-p/695625#M42802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I understand what needs to be done now. I'll let you know once I get it to work. Thank you so much.&lt;/P&gt;&lt;P&gt;-Dinakar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2017 03:40:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K66F-sdhc-stat-interrupt-registers-won-t-indicate-card-detected/m-p/695625#M42802</guid>
      <dc:creator>dinakarkondru</dc:creator>
      <dc:date>2017-08-24T03:40:03Z</dc:date>
    </item>
  </channel>
</rss>

