<?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: comparator interrupt handler (doesn't get called? or does it?)</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/comparator-interrupt-handler-doesn-t-get-called-or-does-it/m-p/394679#M21641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Someone from Freescale suggested that my former FOPT register value (0xFFFFFFFE) was setup to send my processor off to boot ROM space where it would execute forever waiting for communications.&amp;nbsp; And to change it to (0xFFFF3DFE).&amp;nbsp; I have not see the problem since the change.&amp;nbsp; Here is the bit of code I changed.&amp;nbsp; Note where the value "0xFFFF3DFE" is located:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;__FlashConfig&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DCD&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFFFFFFFF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DCD&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFFFFFFFF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DCD&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFFFFFFFF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DCD&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFFFF3DFE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;__FlashConfig_End&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 May 2015 20:48:56 GMT</pubDate>
    <dc:creator>rickstuart</dc:creator>
    <dc:date>2015-05-11T20:48:56Z</dc:date>
    <item>
      <title>comparator interrupt handler (doesn't get called? or does it?)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/comparator-interrupt-handler-doesn-t-get-called-or-does-it/m-p/394676#M21638</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 have a KL27 on one of Freescale's development boards here and have not been able to get it to call a comparator interrupt routine.&amp;nbsp; I'll start out just describing what's going on.&amp;nbsp; If someone see the "bug" I've over looked that would be great.&amp;nbsp; If not, I can start posting bits of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a bit of Freescale example code where the D/A block of the KL27 is set up to supply a programmable reference to the Comparator block of the KL27.&amp;nbsp; My signal is the other input to the Comparator.&amp;nbsp; I wrote code to sample and send out the Comparator result to an external pin.&amp;nbsp; I can see the input and output perform as expected when I run this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I have added a method to handle the Comparator's interrupts.&amp;nbsp; I have set up the KL27's interrupt vectors for the CMP0 interrupt.&amp;nbsp; And I have set up the falling edge interrupt of the Comparator.&amp;nbsp; But now when I run my code it does nothing.&amp;nbsp; When I stop it, the program counter is at a place in memory that is outside of anything in the memory map the linker put together for this program.&amp;nbsp; The bit of code, in infinite loop, looks suspiciously close to the default interrupt handler that "should" be used if no interrupt handler was written for the "bitweak" defined interrupt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, did the program go "south" because of a CMP0 interrupt??&amp;nbsp; Well, if I comment out the line that sets up the KL27's interrupt vector for the CMP0 the program works as expected.&amp;nbsp; Recall the program is written as an infinite loop which samples the state of the CMP0 comparator and outputs that to a pin.&amp;nbsp;&amp;nbsp; That all works w/o the KL27's interrupt vector for CMP0 enabled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Likewise, I can comment out the line that sets up the falling edge interrupt of the Comparator and get the program to sample and report the state of CMP0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As one last test, I restored all the code and stopped sending my external signal into the KL27's Comparator.&amp;nbsp; That too allowed the program to work.&amp;nbsp; I could stop in the code, single step and then continue execution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At this point, it sound like my interrupt code is bad and sending the program into a spin.&amp;nbsp; So I set a break point so the execution should stop as soon as it jumps to the interrupt handler.&amp;nbsp; That never breaks.&amp;nbsp; I then, just in case, move the break point to the default handler.&amp;nbsp; That never breaks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now what?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-thanks for any help or suggestions&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2015 01:42:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/comparator-interrupt-handler-doesn-t-get-called-or-does-it/m-p/394676#M21638</guid>
      <dc:creator>rickstuart</dc:creator>
      <dc:date>2015-05-01T01:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: comparator interrupt handler (doesn't get called? or does it?)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/comparator-interrupt-handler-doesn-t-get-called-or-does-it/m-p/394677#M21639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It was suggested that I switch turning on the CMP0 interrupt from "NVIC-&amp;gt;ISER[0] = (1 &amp;lt;&amp;lt; (CMP0_IRQn &amp;amp; 0x1f));" to "NVIC_EnableIRQ(CMP0_IRQn);".&amp;nbsp; When I single step through the code I see where "NVIC_EnableIRQ()" calls this method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;/** \brief&amp;nbsp; Enable External Interrupt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The function enables a device-specific interrupt in the NVIC interrupt controller.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; \param [in]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQn&amp;nbsp; External interrupt number. Value cannot be negative.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; NVIC-&amp;gt;ISER[0] = (1 &amp;lt;&amp;lt; ((uint32_t)(IRQn) &amp;amp; 0x1F));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I am single stepping I fail to keep control of the code when executing the "NVIC-&amp;gt;ISER[0]..." line above.&amp;nbsp; If I stop the debugger, I see that I am again back at address 0x1c002228 at an instructions which appears to be jumping back to address 0x1c002228 (i.e. infinite loop). This is the problem as described in my initial post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is really aggravating is that this code was working a few hours ago.&amp;nbsp; Good enough that I was able to debug a few problems I had.&amp;nbsp; But now we are back at address 0x1c002228 in an infinite loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rest assured if I knew why the program started working as expected and/or why it is ending up at address 0x1c002228 (again) I would post the solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2015 16:27:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/comparator-interrupt-handler-doesn-t-get-called-or-does-it/m-p/394677#M21639</guid>
      <dc:creator>rickstuart</dc:creator>
      <dc:date>2015-05-01T16:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: comparator interrupt handler (doesn't get called? or does it?)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/comparator-interrupt-handler-doesn-t-get-called-or-does-it/m-p/394678#M21640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please consider to use below code to enable the CMP0 interrupt:&lt;/P&gt;&lt;P&gt;enable_irq(16);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void enable_irq (int irq)&lt;/P&gt;&lt;P&gt;{&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Make sure that the IRQ is an allowable number. Up to 32 is &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * NOTE: If you are using the interrupt definitions from the header&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * file, you MUST SUBTRACT 16!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (irq &amp;gt; 32)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("\nERR! Invalid IRQ value passed to enable irq function!\n");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set the ICPR and ISER registers accordingly */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC_ICPR |= 1 &amp;lt;&amp;lt; (irq%32);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC_ISER |= 1 &amp;lt;&amp;lt; (irq%32);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ma Hui&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>Mon, 04 May 2015 05:50:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/comparator-interrupt-handler-doesn-t-get-called-or-does-it/m-p/394678#M21640</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2015-05-04T05:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: comparator interrupt handler (doesn't get called? or does it?)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/comparator-interrupt-handler-doesn-t-get-called-or-does-it/m-p/394679#M21641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Someone from Freescale suggested that my former FOPT register value (0xFFFFFFFE) was setup to send my processor off to boot ROM space where it would execute forever waiting for communications.&amp;nbsp; And to change it to (0xFFFF3DFE).&amp;nbsp; I have not see the problem since the change.&amp;nbsp; Here is the bit of code I changed.&amp;nbsp; Note where the value "0xFFFF3DFE" is located:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;__FlashConfig&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DCD&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFFFFFFFF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DCD&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFFFFFFFF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DCD&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFFFFFFFF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DCD&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFFFF3DFE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;__FlashConfig_End&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2015 20:48:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/comparator-interrupt-handler-doesn-t-get-called-or-does-it/m-p/394679#M21641</guid>
      <dc:creator>rickstuart</dc:creator>
      <dc:date>2015-05-11T20:48:56Z</dc:date>
    </item>
  </channel>
</rss>

