<?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 Re: ADC stuck waiting for COCO (KL02Z) in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-stuck-waiting-for-COCO-KL02Z/m-p/323526#M14736</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Adrian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I set up the ADC using the Processor Expert with a prescaler of 2 resulting and a frequency of 10485.76 KHz. According to the PE, the time it takes for a single sample (HW averaging disabled, 8-bit) is 2.53 us.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I take an ADC measurement in an OnEnd interrupt after n cycles of a 200 KHz PWM signal (n still being adjusted during testing). Is there something with the timing of the PWM signal that is causing the ADC COCO to never be set? When I read the ADC at other points under other conditions in my program, it does not hang.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jul 2014 14:58:14 GMT</pubDate>
    <dc:creator>sagha</dc:creator>
    <dc:date>2014-07-24T14:58:14Z</dc:date>
    <item>
      <title>ADC stuck waiting for COCO (KL02Z)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-stuck-waiting-for-COCO-KL02Z/m-p/323524#M14734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using the FRDM-KL02Z and reading from the ADC on an interrupt (OnEnd of a PWM signal). After running for a few minutes, the ADC will get stuck in the while loop of my getADC function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro _jivemacro_uid_14060636180217907 jive_macro_code" jivemacro_uid="_14060636180217907" modifiedtitle="true"&gt;
&lt;P&gt;int getADC(int adch) /* adch is the ADC channel (e.g. ADC_PDD_SINGLE_ENDED_AD10) */&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ADC_PDD_SetChannel(ADC0_BASE_PTR, ADC_SC1_ADCH_SHIFT, adch);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; while ((ADC0_SC1A &amp;amp; ADC_SC1_COCO_MASK) != ADC_SC1_COCO_MASK)&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp; { &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; /* Wait for measurement to complete */&lt;/P&gt;
&lt;P&gt; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; return ADC0_RA; /* Return ADC value */&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This happens even with no hardware averaging and the ADC resolution set to 8 bits. I calibrate the ADC at the program startup and set the ADC clock divisor to 1 and enable high speed mode. Why is the program hanging?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2014 18:52:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-stuck-waiting-for-COCO-KL02Z/m-p/323524#M14734</guid>
      <dc:creator>sagha</dc:creator>
      <dc:date>2014-07-22T18:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: ADC stuck waiting for COCO (KL02Z)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-stuck-waiting-for-COCO-KL02Z/m-p/323525#M14735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the Frequency of your ADC module? According to the datasheet the maximum frequency for the ADC module is 18 MHz:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="adc max freq.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/45203iC273A7A2070108F4/image-size/large?v=v2&amp;amp;px=999" role="button" title="adc max freq.png" alt="adc max freq.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You need to check that the configurations of the module do not exceed this limit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this information can help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: If this post answers your question, please click the Correct Answer button. It would be nice!&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 22:22:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-stuck-waiting-for-COCO-KL02Z/m-p/323525#M14735</guid>
      <dc:creator>adriancano</dc:creator>
      <dc:date>2014-07-23T22:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: ADC stuck waiting for COCO (KL02Z)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-stuck-waiting-for-COCO-KL02Z/m-p/323526#M14736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Adrian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I set up the ADC using the Processor Expert with a prescaler of 2 resulting and a frequency of 10485.76 KHz. According to the PE, the time it takes for a single sample (HW averaging disabled, 8-bit) is 2.53 us.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I take an ADC measurement in an OnEnd interrupt after n cycles of a 200 KHz PWM signal (n still being adjusted during testing). Is there something with the timing of the PWM signal that is causing the ADC COCO to never be set? When I read the ADC at other points under other conditions in my program, it does not hang.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 14:58:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-stuck-waiting-for-COCO-KL02Z/m-p/323526#M14736</guid>
      <dc:creator>sagha</dc:creator>
      <dc:date>2014-07-24T14:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: ADC stuck waiting for COCO (KL02Z)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-stuck-waiting-for-COCO-KL02Z/m-p/323527#M14737</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;Please check this threads, maybe you will find them useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/326347"&gt;Cannot read an ADC in a timer ISR&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/message/22218"&gt;Re: ADC interrupt interfering with TI1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Adrian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 15:06:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-stuck-waiting-for-COCO-KL02Z/m-p/323527#M14737</guid>
      <dc:creator>adriancano</dc:creator>
      <dc:date>2014-07-24T15:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: ADC stuck waiting for COCO (KL02Z)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-stuck-waiting-for-COCO-KL02Z/m-p/323528#M14738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Adrian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had the same problem as the person who posted "Cannot read an ADC in a timer ISR". The solution in that thread (use the COCO interrupt) worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 19:37:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-stuck-waiting-for-COCO-KL02Z/m-p/323528#M14738</guid>
      <dc:creator>sagha</dc:creator>
      <dc:date>2014-07-24T19:37:08Z</dc:date>
    </item>
  </channel>
</rss>

