<?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_SetupPwm Function in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909672#M53313</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'm using a K60 Tower to generate a PWM signal, i started by a default project from SDK (simple PWM) but when i try to generate a 50Hz Square wave the Tower can't get it i don't if someone can help me to understand why, below command line that i change to get this signal :&lt;span class="lia-inline-image-display-wrapper" image-alt="Capture.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/85921iEEEF5C93BED18D23/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Jun 2019 15:11:14 GMT</pubDate>
    <dc:creator>aminesedki_as</dc:creator>
    <dc:date>2019-06-11T15:11:14Z</dc:date>
    <item>
      <title>FTM_SetupPwm Function</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909672#M53313</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'm using a K60 Tower to generate a PWM signal, i started by a default project from SDK (simple PWM) but when i try to generate a 50Hz Square wave the Tower can't get it i don't if someone can help me to understand why, below command line that i change to get this signal :&lt;span class="lia-inline-image-display-wrapper" image-alt="Capture.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/85921iEEEF5C93BED18D23/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2019 15:11:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909672#M53313</guid>
      <dc:creator>aminesedki_as</dc:creator>
      <dc:date>2019-06-11T15:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: FTM_SetupPwm Function</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909673#M53314</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 frequency is FTM_SOURCE_CLOCK and what value have you set for the FTM pre-scaler?&lt;BR /&gt;If it is too high to be able to generate 50Hz using maximum divide of 64k (in MOD) the function will return an error and not generate an output:&lt;/P&gt;&lt;P&gt;1. Check return value for errors&lt;BR /&gt;2. See the source code of FTM_SetupPwm() to see what it does and what causes it to fail&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Complete Kinetis solutions for professional needs, training and support:http://www.utasker.com/kinetis.html&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Kinetis K60:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/TWR-K60N512.html" target="test_blank"&gt;http://www.utasker.com/kinetis/TWR-K60N512.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/TWR-K60D100M.html" target="test_blank"&gt;http://www.utasker.com/kinetis/TWR-K60D100M.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/TWR-K60F120M.html" target="test_blank"&gt;http://www.utasker.com/kinetis/TWR-K60F120M.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/ELZET80_NET-KBED.html" target="test_blank"&gt;http://www.utasker.com/kinetis/ELZET80_NET-KBED.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/ELZET80_NET-K60.html" target="test_blank"&gt;http://www.utasker.com/kinetis/ELZET80_NET-K60.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;EM&gt;uTasker: supporting &amp;gt;1'000 registered Kinetis users get products faster and cheaper to market&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;EM&gt;Request Free emergency remote desk-top consulting at &lt;A href="http://www.utasker.com/services.html" target="test_blank"&gt;http://www.utasker.com/services.html&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;HW timers: &lt;A href="http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF" target="test_blank"&gt;http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Open Source Version: &lt;A href="https://github.com/uTasker/uTasker-Kinetis" target="test_blank"&gt;https://github.com/uTasker/uTasker-Kinetis&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2019 19:06:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909673#M53314</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2019-06-11T19:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: FTM_SetupPwm Function</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909674#M53315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The ftm_simple_pwm example select Bus Clock(48MHz) as FTM_SOURCE_CLOCK.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="FTM_SOURCE_CLOCK.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/85974i8F43E2D6A3990EBD/image-size/large?v=v2&amp;amp;px=999" role="button" title="FTM_SOURCE_CLOCK.png" alt="FTM_SOURCE_CLOCK.png" /&gt;&lt;/span&gt;&lt;BR /&gt;The FTM_SetupPwm() will return error due to overflow the registers:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="FTM_SetupPwm.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/85975i97423575FCEEF6FD/image-size/large?v=v2&amp;amp;px=999" role="button" title="FTM_SetupPwm.png" alt="FTM_SetupPwm.png" /&gt;&lt;/span&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 06:54:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909674#M53315</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2019-06-12T06:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: FTM_SetupPwm Function</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909675#M53316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your feedback Mr Butcher, the frequency of the source clock is 48Mhz, i change it to 96Mhz, 1.56Mhz juste to see the results but i still have the same problem it can't reach below approximately 1Khz and i see any error message.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2019 12:41:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909675#M53316</guid>
      <dc:creator>aminesedki_as</dc:creator>
      <dc:date>2019-06-12T12:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: FTM_SetupPwm Function</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909676#M53317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for this feedback exactly i do the same as mentioned in the comment i change the frequency source several time with 96Mhz, 24Mhz, 1.56Mhz but i can't get my 50Hz PWM&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2019 12:44:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909676#M53317</guid>
      <dc:creator>aminesedki_as</dc:creator>
      <dc:date>2019-06-12T12:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: FTM_SetupPwm Function</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909677#M53318</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;Are you sure about the frequency source because 50Hz is no problem if you really have 1.56MHz (for example).&lt;BR /&gt;The API doesn't explain how to control things so you will need to study its code and work out how the pre-scaler needs to be set (I see that the pre-scaler value is read inside the call from the control register in order to calculate the value, meaning that the pre-scaler needs to be configured &lt;SPAN style="text-decoration: underline;"&gt;beforehand&lt;/SPAN&gt; somehow).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below I used the uTasker project and K60 simulator to generate 50Hzz on PRC3 (FlexTimer 0 - channel 3), using 100MHz core, 50MHz bus clock and /16 pre-scaler, which gives exactly 50Hz output as (see simulation below):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;    PWM_INTERRUPT_SETUP pwm_setup&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    pwm_setup&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;int_type &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; PWM_INTERRUPT&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    pwm_setup&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;int_handler &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    pwm_setup&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pwm_mode &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;PWM_SYS_CLK &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; PWM_PRESCALER_16 &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; PWM_EDGE_ALIGNED&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// clock PWM timer from the system clock with /16 pre-scaler&lt;/SPAN&gt;
    pwm_setup&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pwm_reference &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_TIMER_0 &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;                            &lt;SPAN class="comment token"&gt;// timer module 0, channel 3&lt;/SPAN&gt;
    pwm_setup&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pwm_frequency &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;PWM_FREQUENCY&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;16&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;                      &lt;SPAN class="comment token"&gt;// generate 50Hz on PWM output&lt;/SPAN&gt;
    pwm_setup&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pwm_value   &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;_PWM_PERCENT&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;20&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; pwm_setup&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pwm_frequency&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// 20% PWM (high/low)&lt;/SPAN&gt;
    &lt;SPAN class="token function"&gt;fnConfigureInterrupt&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;amp;&lt;/SPAN&gt;pwm_setup&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;                            &lt;SPAN class="comment token"&gt;// enter configuration for PWM test&lt;/SPAN&gt;
‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;IMG alt="pastedImage_3.png" src="https://community.nxp.com/t5/image/serverpage/image-id/86055i17E1F4EC6D0EBF08/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_3.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you continue having problems simply download the open source uTasker project from GITHUB since it allows simulation and higher levels of abstraction in order to avoid such problems (also code will run on almost and Kinetis parts without needing to change libraries and such - eg. if you want your K60 project to later run on a K64 or KL25 just change one define to do the same thing on the other chips).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 14:22:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909677#M53318</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2020-11-02T14:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: FTM_SetupPwm Function</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909678#M53319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for this feedback, finally i see that the prescale was on 1,when i set on 128 it work will with the 48Mhz source clock&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2019 08:03:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-SetupPwm-Function/m-p/909678#M53319</guid>
      <dc:creator>aminesedki_as</dc:creator>
      <dc:date>2019-06-13T08:03:53Z</dc:date>
    </item>
  </channel>
</rss>

