<?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 FTM0 clock configuration problem in MCUXpresso General</title>
    <link>https://community.nxp.com/t5/MCUXpresso-General/FTM0-clock-configuration-problem/m-p/884353#M1665</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I am using MCUXpresso IDE and FRDM-K64F board.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to configure four PWM channels using FTM0 at a frequency of 50hz. My definitions are the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define FTM_SOURCE_CLOCK CLOCK_GetFreq(kCLOCK_McgFixedFreqClk)&lt;/P&gt;&lt;P&gt;#define FTM_MODULE FTM0&lt;BR /&gt;#define PWM_CH0 0U&lt;BR /&gt;#define PWM_CH1 1U&lt;BR /&gt;#define PWM_CH2 2U&lt;BR /&gt;#define PWM_CH3 3U&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And my configuration code is the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftm_config_t ftmInfo;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftm_chnl_pwm_signal_param_t ftmParam[4];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[0].chnlNumber = (ftm_chnl_t)PWM_CH0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[0].level = kFTM_HighTrue;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[0].dutyCyclePercent = 5U;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[0].firstEdgeDelayPercent = 0U;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[1].chnlNumber = (ftm_chnl_t)PWM_CH1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[1].level = kFTM_HighTrue;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[1].dutyCyclePercent = 5U;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[1].firstEdgeDelayPercent = 0U;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[2].chnlNumber = (ftm_chnl_t)PWM_CH2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[2].level = kFTM_HighTrue;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[2].dutyCyclePercent = 5U;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[2].firstEdgeDelayPercent = 0U;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[3].chnlNumber = (ftm_chnl_t)PWM_CH3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[3].level = kFTM_HighTrue;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[3].dutyCyclePercent = 5U;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[3].firstEdgeDelayPercent = 0U;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM_GetDefaultConfig(&amp;amp;ftmInfo);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM_Init(FTM_MODULE, &amp;amp;ftmInfo);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM_SetupPwm(FTM_MODULE, ftmParam, 4U, kFTM_EdgeAlignedPwm, 50U, FTM_SOURCE_CLOCK);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM_StartTimer(FTM_MODULE, kFTM_FixedClock);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is that the definition FTM_SOURCE_CLOCK is equal to 32552, but looking at my clock settings, the value of FTM_SOURCE_CLOCK should be 390625.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below, is my clocks configurations.&amp;nbsp; Can you help me with this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&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="clock1.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/61291i2D31C67F3757C09C/image-size/large?v=v2&amp;amp;px=999" role="button" title="clock1.jpg" alt="clock1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="clock2.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/61734iE8C187DA397B6376/image-size/large?v=v2&amp;amp;px=999" role="button" title="clock2.jpg" alt="clock2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 23 Mar 2019 16:05:44 GMT</pubDate>
    <dc:creator>leandro_f_rocco</dc:creator>
    <dc:date>2019-03-23T16:05:44Z</dc:date>
    <item>
      <title>FTM0 clock configuration problem</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/FTM0-clock-configuration-problem/m-p/884353#M1665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I am using MCUXpresso IDE and FRDM-K64F board.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to configure four PWM channels using FTM0 at a frequency of 50hz. My definitions are the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define FTM_SOURCE_CLOCK CLOCK_GetFreq(kCLOCK_McgFixedFreqClk)&lt;/P&gt;&lt;P&gt;#define FTM_MODULE FTM0&lt;BR /&gt;#define PWM_CH0 0U&lt;BR /&gt;#define PWM_CH1 1U&lt;BR /&gt;#define PWM_CH2 2U&lt;BR /&gt;#define PWM_CH3 3U&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And my configuration code is the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftm_config_t ftmInfo;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftm_chnl_pwm_signal_param_t ftmParam[4];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[0].chnlNumber = (ftm_chnl_t)PWM_CH0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[0].level = kFTM_HighTrue;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[0].dutyCyclePercent = 5U;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[0].firstEdgeDelayPercent = 0U;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[1].chnlNumber = (ftm_chnl_t)PWM_CH1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[1].level = kFTM_HighTrue;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[1].dutyCyclePercent = 5U;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[1].firstEdgeDelayPercent = 0U;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[2].chnlNumber = (ftm_chnl_t)PWM_CH2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[2].level = kFTM_HighTrue;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[2].dutyCyclePercent = 5U;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[2].firstEdgeDelayPercent = 0U;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[3].chnlNumber = (ftm_chnl_t)PWM_CH3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[3].level = kFTM_HighTrue;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[3].dutyCyclePercent = 5U;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ftmParam[3].firstEdgeDelayPercent = 0U;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM_GetDefaultConfig(&amp;amp;ftmInfo);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM_Init(FTM_MODULE, &amp;amp;ftmInfo);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM_SetupPwm(FTM_MODULE, ftmParam, 4U, kFTM_EdgeAlignedPwm, 50U, FTM_SOURCE_CLOCK);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM_StartTimer(FTM_MODULE, kFTM_FixedClock);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is that the definition FTM_SOURCE_CLOCK is equal to 32552, but looking at my clock settings, the value of FTM_SOURCE_CLOCK should be 390625.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below, is my clocks configurations.&amp;nbsp; Can you help me with this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&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="clock1.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/61291i2D31C67F3757C09C/image-size/large?v=v2&amp;amp;px=999" role="button" title="clock1.jpg" alt="clock1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="clock2.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/61734iE8C187DA397B6376/image-size/large?v=v2&amp;amp;px=999" role="button" title="clock2.jpg" alt="clock2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Mar 2019 16:05:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/FTM0-clock-configuration-problem/m-p/884353#M1665</guid>
      <dc:creator>leandro_f_rocco</dc:creator>
      <dc:date>2019-03-23T16:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: FTM0 clock configuration problem</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/FTM0-clock-configuration-problem/m-p/884354#M1666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A _jive_internal="true" data-content-finding="Community" data-userid="328249" data-username="leandro_f_rocco@hotmail.com" href="https://community.nxp.com/people/leandro_f_rocco@hotmail.com"&gt;Leandro Fabián Rocco&lt;/A&gt; ,&lt;/P&gt;&lt;P&gt;I test on my side, configure the MCGFFCLK to 390.625KHZ, then get the freq using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;CLOCK_GetFreq(kCLOCK_McgFixedFreqClk);&lt;/P&gt;&lt;P&gt;the result is the same with Config tool:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/72849i8C3A547F4762B083/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&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_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/72798iB5F78C74E2126E00/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;You can send your project to me, I will help to check it .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2019 09:06:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/FTM0-clock-configuration-problem/m-p/884354#M1666</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2019-03-27T09:06:57Z</dc:date>
    </item>
  </channel>
</rss>

