<?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のトピック回复： KEA128 FTM input capture，single channel</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-FTM-input-capture-single-channel/m-p/1711052#M65482</link>
    <description>&lt;P&gt;Hi Miguel，&lt;/P&gt;&lt;P&gt;Thanks for your reply. My target frequency is 100Hz.In my program, I set up two global variables, which allows me to receive the counter value in&lt;/P&gt;&lt;P&gt;time. I use the monitoring window to monitor them. I found that only the frequency is greater than 3KHz, the counter value will be stable.&lt;/P&gt;&lt;P&gt;At 100Hz,&amp;nbsp;&lt;SPAN&gt;the two global variables change very fast, it is extremely unstable. And I have calculated that the value of CNT does not overflow.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I'm&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;confused.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best Regards, ID7729.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Aug 2023 00:31:47 GMT</pubDate>
    <dc:creator>ID7729</dc:creator>
    <dc:date>2023-08-25T00:31:47Z</dc:date>
    <item>
      <title>KEA128 FTM input capture，single channel</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-FTM-input-capture-single-channel/m-p/1708200#M65468</link>
      <description>&lt;P&gt;I want to use FTM2ch3 of KEA128 to achieve PWM wave duty cycle capture.However, the frequency band that can be captured is very limited, too low frequency PWM wave can not be captured, I would like to ask you have met the same situation.The code is as follows：&lt;/P&gt;&lt;DIV&gt;void init_FTM(void) {&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SIM_SCGC |= SIM_SCGC_FTM2_MASK;/* Sys Clk Gate Ctrl: enable bus clock to FTM1,2 */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;/* FTM2 module settings for desired channel modes: */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FTM2_MODE |= FTM_MODE_WPDIS_MASK; /* Write protect to registers disabled (default) */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FTM2_COMBINE = 0x00000000; /* DECAPEN (Dual Edge Capture Mode Enable) = 0&amp;nbsp; */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;/* COMBINE (chans n &amp;amp; n+1) = 0 (default; independent chans) */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FTM2_MOD = 0xFFFF;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FTM2_CNTIN = 0x01;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FTM2_SC = 0x07; /* CWMS (Center aligned PWM Select) = 0 (default, up count) */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;/* TOIE (Timer Overflow Interrupt Ena) = 0 (default) */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;/* CLKS (Clock source) = 0 (default, no clock; FTM disabled) */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;/* PS (Prescaler factor) = 7. Prescaler = 2**7 = 128 */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void init_FTM2_ch3_IC(void) {&lt;BR /&gt;FTM2_C3SC = 0x48; /* FTM2 ch3: Input Capture on falling edge */&lt;BR /&gt;/* CHIE (Chan Interrupt Ena) = 0 (default) */&lt;BR /&gt;/* MSB:MSA (chan Mode Select) = 0b00 */&lt;BR /&gt;/* ELSB:ELSA (chan Edge or Level Select) = 0b01 */&lt;BR /&gt;SIM_PINSEL1 &amp;amp;= ~SIM_PINSEL1_FTM2PS3_MASK;&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void start_FTM_counters(void) {&lt;BR /&gt;FTM2_SC |= FTM_SC_CLKS(1); /* Start FTM2 ctr with clk source TIMER_CLK (20 MHz)*/&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void FTM2_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt;FTM2_C3SC &amp;amp;= ~FTM_CnSC_CHF_MASK;&lt;BR /&gt;if(flag == 0)&lt;BR /&gt;{&lt;BR /&gt;CurrentCaptureVal1 = FTM2_C3V;&lt;BR /&gt;FTM2_C3SC = 0x00000048; /* FTM2 ch3: Input Capture on falling edge */&lt;BR /&gt;/* CHIE (Chan Interrupt Ena) = 1 (default) */&lt;BR /&gt;/* MSB:MSA (chan Mode Select) = 0b00 */&lt;BR /&gt;/* ELSB:ELSA (chan Edge or Level Select) = 0b10 */&lt;BR /&gt;flag = 1;&lt;BR /&gt;FTM2_CNT = 0x00000001;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;CurrentCaptureVal2 = FTM2_C3V;&lt;BR /&gt;FTM2_C3SC = 0x00000044; /* FTM2 ch3: Input Capture on rising edge */&lt;BR /&gt;/* CHIE (Chan Interrupt Ena) = 1 (default) */&lt;BR /&gt;/* MSB:MSA (chan Mode Select) = 0b00 */&lt;BR /&gt;/* ELSB:ELSA (chan Edge or Level Select) = 0b01 */&lt;BR /&gt;flag = 0;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;int main(void) {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; init_clks_FEE_40MHz(); /* KEA128 clks FEE, 8MHz xtal: core 40 MHz, bus 20MHz */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;init_FTM ();&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* Enable bus clock to FTM1,2 prescaled by 128 */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;init_FTM2_ch3_IC(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* PTB5 input; connect J2_5 and J2_10&amp;nbsp; */&amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;NVIC_EnableIRQ(FTM2_IRQn);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; start_FTM_counters();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;for (;;) {&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can you help me?&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 21 Aug 2023 08:44:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-FTM-input-capture-single-channel/m-p/1708200#M65468</guid>
      <dc:creator>ID7729</dc:creator>
      <dc:date>2023-08-21T08:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: KEA128 FTM input capture，single channel</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-FTM-input-capture-single-channel/m-p/1710993#M65480</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/221743"&gt;@ID7729&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The input frequency should not be causing the problem, since the input capture counts from rising, falling or rising and falling edges.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reference manual only specifys that it has a maximum frquency not a minimum.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;26.4.4 Input Capture mode&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Note that the maximum frequency for the channel input signal to be detected correctly is system clock divided by 4, which is required to meet Nyquist criteria for signal sampling.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Can you tell me the frquency you are measuring?&lt;/P&gt;
&lt;P&gt;Best Regards, Miguel.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 20:46:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-FTM-input-capture-single-channel/m-p/1710993#M65480</guid>
      <dc:creator>Miguel04</dc:creator>
      <dc:date>2023-08-24T20:46:06Z</dc:date>
    </item>
    <item>
      <title>回复： KEA128 FTM input capture，single channel</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-FTM-input-capture-single-channel/m-p/1711052#M65482</link>
      <description>&lt;P&gt;Hi Miguel，&lt;/P&gt;&lt;P&gt;Thanks for your reply. My target frequency is 100Hz.In my program, I set up two global variables, which allows me to receive the counter value in&lt;/P&gt;&lt;P&gt;time. I use the monitoring window to monitor them. I found that only the frequency is greater than 3KHz, the counter value will be stable.&lt;/P&gt;&lt;P&gt;At 100Hz,&amp;nbsp;&lt;SPAN&gt;the two global variables change very fast, it is extremely unstable. And I have calculated that the value of CNT does not overflow.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I'm&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;confused.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best Regards, ID7729.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 00:31:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-FTM-input-capture-single-channel/m-p/1711052#M65482</guid>
      <dc:creator>ID7729</dc:creator>
      <dc:date>2023-08-25T00:31:47Z</dc:date>
    </item>
    <item>
      <title>回复： KEA128 FTM input capture，single channel</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-FTM-input-capture-single-channel/m-p/1713423#M65498</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/221743"&gt;@ID7729&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have the channel configurated to capture on rising edges, have you tried to use it in rising and falling edges?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Refer to&amp;nbsp;&lt;A href="https://www.nxp.com/docs/en/application-note/AN5142.pdf" target="_self"&gt;AN5142&lt;/A&gt; chapter 3.8:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;"When ELSnB:ELSnA=11, the mode is Capture on rising/falling edge, the mode is used to test duty&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;cycle."&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Best Regards, Miguel.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 18:10:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-FTM-input-capture-single-channel/m-p/1713423#M65498</guid>
      <dc:creator>Miguel04</dc:creator>
      <dc:date>2023-08-29T18:10:19Z</dc:date>
    </item>
  </channel>
</rss>

