<?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 Re: Creat a PWM Signal in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Creat-a-PWM-Signal/m-p/295086#M12074</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pascal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure about the FTM_CNTIN since I use only the FTM_CV (for the particular channel) to vary the PWM signal.&lt;/P&gt;&lt;P&gt;However, check the behaviour of the register FTM_CNTIN because writes to it are only propagated through to the counter under certain conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;when I would like to change the Period and change the mod register there isn't a PWM Signal anymore&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you mean when debugging and writing to registers to see the effect? If so, check the FTM_CONF register setting since it defines the behaviour of the FlexTimer in debug mode (it can be left to run or to freeze).&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>Sat, 12 Apr 2014 22:51:43 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2014-04-12T22:51:43Z</dc:date>
    <item>
      <title>Creat a PWM Signal</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Creat-a-PWM-Signal/m-p/295085#M12073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I hope anyone can help me....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all my facts:&lt;/P&gt;&lt;P&gt;I'm using &lt;SPAN style="font-size: 10pt;"&gt;CW V.1.4 (without PEX), to program a MK20DX128 (50MHz)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I would like to generate a PWM signal with selectable period and duty cycle. I thought it would &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;be very easy, so i did it like described in the datasheet:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 10pt;"&gt;PERIOD = (MOD-CNTIN+0x0001)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #ff0000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 10pt;"&gt;DUTY CYCLE = (CnV-CNTIN)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;void PWM_init(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTM0_C1SC&amp;nbsp; = 0x00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Clear the FTM0_C1SC register */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | FTM_CnSC_MSB_MASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Used for further selections in the channel logic */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | FTM_CnSC_ELSB_MASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Edge or Level Select */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | FTM_CnSC_ELSA_MASK;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Edge or Level Select */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTM0_SC = 0x00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&amp;nbsp; Clear the FTM0_SC register */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |FTM_SC_CLKS(0x01);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Selects the System clock */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTM0_CNTIN = FTM_CNTIN_INIT(0x0000);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Initialisation value */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTM0_CNT = FTM_CNT_COUNT(0x0000);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set counter register */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTM0_MOD = FTM_MOD_MOD(0x0000);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set up modulo register */ &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTM0_C1V = FTM_CnV_VAL(0x8000);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set up the duty cycle */&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case the duty cycle is 50% how expected... but there isn't any change when I change CNTIN_INIT....&lt;/P&gt;&lt;P&gt;were is my fault here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The next point is, when I would like to change the Period and change the mod register there isn't a PWM Signal anymore.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope anyone can help me :smileyhappy:&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2014 17:52:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Creat-a-PWM-Signal/m-p/295085#M12073</guid>
      <dc:creator>pascalschröer</dc:creator>
      <dc:date>2014-04-12T17:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creat a PWM Signal</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Creat-a-PWM-Signal/m-p/295086#M12074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pascal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure about the FTM_CNTIN since I use only the FTM_CV (for the particular channel) to vary the PWM signal.&lt;/P&gt;&lt;P&gt;However, check the behaviour of the register FTM_CNTIN because writes to it are only propagated through to the counter under certain conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;when I would like to change the Period and change the mod register there isn't a PWM Signal anymore&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you mean when debugging and writing to registers to see the effect? If so, check the FTM_CONF register setting since it defines the behaviour of the FlexTimer in debug mode (it can be left to run or to freeze).&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>Sat, 12 Apr 2014 22:51:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Creat-a-PWM-Signal/m-p/295086#M12074</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-04-12T22:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creat a PWM Signal</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Creat-a-PWM-Signal/m-p/295087#M12075</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;&amp;gt;&amp;gt;Do you mean when debugging and writing to registers to see the effect? If so, check the FTM_CONF register setting since it defines the behaviour of the FlexTimer in debug mode (it can be left to run or to freeze).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;No, I have changed the register before debugging...&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;I am not sure about the FTM_CNTIN since I use only the FTM_CV (for the particular channel) to vary the PWM signal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you changed the period too? Or did you only set the PWM duty cycle?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My main question is, what does the MOD register do? I can't understand the describtion in the datasheet...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;&lt;/P&gt;&lt;P&gt;The Modulo register contains the modulo value for the FTM counter. After the FTM&lt;/P&gt;&lt;P&gt;counter reaches the modulo value, the overflow flag (TOF) becomes set at the next clock,&lt;/P&gt;&lt;P&gt;and the next value of FTM counter depends on the selected counting method;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;This paragraph says that the timer counts until the MOD value is reached or?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;&lt;/P&gt;&lt;P&gt;The Counter Initial Value register contains the initial value for the FTM counter.&lt;/P&gt;&lt;P&gt;Writing to the CNTIN register latches the value into a buffer.&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;This paragraph says that the timer starts to count from the CNTIN register value or?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;&lt;/P&gt;&lt;P&gt;The CNT register contains the FTM counter value.&lt;/P&gt;&lt;P&gt;Reset clears the CNT register. Writing any value to COUNT updates the counter with its&lt;/P&gt;&lt;P&gt;initial value, CNTIN.&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;This paragraph says taht the CNT register shows the counter value at the moment or? So I &lt;/P&gt;&lt;P&gt;don't need to use this register?!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;&lt;/P&gt;&lt;P&gt;These registers contain the captured FTM counter value for the input modes or the match&lt;/P&gt;&lt;P&gt;value for the output modes.&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;Last but not least this register says that when I reach the FTM counter value the level is changed from high to low or otherwise or?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a fault in my interpretation?&lt;/P&gt;&lt;P&gt;&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;Pascal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Apr 2014 05:52:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Creat-a-PWM-Signal/m-p/295087#M12075</guid>
      <dc:creator>pascalschröer</dc:creator>
      <dc:date>2014-04-13T05:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creat a PWM Signal</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Creat-a-PWM-Signal/m-p/295088#M12076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pascal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check attached FlexTimer module conuter initial value update test code (especially at void FTM_Counter_Init () function).&lt;/P&gt;&lt;P&gt;Writing to the CNTIN register latches the value into a buffer. The CNTIN register is updated with the value of its write buffer according to Registers updated from write buffers.&lt;/P&gt;&lt;P&gt;More detailed info, please check MK20DX128 reference manual.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Wish it helps.&lt;BR /&gt; &lt;BR /&gt;Best regards,&lt;BR /&gt;Ma Hui&lt;/P&gt;&lt;P&gt;&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>Tue, 15 Apr 2014 09:36:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Creat-a-PWM-Signal/m-p/295088#M12076</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2014-04-15T09:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creat a PWM Signal</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Creat-a-PWM-Signal/m-p/295089#M12077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, and thanks to all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have solved the problem. The MOD register was too small for the CnV register value, so there was not any PWM signal. Very easy, but I have spent a lot of time to find this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pascal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2014 14:30:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Creat-a-PWM-Signal/m-p/295089#M12077</guid>
      <dc:creator>pascalschröer</dc:creator>
      <dc:date>2014-04-15T14:30:00Z</dc:date>
    </item>
  </channel>
</rss>

