<?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>MPC5xxxのトピックRe: FlexPWM Val Compare Interrupt Service Routine</title>
    <link>https://community.nxp.com/t5/MPC5xxx/FlexPWM-Val-Compare-Interrupt-Service-Routine/m-p/628601#M5750</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Have you tried to read my example/document for CTU?&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/docs/DOC-102559"&gt;https://community.nxp.com/docs/DOC-102559&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The mechanism is exactly the same as for MPC5604P.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Nov 2016 14:15:28 GMT</pubDate>
    <dc:creator>petervlna</dc:creator>
    <dc:date>2016-11-03T14:15:28Z</dc:date>
    <item>
      <title>FlexPWM Val Compare Interrupt Service Routine</title>
      <link>https://community.nxp.com/t5/MPC5xxx/FlexPWM-Val-Compare-Interrupt-Service-Routine/m-p/628600#M5749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to use FlexPWM on the TRK-MPC5604P board to trigger an analog sampling. &amp;nbsp;I'll eventually use the cross triggering unit (CTU), but it has been giving me headaches to figure it out, so I thought I'd try something &lt;EM&gt;easier&lt;/EM&gt;, just to get something running. &amp;nbsp;I'd thought I'd just use an interrupt service routine on Val(n) matches. &amp;nbsp;I've setup FLEXPWM0 on Module 2 and I can observe the A&amp;amp;B wavforms, (centerlined), and I can change the dutycycle on the fly from a serial interface. &amp;nbsp;So the&amp;nbsp;FLEXPWM_0.SUB[2].VAL[i].R are all setup properly and working.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="167132_167132.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/122450i360A12E920089EE0/image-size/large?v=v2&amp;amp;px=999" role="button" title="167132_167132.png" alt="167132_167132.png" /&gt;&lt;/span&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/7899iD26A562A562AC520/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 style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I enabled the interrupts for ALL (trying to see anything), of the VAL matches AND reload using&amp;nbsp;&lt;/P&gt;&lt;P&gt;FLEXPWM_0.SUB[2].INTEN.R = 0x103F;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I added the interrupt functions to the vector table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;uint32_t IntcIsrVectorTable[] = {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;(uint32_t)&amp;amp;PWM0_RF2_ISR, /* Vector - 185 Reload Module2 */&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;(uint32_t)&amp;amp;PWM0_COF2_ISR, /* Vector - 186 Compare Module2 */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;and I added the interrupt service routines, and enabled the external interrupts using (&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;asm(" wrteei 1"); ) &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;This also includes a period interrupt timer PIT. &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;After compiling, I can debug this on the target using CodeWarrior for MCU (V10.6 Eclipse). &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;I can set a breakpoint in the PIT interrupt service routine&amp;nbsp;and break on the interrupt. &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;But I cannot break in either of the two PWM0 interrupts service routines. &amp;nbsp;It's as if the interrupts are never generated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;So my questions are:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;1) , besides enabling external interrupts using&amp;nbsp;asm(" wrteei 1");&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;is there something else that I must do to enable the PWM VAL matching/compare interrupts?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;2) &amp;nbsp; The original demo code had source code for the period interrupt timer that did not include "#pragma interrupt on". &amp;nbsp;Is this a compiler directive that I need for the interrupt service routine to get a "return from interrupt" ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Nov 2016 13:30:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/FlexPWM-Val-Compare-Interrupt-Service-Routine/m-p/628600#M5749</guid>
      <dc:creator>duanemattern</dc:creator>
      <dc:date>2016-11-03T13:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: FlexPWM Val Compare Interrupt Service Routine</title>
      <link>https://community.nxp.com/t5/MPC5xxx/FlexPWM-Val-Compare-Interrupt-Service-Routine/m-p/628601#M5750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Have you tried to read my example/document for CTU?&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/docs/DOC-102559"&gt;https://community.nxp.com/docs/DOC-102559&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The mechanism is exactly the same as for MPC5604P.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Nov 2016 14:15:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/FlexPWM-Val-Compare-Interrupt-Service-Routine/m-p/628601#M5750</guid>
      <dc:creator>petervlna</dc:creator>
      <dc:date>2016-11-03T14:15:28Z</dc:date>
    </item>
  </channel>
</rss>

