<?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: I get both rising and falling flags on my CMP0 callback function (KL03Z) in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-both-rising-and-falling-flags-on-my-CMP0-callback-function/m-p/370311#M19170</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear XiangJun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is correct, it is a very sensible suggestion but whatever the quality of the incoming signal is or whether or not it oscillates I would expect to get both rising and falling interrupt flags.&lt;/P&gt;&lt;P&gt;In reality I more often than not got multiple falling edge interrupts without any rising edge ones.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The final solution is that, after setting everything up, use a flag and a delay of 10 ms to make things work as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 1) Configure the CMP block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 2) Set a flag to block full handling of incoming CMP interrupts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 3) Activate CMP interrupts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 4) Limited interrupt handling means a call to the same callback function but then it just clears the rising/falling flags.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 5) Wait for 10 ms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 6) Then clear the limited interrupt handling flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then everything works as expected: when I put a signal that goes from high to low and back again on the CMP unit's compare pin I get one recorded falling edge and one recorded rising edge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not got the faintest idea why it freaks out just after setup but with the delay it works fine now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Apr 2015 10:31:12 GMT</pubDate>
    <dc:creator>filipdossche</dc:creator>
    <dc:date>2015-04-09T10:31:12Z</dc:date>
    <item>
      <title>I get both rising and falling flags on my CMP0 callback function (KL03Z)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-both-rising-and-falling-flags-on-my-CMP0-callback-function/m-p/370309#M19168</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;My application uses the CMP0 component.&lt;/P&gt;&lt;P&gt;When the callback function stops at the point where a rising edge is detected it invariably shows falling and rising flags simultaneously but there is at least 70 microseconds between the two events. (see screenshot).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_0.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/49430i246139A22E27F5BC/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_0.png" alt="pastedImage_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have enabled high hysteresis level and filtering but nothing helps. Any ideas or suggestions as to what may be wrong ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More details:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have added counters each time a rising or falling edge is detected: When I make it stop at the first rising edge the rising counter is correctly set to 1.&lt;/P&gt;&lt;P&gt;However, the falling counter is set to 7 or so. How can you get multiple falling edges (interrupts) without rising edges in between ?&lt;/P&gt;&lt;P&gt;I have worked out how to set up the KL03Z at 48 Mhz instead of the standard 8 Mhz which was used before hoping that might help but it makes no difference at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Filip Dossche&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2015 14:49:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-both-rising-and-falling-flags-on-my-CMP0-callback-function/m-p/370309#M19168</guid>
      <dc:creator>filipdossche</dc:creator>
      <dc:date>2015-04-01T14:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: I get both rising and falling flags on my CMP0 callback function (KL03Z)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-both-rising-and-falling-flags-on-my-CMP0-callback-function/m-p/370310#M19169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Filip,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding your question that both the rising and falling flags are set(CFR and CFF bits in CMPx_SCR) in ISR, I think it is dependent on the external input signals quality: INP and INM, if the two signals are all float, the CMP output signal will oscillate, in the case, both the CRF and CFF flags will be set. i do not know if it is your case.&lt;/P&gt;&lt;P&gt;For test purpose, you can use 6 bits DAC to generate a middle voltage for example 1.65V, and use an low speed clock signal as another input of CMP, then read the two flags, what is the result?&lt;/P&gt;&lt;P&gt;Hope it can help you.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 07:03:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-both-rising-and-falling-flags-on-my-CMP0-callback-function/m-p/370310#M19169</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2015-04-03T07:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: I get both rising and falling flags on my CMP0 callback function (KL03Z)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-both-rising-and-falling-flags-on-my-CMP0-callback-function/m-p/370311#M19170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear XiangJun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is correct, it is a very sensible suggestion but whatever the quality of the incoming signal is or whether or not it oscillates I would expect to get both rising and falling interrupt flags.&lt;/P&gt;&lt;P&gt;In reality I more often than not got multiple falling edge interrupts without any rising edge ones.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The final solution is that, after setting everything up, use a flag and a delay of 10 ms to make things work as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 1) Configure the CMP block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 2) Set a flag to block full handling of incoming CMP interrupts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 3) Activate CMP interrupts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 4) Limited interrupt handling means a call to the same callback function but then it just clears the rising/falling flags.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 5) Wait for 10 ms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 6) Then clear the limited interrupt handling flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then everything works as expected: when I put a signal that goes from high to low and back again on the CMP unit's compare pin I get one recorded falling edge and one recorded rising edge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not got the faintest idea why it freaks out just after setup but with the delay it works fine now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2015 10:31:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-both-rising-and-falling-flags-on-my-CMP0-callback-function/m-p/370311#M19170</guid>
      <dc:creator>filipdossche</dc:creator>
      <dc:date>2015-04-09T10:31:12Z</dc:date>
    </item>
  </channel>
</rss>

