<?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 Switching FTM between PWM and Decoder; Possible SDK bug? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switching-FTM-between-PWM-and-Decoder-Possible-SDK-bug/m-p/962842#M55061</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My application (for&amp;nbsp;MK22FN512) requires sharing one of the FTMs between a PWM output and an Encoder. I had a hell of a time getting it to work using the SDK. (Using the functions in fsl_ftm.c)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After poking around a few hours I realized that once the FTM was switched into decoder mode, it would basically get "stuck" there. The PWM would never start counting again, even using the exact same code that works when called out of reset. It turns out that the QUADEN bit in QDCTRL does not get cleared.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These two lines solved my problem:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LED_PWM_FTM_BASEADDR-&amp;gt;MODE |= FTM_MODE_WPDIS_MASK;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; LED_PWM_FTM_BASEADDR-&amp;gt;QDCTRL &amp;amp;= ~FTM_QDCTRL_QUADEN_MASK;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems to me that the SDK should clear this bit in&amp;nbsp;&lt;STRONG&gt;FTM_Deinit&lt;/STRONG&gt; or in the non-decoder setup functions&amp;nbsp;(ie.&amp;nbsp;&lt;STRONG&gt;FTM_SetupPwm&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wasn't sure where to file a bug report, but figured this might help anyone that might run into the same problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Jun 2019 15:42:41 GMT</pubDate>
    <dc:creator>andy1</dc:creator>
    <dc:date>2019-06-07T15:42:41Z</dc:date>
    <item>
      <title>Switching FTM between PWM and Decoder; Possible SDK bug?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switching-FTM-between-PWM-and-Decoder-Possible-SDK-bug/m-p/962842#M55061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My application (for&amp;nbsp;MK22FN512) requires sharing one of the FTMs between a PWM output and an Encoder. I had a hell of a time getting it to work using the SDK. (Using the functions in fsl_ftm.c)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After poking around a few hours I realized that once the FTM was switched into decoder mode, it would basically get "stuck" there. The PWM would never start counting again, even using the exact same code that works when called out of reset. It turns out that the QUADEN bit in QDCTRL does not get cleared.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These two lines solved my problem:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LED_PWM_FTM_BASEADDR-&amp;gt;MODE |= FTM_MODE_WPDIS_MASK;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; LED_PWM_FTM_BASEADDR-&amp;gt;QDCTRL &amp;amp;= ~FTM_QDCTRL_QUADEN_MASK;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems to me that the SDK should clear this bit in&amp;nbsp;&lt;STRONG&gt;FTM_Deinit&lt;/STRONG&gt; or in the non-decoder setup functions&amp;nbsp;(ie.&amp;nbsp;&lt;STRONG&gt;FTM_SetupPwm&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wasn't sure where to file a bug report, but figured this might help anyone that might run into the same problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2019 15:42:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switching-FTM-between-PWM-and-Decoder-Possible-SDK-bug/m-p/962842#M55061</guid>
      <dc:creator>andy1</dc:creator>
      <dc:date>2019-06-07T15:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Switching FTM between PWM and Decoder; Possible SDK bug?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switching-FTM-between-PWM-and-Decoder-Possible-SDK-bug/m-p/962843#M55062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrew Smolak,&lt;/P&gt;&lt;P&gt;I can see the QUADEN is cleared in FTM_SetupInputCapture and FTM_SetupOutputCompare but no in the non-decoder setup functions (ie. FTM_SetupPwm).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="FTM_SetupInputCapture QUADEN.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/85953i9C289320DA01FECC/image-size/large?v=v2&amp;amp;px=999" role="button" title="FTM_SetupInputCapture QUADEN.png" alt="FTM_SetupInputCapture QUADEN.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="FTM_SetupOutputCompare QUADEN.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/85954iC690EAC6D1202447/image-size/large?v=v2&amp;amp;px=999" role="button" title="FTM_SetupOutputCompare QUADEN.png" alt="FTM_SetupOutputCompare QUADEN.png" /&gt;&lt;/span&gt;&lt;BR /&gt;I will report it to MCUXpresso SDK team.&lt;BR /&gt;Thank you for reporting this. &amp;nbsp;&lt;BR /&gt;Have a great day!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2019 02:21:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switching-FTM-between-PWM-and-Decoder-Possible-SDK-bug/m-p/962843#M55062</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2019-06-12T02:21:57Z</dc:date>
    </item>
  </channel>
</rss>

