<?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 FTM Quadrature Decoder for S32K144 in S32K</title>
    <link>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948615#M5188</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a phase encoder AB and I need to know the position of the pulses in order to know the direction of the motors (forward or backward). I have thought to use ftm_qd but there isn´t any example about it and how to configure the module in the processor expert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any solution or idea of how can I develop it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Aug 2019 11:57:14 GMT</pubDate>
    <dc:creator>antperlag1</dc:creator>
    <dc:date>2019-08-05T11:57:14Z</dc:date>
    <item>
      <title>FTM Quadrature Decoder for S32K144</title>
      <link>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948615#M5188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a phase encoder AB and I need to know the position of the pulses in order to know the direction of the motors (forward or backward). I have thought to use ftm_qd but there isn´t any example about it and how to configure the module in the processor expert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any solution or idea of how can I develop it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2019 11:57:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948615#M5188</guid>
      <dc:creator>antperlag1</dc:creator>
      <dc:date>2019-08-05T11:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Quadrature Decoder for S32K144</title>
      <link>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948616#M5189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to recommend the application note&amp;nbsp;Features and Operation Modes of FlexTimer Module on S32K:&amp;nbsp;&lt;A class="link-titled" href="https://www.nxp.com/docs/en/application-note/AN5303.pdf" title="https://www.nxp.com/docs/en/application-note/AN5303.pdf"&gt;https://www.nxp.com/docs/en/application-note/AN5303.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See the section "3.7. Quadrature decoder mode".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SW of this app note&amp;nbsp;does not use&amp;nbsp;SDK, however, I believe it helps:&amp;nbsp;&lt;A class="link-titled" href="https://www.nxp.com/webapp/Download?colCode=AN5303SW&amp;amp;docLang=en" title="https://www.nxp.com/webapp/Download?colCode=AN5303SW&amp;amp;docLang=en"&gt;AN5303SW&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, the section "45.5.27 Quadrature Decoder Mode" and&amp;nbsp; "Figure 45-6. FTM Block Diagram" in the RM rev 11. can be useful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Diana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Aug 2019 08:47:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948616#M5189</guid>
      <dc:creator>dianabatrlova</dc:creator>
      <dc:date>2019-08-06T08:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Quadrature Decoder for S32K144</title>
      <link>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948617#M5190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;I also have this problem and i want to use the SDK componments flexTimer QD for quadrature decoder operation. I want to calcalate the direction and speed of a motor and there is no example about how to use it. Did you find out a way or are there anyone else could help?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2019 08:40:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948617#M5190</guid>
      <dc:creator>kaihao_ying</dc:creator>
      <dc:date>2019-08-09T08:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Quadrature Decoder for S32K144</title>
      <link>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948618#M5191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have see the documents and i understood the way how it calculate the speed and direction. However, i still do not know how to use the SDK's module Flextimer_QD for specicic project, could you give me some guide on how to use it or show me some examples. Thank you so much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2019 08:43:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948618#M5191</guid>
      <dc:creator>kaihao_ying</dc:creator>
      <dc:date>2019-08-09T08:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Quadrature Decoder for S32K144</title>
      <link>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948619#M5192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kaihao,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The motor position can be successfully measured by GPIO (using two GPIOs to sample the A and B signals)&amp;nbsp;and I have successfully implemented it.&amp;nbsp; But the speed calculation has a large error under this case. That's why I truned to use QD.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to use QD to measure the motor position, but failed. I am still on the way to figure it out and realize it during this month. If using QD, the direction can be acheved by the code as below. It works well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Motor_Dir_Encoder = ((FTM2-&amp;gt;QDCTRL)&amp;gt;&amp;gt;2)&amp;amp;0x1; // QUADIR is the bit that indicates the counting direction.&lt;/P&gt;&lt;P&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/86641i819A0031F6584F2B/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&gt;&lt;/P&gt;&lt;P&gt;Hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Jianfei Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2019 17:18:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948619#M5192</guid>
      <dc:creator>cjf6221</dc:creator>
      <dc:date>2019-08-09T17:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Quadrature Decoder for S32K144</title>
      <link>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948620#M5193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jianfei,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Thanks for your advice, and it really helped a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;I have figured out using FTM_QD module to calculate the phase of the AB signals.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Best Wishes&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Kaihao&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2019 08:14:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948620#M5193</guid>
      <dc:creator>kaihao_ying</dc:creator>
      <dc:date>2019-08-13T08:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Quadrature Decoder for S32K144</title>
      <link>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948621#M5194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kaihao,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good job !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what kind of interrupt do you use ? Counter overflow or FTM Channel interrupt ? I used FTM2_QD&amp;nbsp;to measure every rising or falling edge of A and B by using counter overflow interrupt. But&amp;nbsp;I am still troubled by the interrupt configuration.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my configuration for&amp;nbsp;FTM2_QD. Please provide some help. Thanks. By the way, my Wechat ID&amp;nbsp;is cjf715822 and email address is &lt;A href="mailto:cjf6221@gmail.com."&gt;cjf6221@gmail.com.&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void FTM2_Quadrature_Decoder_Mode()&lt;BR /&gt;{&lt;BR /&gt; /* Enable clock for PORTD */&lt;BR /&gt; PCC-&amp;gt;PCCn[PCC_PORTD_INDEX] = PCC_PCCn_CGC_MASK;&lt;BR /&gt; /* Select and enable clock for FTM2 */&lt;BR /&gt; PCC-&amp;gt;PCCn[PCC_FLEXTMR2_INDEX] = PCC_PCCn_PCS(6) | PCC_PCCn_CGC_MASK;&lt;/P&gt;&lt;P&gt;PORTD-&amp;gt;PCR[10] = PORT_PCR_MUX(3); // Set PTD10 for FTM2 - Phase B input&lt;BR /&gt; PORTD-&amp;gt;PCR[11] = PORT_PCR_MUX(3); // Set PTD11 for FTM2 - Phase A input&lt;/P&gt;&lt;P&gt;FSL_NVIC-&amp;gt;ISER[FTM2_IRQn / 32] |= (1 &amp;lt;&amp;lt; (FTM2_IRQn % 32)); // Enable FTM2 counter overflow interrupt&lt;BR /&gt; // FSL_NVIC-&amp;gt;ICPR[116/32] = 1 &amp;lt;&amp;lt; (116% 32);&lt;BR /&gt; FSL_NVIC-&amp;gt;ISER[116/32] = 1 &amp;lt;&amp;lt; (116% 32);&lt;BR /&gt; // FSL_NVIC-&amp;gt;IP[116] = 0;&lt;/P&gt;&lt;P&gt;FTM2-&amp;gt;MODE = FTM_MODE_WPDIS_MASK | FTM_MODE_INIT_MASK | FTM_MODE_FTMEN_MASK;&lt;/P&gt;&lt;P&gt;//Enable FTM2 module (0x00000005): D2(WPDIS) and D0(FTMEN) are set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FTM2-&amp;gt;MOD = FTM_MOD_MOD(4096);&amp;nbsp;//&amp;nbsp;overflow&amp;nbsp;after totally 4096 rising/falling edges&lt;BR /&gt; FTM2-&amp;gt;CNT = 0;&amp;nbsp;&amp;nbsp;&lt;BR /&gt; FTM2-&amp;gt;CNTIN = FTM_CNTIN_INIT(0);&lt;/P&gt;&lt;P&gt;// FTM2-&amp;gt;QDCTRL= FTM_QDCTRL_QUADEN_MASK; // Enable QD mode&lt;BR /&gt; FTM2-&amp;gt;QDCTRL= 0x000000C1; // Enable QD mode and input filter mode&lt;BR /&gt; FTM2-&amp;gt;SC |= FTM_SC_CLKS(1) | FTM_SC_PS(2) | FTM_SC_CPWMS_MASK | FTM_SC_TOIE_MASK;&lt;/P&gt;&lt;P&gt;// FTM_SC_CLKS(1): select FTM as input timer.&lt;BR /&gt; // FTM_SC_PS(2): clock source FTM, prescaler 2^2, clock frequency = 112MHz/4 = 28MHz&lt;BR /&gt; // FTM_SC_TOIE_MASK: enable timer overflow interruption&lt;BR /&gt; // FTM_SC_CPWMS_MASK; D5(CPWMS) is set to enable up-down counting mode&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Below is the overflow interrupt function.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;void FTM2_Ovf_Reload_IRQHandler()&amp;nbsp;&amp;nbsp;&lt;BR /&gt;{&lt;BR /&gt;PTC-&amp;gt;PTOR |= 1&amp;lt;&amp;lt;9; // Toggle PTC9 for scope display&lt;BR /&gt; FTM2_ISR_Counter++;&lt;BR /&gt; Temp_EncoderB = FTM2-&amp;gt;CONTROLS[0].CnV; //store the captured C0V value (Counter's vaule)&lt;BR /&gt; Temp_EncoderA = FTM2-&amp;gt;CONTROLS[1].CnV; //store the captured C1V value (Counter's vaule)&lt;BR /&gt; FTM2-&amp;gt;CONTROLS[0].CnSC &amp;amp;= ~FTM_CnSC_CHF_MASK; //clear Ch0 flag D7(CHF) is required to be reset after reading&lt;BR /&gt; FTM2-&amp;gt;CONTROLS[1].CnSC &amp;amp;= ~FTM_CnSC_CHF_MASK; //clear Ch1 flag D7(CHF) is required to be reset after reading&lt;BR /&gt; Count_Encoder = FTM2-&amp;gt;CNT;&lt;BR /&gt; FTM2-&amp;gt;SC &amp;amp;= ~FTM_SC_TOF_MASK; // Clear timer overflow flag D9(TOF) is reset&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2019 16:15:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948621#M5194</guid>
      <dc:creator>cjf6221</dc:creator>
      <dc:date>2019-08-13T16:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Quadrature Decoder for S32K144</title>
      <link>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948622#M5195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Rong,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should use &lt;STRONG&gt;S32_NVIC&lt;/STRONG&gt; instead of FLS_NVIC in the code (it was used in older projects)&lt;/P&gt;&lt;P&gt;S32_NVIC&lt;STRONG&gt;-&lt;/STRONG&gt;&amp;gt;ICPR[3] = 1 &amp;lt;&amp;lt; (116 % 32);&lt;BR /&gt;S32_NVIC-&amp;gt;ISER[3] = 1 &amp;lt;&amp;lt; (116 % 32);&lt;BR /&gt;S32_NVIC-&amp;gt;IP[116] = 0x00;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you were able to compile the project with FLS_NVIC code you have probably wrong header file. In that case, I recommend you to create a new project.&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Diana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Aug 2019 08:49:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FTM-Quadrature-Decoder-for-S32K144/m-p/948622#M5195</guid>
      <dc:creator>dianabatrlova</dc:creator>
      <dc:date>2019-08-15T08:49:10Z</dc:date>
    </item>
  </channel>
</rss>

