<?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: MPC5643L eTimer ISR in MPC5xxx</title>
    <link>https://community.nxp.com/t5/MPC5xxx/MPC5643L-eTimer-ISR/m-p/620565#M5422</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;If the interrupt is used instead of polling method then you should properly initialize INTC module and enable interrupt within eTimer module.&lt;/P&gt;&lt;P&gt;So your code could work, only within eTimer initialization the INTDMA register must be configured too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR, Petr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Apr 2017 11:34:49 GMT</pubDate>
    <dc:creator>PetrS</dc:creator>
    <dc:date>2017-04-18T11:34:49Z</dc:date>
    <item>
      <title>MPC5643L eTimer ISR</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5643L-eTimer-ISR/m-p/620564#M5421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hellow,&lt;/P&gt;&lt;P&gt;i'm using eTimer in my MPC for measuring signal period, i have working code but i want to get same effect using interrupt..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;///// Working code //////&lt;/P&gt;&lt;P&gt;static void InitETimer(void) {&lt;BR /&gt; &lt;BR /&gt; ETIMER_0 .ENBL.R = 0x0;&lt;/P&gt;&lt;P&gt;ETIMER_0 .CHANNEL[1].CTRL1.R = 0x3801 | PRESC &amp;lt;&amp;lt; 8;&lt;BR /&gt; ETIMER_0 .CHANNEL[1].CCCTRL.R = 0x0052; // 52- CAPT1, CAPT2 falling edge (for period), 62- CAPT1 rising, CAPT2 falling edge &lt;BR /&gt; ETIMER_0 .CHANNEL[1].CTRL3.B.DBGEN = 0b01;&lt;BR /&gt; &lt;BR /&gt; ETIMER_0 .ENBL.R = 0x0002; &lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;int main(void) {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;char wynik[] = " ";&lt;/P&gt;&lt;P&gt;InitGPIO();&lt;BR /&gt; InitHW(); &lt;BR /&gt; InitETimer();&lt;BR /&gt; lcd_init(); &lt;BR /&gt; lcd_cls();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; ETIMER_0 .CHANNEL[1].CCCTRL.B.ARM = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Loop forever */&lt;BR /&gt; for (;;) {&lt;BR /&gt; &lt;BR /&gt; ETIMER_0.CHANNEL[1].CCCTRL.B.ARM = 1; &lt;BR /&gt; while(!(0x80 &amp;amp; ETIMER_0.CHANNEL[1].STS.R)){} &lt;BR /&gt; &lt;BR /&gt; edge1 = ETIMER_0.CHANNEL[1].CAPT1.R;&lt;BR /&gt; edge2 = ETIMER_0.CHANNEL[1].CAPT2.R;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(edge1&amp;lt;edge2)&lt;BR /&gt; period = (edge2 - edge1)*ETIMER_PRESC/FSYS;&lt;BR /&gt; else&lt;BR /&gt; period = (edge2 + 65535 - edge1)*ETIMER_PRESC/FSYS;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; ETIMER_0.CHANNEL[1].STS.R = 0x00c0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sprintf(wynik, "%d", period);&lt;BR /&gt; lcd_locate(1, 0);&lt;BR /&gt; lcd_str(wynik);&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think&amp;nbsp;that my code should look something like this, as shown below? But i dont know how should configuration look like..&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void InitETimer(void) {&lt;/P&gt;&lt;P&gt;?&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void eTimer_isr(void) {&lt;BR /&gt;?&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(void) {&lt;/P&gt;&lt;P&gt;char wynik[] = " ";&lt;/P&gt;&lt;P&gt;InitGPIO();&lt;BR /&gt; InitHW(); &lt;BR /&gt; InitETimer();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTC_InstallINTCInterruptHandler(eTimer_isr, 158, 1);&lt;BR /&gt; INTC .CPR_PRC0.R = 0;&lt;BR /&gt; &lt;BR /&gt; lcd_init(); &lt;BR /&gt; lcd_cls();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; ETIMER_0 .CHANNEL[1].CCCTRL.B.ARM = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Loop forever */&lt;BR /&gt; for (;;) {&lt;/P&gt;&lt;P&gt;sprintf(wynik, "%d", period);&lt;BR /&gt; lcd_locate(1, 0);&lt;BR /&gt; lcd_str(wynik);&lt;BR /&gt; Delay();&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Would&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;you please help me ? &amp;nbsp;Thank you very much.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2017 10:54:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5643L-eTimer-ISR/m-p/620564#M5421</guid>
      <dc:creator>mateuszolsztyn</dc:creator>
      <dc:date>2017-04-18T10:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5643L eTimer ISR</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5643L-eTimer-ISR/m-p/620565#M5422</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;If the interrupt is used instead of polling method then you should properly initialize INTC module and enable interrupt within eTimer module.&lt;/P&gt;&lt;P&gt;So your code could work, only within eTimer initialization the INTDMA register must be configured too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR, Petr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2017 11:34:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5643L-eTimer-ISR/m-p/620565#M5422</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2017-04-18T11:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5643L eTimer ISR</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5643L-eTimer-ISR/m-p/620566#M5423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, thank you for the response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified my code and its working but not good enough. Im measuring signal that has a period of 40ms, and im getting values sometimes good sometimes wrong. I see &lt;SPAN&gt;alternately&lt;/SPAN&gt;&amp;nbsp;changing values &lt;SPAN&gt;on my lcd,&lt;/SPAN&gt;&amp;nbsp;something like this: 40000 (40ms), 64856,&amp;nbsp;&lt;SPAN&gt;40000, 64856,&amp;nbsp;40000, 64856.....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Would you tell me, what im missing?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;static void InitETimer(void) {&lt;/P&gt;&lt;P&gt;ETIMER_0 .ENBL.R = 0x0;&amp;nbsp;&lt;BR /&gt; ETIMER_0 .CHANNEL[1].CTRL1.R = 0x3801 | PRESC &amp;lt;&amp;lt; 8;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ETIMER_0 .CHANNEL[1].INTDMA.B.ICF1IE = 1;&lt;BR /&gt; ETIMER_0 .CHANNEL[1].INTDMA.B.ICF2IE = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ETIMER_0 .CHANNEL[1].CCCTRL.R = 0x0052;&lt;BR /&gt; ETIMER_0 .CHANNEL[1].CTRL3.B.DBGEN = 0b01;&lt;/P&gt;&lt;P&gt;ETIMER_0 .ENBL.R = 0x0002;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;}&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;static void eTimer_isr(void) {&lt;/P&gt;&lt;P&gt;if (ETIMER_0 .CHANNEL[1].STS.B.ICF1) {&lt;BR /&gt; edge1 = ETIMER_0 .CHANNEL[1].CAPT1.R;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;if (ETIMER_0 .CHANNEL[1].STS.B.ICF2) {&lt;BR /&gt; edge2 = ETIMER_0 .CHANNEL[1].CAPT2.R;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (edge1 &amp;lt; edge2)&lt;BR /&gt; period = (edge2 - edge1) * ETIMER_PRESC / FSYS;&lt;BR /&gt; else&lt;BR /&gt; period = (edge2 + 65535 - edge1) * ETIMER_PRESC / FSYS;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; ETIMER_0 .CHANNEL[1].STS.R = 0x00c0;&lt;BR /&gt; ETIMER_0 .CHANNEL[1].CCCTRL.B.ARM = 1;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;}&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;int main(void) {&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;char wynik[] = " ";&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;InitGPIO();&lt;BR /&gt;InitHW(); &lt;BR /&gt;InitETimer();&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;INTC_InstallINTCInterruptHandler(eTimer_isr, 158, 1);&lt;BR /&gt;INTC .CPR_PRC0.R = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lcd_init(); &lt;BR /&gt;lcd_cls();&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;BR /&gt;ETIMER_0 .CHANNEL[1].CCCTRL.B.ARM = 1;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;/* Loop forever */&lt;BR /&gt;for (;;) {&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;sprintf(wynik, "%d", period);&lt;BR /&gt;lcd_locate(1, 0);&lt;BR /&gt;lcd_str(wynik);&lt;BR /&gt;Delay();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2017 21:16:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5643L-eTimer-ISR/m-p/620566#M5423</guid>
      <dc:creator>mateuszolsztyn</dc:creator>
      <dc:date>2017-04-18T21:16:41Z</dc:date>
    </item>
  </channel>
</rss>

