<?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: eTimer MPC5744p</title>
    <link>https://community.nxp.com/t5/MPC5xxx/eTimer-MPC5744p/m-p/989037#M14888</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;MC_CLK&amp;nbsp; = 10MHz,&amp;nbsp;&amp;nbsp;&amp;nbsp;I get freq =&amp;nbsp;831.117004, period = 0.009399999,duty = 15.957448,counts1 = 94, counts2 = 15;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;When&amp;nbsp;&lt;SPAN&gt;MC_CLK&amp;nbsp; = 120MHz,&lt;SPAN style="background-color: #ffffff;"&gt;I get freq =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff;"&gt;840.053772, period = 0.00930000003,duty = 15.0537624,counts1 = 93, counts2 = 14;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN style="background-color: #ffffff; "&gt;the data I get amost the same.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Feb 2020 09:07:51 GMT</pubDate>
    <dc:creator>金翅大鹏鸟</dc:creator>
    <dc:date>2020-02-20T09:07:51Z</dc:date>
    <item>
      <title>eTimer MPC5744p</title>
      <link>https://community.nxp.com/t5/MPC5xxx/eTimer-MPC5744p/m-p/989035#M14886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear ALL,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used&amp;nbsp; eTimer0_ch0 of MPC5744P to measure the frequency of a sensor which produces a PWM wave ,frequency(10KHz),Duty(53%). But I get the wrong frequency.Can anyone help me? Thank you ! My code is below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void eTimer_Init(void)&lt;BR /&gt;{&lt;BR /&gt; MC_ME.PCTL247.B.RUN_CFG = 0x00; // enable group RUN_PC0 for enable clock&lt;BR /&gt; MC_ME.PCTL247.B.LP_CFG = 0x00; // enable group LP_PC0 for enable clock&lt;/P&gt;&lt;P&gt;SIUL2.MSCR[PortA0].B.IBE = 1; // PA0: Enable pad for input - eTimer0 ch0&lt;BR /&gt; SIUL2.IMCR[59].B.SSS = 2; // eTimer0 ch0: connected to pad PA0&lt;/P&gt;&lt;P&gt;ETIMER_0.ENBL.R = 0x0; // disable Timer0 channels&lt;/P&gt;&lt;P&gt;ETIMER_0.CH[0].CTRL1.R = 0x3F00; // Counts only rising edge of the MC_CLK (10MHz in RUN0), divide by 128, count up, count repeatedly, rollover&lt;BR /&gt; ETIMER_0.CH[0].COMP1.R = 0xFFFF;&lt;BR /&gt; ETIMER_0.CH[0].CCCTRL.R = 0x0264; // compare on COMP1 when counting up, COMP2 when counting down&lt;BR /&gt; // CAPT2 on falling edge, CAPT1 on rising edge, 2 entries&lt;BR /&gt; // free-running mode&lt;BR /&gt; ETIMER_0.CH[0].CTRL3.R = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ETIMER_0.ENBL.R = 0x0001; // Enable Timer0 channel 2&lt;/P&gt;&lt;P&gt;ETIMER_0.CH[0].CCCTRL.B.ARM = 1; // starts the input capture process&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;uint16_t capture_ch0[4] = {0};&lt;BR /&gt;uint16_t edge1 = 0;&lt;BR /&gt;uint16_t edge2 = 0;&lt;BR /&gt;uint16_t edge3 = 0;&lt;BR /&gt;uint16_t edge4 = 0;&lt;BR /&gt;uint16_t counts1 = 0;&lt;BR /&gt;uint16_t counts2 = 0;&lt;BR /&gt;float pulseH = 0;&lt;BR /&gt;float pulseL = 0;&lt;BR /&gt;float period = 0;&lt;BR /&gt;float freq = 0;&lt;BR /&gt;float duty = 0;&lt;BR /&gt;void eTimer0_ch0_pro(void)&lt;BR /&gt;{&lt;BR /&gt; if(ETIMER_0.CH[0].STS.R &amp;amp; 0x0080)&lt;BR /&gt; {&lt;BR /&gt; capture_ch0[0] = ETIMER_0.CH[0].CAPT1.R;&lt;BR /&gt; capture_ch0[1] = ETIMER_0.CH[0].CAPT2.R;&lt;BR /&gt; capture_ch0[2] = ETIMER_0.CH[0].CAPT1.R;&lt;BR /&gt; capture_ch0[3] = ETIMER_0.CH[0].CAPT2.R;&lt;/P&gt;&lt;P&gt;edge1 = capture_ch0[0];// save 1st rising edge&lt;BR /&gt; edge2 = capture_ch0[1];// save 1st falling edge&lt;BR /&gt; edge3 = capture_ch0[2]; // save 2nd rising edge&lt;BR /&gt; edge4 = capture_ch0[3];// save 2nd falling edge&lt;/P&gt;&lt;P&gt;// calculate period, pulseH, pulseL, freq and duty&lt;BR /&gt; if(edge3&amp;gt;edge1)&lt;BR /&gt; {&lt;BR /&gt; counts1 = edge3 - edge1;&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; counts1 = (0xFFFF - edge1 +1) + edge3;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;freq = (float)78125.0/counts1;&amp;nbsp;&amp;nbsp;&amp;nbsp;//10M/128 = 78125&lt;/P&gt;&lt;P&gt;ETIMER_0.CH[0].STS.R = 0x00C0;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I run&amp;nbsp;&lt;SPAN&gt;eTimer0_ch0_pro() in the while(1) of main(),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Why do I get the right frequcy?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2020 09:27:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/eTimer-MPC5744p/m-p/989035#M14886</guid>
      <dc:creator>金翅大鹏鸟</dc:creator>
      <dc:date>2020-02-19T09:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: eTimer MPC5744p</title>
      <link>https://community.nxp.com/t5/MPC5xxx/eTimer-MPC5744p/m-p/989036#M14887</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;what is the result you got? What is the counts1 value?&lt;/P&gt;&lt;P&gt;You are measuring 10kHz input&amp;nbsp; using 78.125 KHz reference, this way you lost a resolution a lot.&lt;/P&gt;&lt;P&gt;You should increase reference clock and deal with counter overflows. The overflow can be solved using cascaded channels as it is shown in&amp;nbsp;&lt;A href="https://community.nxp.com/docs/DOC-104285"&gt;https://community.nxp.com/docs/DOC-104285&lt;/A&gt;&amp;nbsp;&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>Thu, 20 Feb 2020 08:03:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/eTimer-MPC5744p/m-p/989036#M14887</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2020-02-20T08:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: eTimer MPC5744p</title>
      <link>https://community.nxp.com/t5/MPC5xxx/eTimer-MPC5744p/m-p/989037#M14888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;MC_CLK&amp;nbsp; = 10MHz,&amp;nbsp;&amp;nbsp;&amp;nbsp;I get freq =&amp;nbsp;831.117004, period = 0.009399999,duty = 15.957448,counts1 = 94, counts2 = 15;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;When&amp;nbsp;&lt;SPAN&gt;MC_CLK&amp;nbsp; = 120MHz,&lt;SPAN style="background-color: #ffffff;"&gt;I get freq =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff;"&gt;840.053772, period = 0.00930000003,duty = 15.0537624,counts1 = 93, counts2 = 14;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN style="background-color: #ffffff; "&gt;the data I get amost the same.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2020 09:07:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/eTimer-MPC5744p/m-p/989037#M14888</guid>
      <dc:creator>金翅大鹏鸟</dc:creator>
      <dc:date>2020-02-20T09:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: eTimer MPC5744p</title>
      <link>https://community.nxp.com/t5/MPC5xxx/eTimer-MPC5744p/m-p/989038#M14889</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 changing MC_CLK you should get different counts1 value. Try to just change the channel prescaler.&lt;/P&gt;&lt;P&gt;Are the &lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;capture_ch0 values changing when&amp;nbsp;eTimer0_ch0_pro() is called? Try to disarm capture logic before CAPT are read (ARM=0) and finally&amp;nbsp;start it back.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;BR, Petr&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2020 08:59:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/eTimer-MPC5744p/m-p/989038#M14889</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2020-02-21T08:59:27Z</dc:date>
    </item>
  </channel>
</rss>

