<?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 CnV Update Problem 2 in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2267521#M68112</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, I got another problem, i previously ask and got solve it is the LDOK register that i was wrong&lt;/P&gt;&lt;P&gt;but even after solving that it still not doing what i ask that is to update the CnV and change the Pulse width please help me this is that code i have been working on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;#include "MKE02Z4.h"

#define FTM_MOD     24      // 25 ticks → 1.25us @ 20MHz
#define TICKS_0      7
#define TICKS_1     14

void FTM_Init(void)
{
    SIM-&amp;gt;SCGC |= SIM_SCGC_FTM2_MASK;

    FTM2-&amp;gt;MODE = FTM_MODE_WPDIS_MASK | FTM_MODE_FTMEN_MASK;

    FTM2-&amp;gt;CNTIN = 0;
    FTM2-&amp;gt;CNT   = 0;
    FTM2-&amp;gt;MOD   = FTM_MOD;

    FTM2-&amp;gt;CONTROLS[0].CnSC =
        FTM_CnSC_MSB_MASK |
        FTM_CnSC_ELSB_MASK;

    FTM2-&amp;gt;CONTROLS[0].CnV = TICKS_0;

    /* ENABLE CHANNEL OUTPUT (CRITICAL) */
    FTM2-&amp;gt;OUTMASK &amp;amp;= ~(1 &amp;lt;&amp;lt; 0);

    /* Initial load */
    *(volatile __UINT32_TYPE__ *)0x4003A098 = 0x0201;

    FTM2-&amp;gt;SC = FTM_SC_CLKS(1) | FTM_SC_PS(0);

    *(volatile __UINT32_TYPE__ *)0x4003A064 = 0x00;
}

static inline void wait_ftm_period(void)
{
    while(!(FTM2-&amp;gt;SC &amp;amp; FTM_SC_TOF_MASK));
    FTM2-&amp;gt;SC &amp;amp;= ~FTM_SC_TOF_MASK;
}

uint32_t word = 0x5555;

int main(void)
{
    FTM_Init();

    while (1)
    {
        for(int i = 0; i &amp;lt; 16; i++)
        {
            if (word &amp;amp; (1UL &amp;lt;&amp;lt; i))
                *(volatile __UINT32_TYPE__ *)0x4003A010 = TICKS_1;
            else
            	*(volatile __UINT32_TYPE__ *)0x4003A010 = TICKS_0;

            /* ARM reload for next PWM cycle */
            *(volatile __UINT32_TYPE__ *)0x4003A098 = 0x0201;

            /* WAIT ONE PWM PERIOD */
            wait_ftm_period();
        }
    }
}&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 22 Dec 2025 08:31:47 GMT</pubDate>
    <dc:creator>Jana_muralidharan</dc:creator>
    <dc:date>2025-12-22T08:31:47Z</dc:date>
    <item>
      <title>FTM CnV Update Problem 2</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2267521#M68112</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, I got another problem, i previously ask and got solve it is the LDOK register that i was wrong&lt;/P&gt;&lt;P&gt;but even after solving that it still not doing what i ask that is to update the CnV and change the Pulse width please help me this is that code i have been working on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;#include "MKE02Z4.h"

#define FTM_MOD     24      // 25 ticks → 1.25us @ 20MHz
#define TICKS_0      7
#define TICKS_1     14

void FTM_Init(void)
{
    SIM-&amp;gt;SCGC |= SIM_SCGC_FTM2_MASK;

    FTM2-&amp;gt;MODE = FTM_MODE_WPDIS_MASK | FTM_MODE_FTMEN_MASK;

    FTM2-&amp;gt;CNTIN = 0;
    FTM2-&amp;gt;CNT   = 0;
    FTM2-&amp;gt;MOD   = FTM_MOD;

    FTM2-&amp;gt;CONTROLS[0].CnSC =
        FTM_CnSC_MSB_MASK |
        FTM_CnSC_ELSB_MASK;

    FTM2-&amp;gt;CONTROLS[0].CnV = TICKS_0;

    /* ENABLE CHANNEL OUTPUT (CRITICAL) */
    FTM2-&amp;gt;OUTMASK &amp;amp;= ~(1 &amp;lt;&amp;lt; 0);

    /* Initial load */
    *(volatile __UINT32_TYPE__ *)0x4003A098 = 0x0201;

    FTM2-&amp;gt;SC = FTM_SC_CLKS(1) | FTM_SC_PS(0);

    *(volatile __UINT32_TYPE__ *)0x4003A064 = 0x00;
}

static inline void wait_ftm_period(void)
{
    while(!(FTM2-&amp;gt;SC &amp;amp; FTM_SC_TOF_MASK));
    FTM2-&amp;gt;SC &amp;amp;= ~FTM_SC_TOF_MASK;
}

uint32_t word = 0x5555;

int main(void)
{
    FTM_Init();

    while (1)
    {
        for(int i = 0; i &amp;lt; 16; i++)
        {
            if (word &amp;amp; (1UL &amp;lt;&amp;lt; i))
                *(volatile __UINT32_TYPE__ *)0x4003A010 = TICKS_1;
            else
            	*(volatile __UINT32_TYPE__ *)0x4003A010 = TICKS_0;

            /* ARM reload for next PWM cycle */
            *(volatile __UINT32_TYPE__ *)0x4003A098 = 0x0201;

            /* WAIT ONE PWM PERIOD */
            wait_ftm_period();
        }
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 22 Dec 2025 08:31:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2267521#M68112</guid>
      <dc:creator>Jana_muralidharan</dc:creator>
      <dc:date>2025-12-22T08:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: FTM CnV Update Problem 2</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2267535#M68113</link>
      <description>&lt;P&gt;Hey I am the writer of the post And i am working in the WS2812B so i though of using PWM to generate the signal so that why thing thing of changing the Duty cycle so and i want to know Is it possible to do that with this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Dec 2025 08:46:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2267535#M68113</guid>
      <dc:creator>Jana_muralidharan</dc:creator>
      <dc:date>2025-12-22T08:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: FTM CnV Update Problem 2</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2267892#M68118</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/258109"&gt;@Jana_muralidharan&lt;/a&gt;&amp;nbsp;]&lt;/P&gt;
&lt;DIV&gt;I'm sorry, I'm a bit confused. Are you asking how to change the duty cycle of the PWM, or are you asking why your duty cycle changed?&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Thank you.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;BR&lt;/DIV&gt;
&lt;DIV&gt;Alice&lt;/DIV&gt;</description>
      <pubDate>Tue, 23 Dec 2025 02:33:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2267892#M68118</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2025-12-23T02:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: FTM CnV Update Problem 2</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2268517#M68122</link>
      <description>Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/27788"&gt;@Alice_Yang&lt;/a&gt;,&lt;BR /&gt;Yeah i am trying to change the PWM duty cycle for every cycle like for 1st period 30% duty cycle then in the 2nd period 70% duty cycle like that&lt;BR /&gt;&lt;BR /&gt;Is there any procedure to change the PWM duty change&lt;BR /&gt;&lt;BR /&gt;It just stuck at the initially set value that the issue here</description>
      <pubDate>Wed, 24 Dec 2025 06:50:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2268517#M68122</guid>
      <dc:creator>Jana_muralidharan</dc:creator>
      <dc:date>2025-12-24T06:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: FTM CnV Update Problem 2</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2268657#M68123</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/258109"&gt;@Jana_muralidharan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;Please use the &lt;CODE&gt;FTM_UpdatePwmDutycycle()&lt;/CODE&gt; API to update the PWM duty cycle.&lt;/DIV&gt;
&lt;DIV&gt;For more details, refer to the &lt;CODE&gt;ftm_simple_pwm&lt;/CODE&gt; demo, where the PWM duty cycle is periodically updated.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV style="background-color: #ffffff; padding: 0px 0px 0px 2px;"&gt;
&lt;DIV style="color: #000000; background-color: #ffffff; font-family: 'Courier New'; font-size: 10pt; white-space: pre;"&gt;
&lt;BLOCKQUOTE&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt;/*!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * brief Updates the duty cycle of an active PWM signal.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; *&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;param&lt;/SPAN&gt;&lt;SPAN&gt; base FTM peripheral base address&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;param&lt;/SPAN&gt;&lt;SPAN&gt; chnlNumber The channel/channel pair number. In combined mode, this represents&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * the channel pair number&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;param&lt;/SPAN&gt;&lt;SPAN&gt; currentPwmMode The current PWM mode set during PWM setup&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;param&lt;/SPAN&gt;&lt;SPAN&gt; dutyCyclePercent New PWM pulse width; The value should be between 0 to 100&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * 0=inactive signal(0% duty cycle)...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * 100=active signal (100% duty cycle)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * return kStatus_Success if the PWM update was successful&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * kStatus_Error on failure&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt;status_t&lt;/SPAN&gt; &lt;SPAN&gt;FTM_UpdatePwmDutycycle&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FTM_Type&lt;/SPAN&gt;&lt;SPAN&gt; *base,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt;ftm_chnl_t&lt;/SPAN&gt;&lt;SPAN&gt; chnlNumber,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt;ftm_pwm_mode_t&lt;/SPAN&gt;&lt;SPAN&gt; currentPwmMode,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN&gt; dutyCyclePercent)&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P style="margin: 0;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;BR&lt;/DIV&gt;
&lt;DIV&gt;Alice&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Dec 2025 10:08:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2268657#M68123</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2025-12-24T10:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: FTM CnV Update Problem 2</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2269086#M68126</link>
      <description>But can you please tell me, in how much cycle that the PWM updates</description>
      <pubDate>Fri, 26 Dec 2025 04:32:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2269086#M68126</guid>
      <dc:creator>Jana_muralidharan</dc:creator>
      <dc:date>2025-12-26T04:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: FTM CnV Update Problem 2</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2269122#M68127</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/258109"&gt;@Jana_muralidharan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;This depends on your application. You can refer to your requirement design.&lt;/DIV&gt;
&lt;DIV&gt;Regarding this SDK demo, it uses a timer overflow interrupt to update the PWM duty cycle.&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Alice_Yang_0-1766732600601.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/371223i55C338270FCC583E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Alice_Yang_0-1766732600601.png" alt="Alice_Yang_0-1766732600601.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 26 Dec 2025 07:03:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-CnV-Update-Problem-2/m-p/2269122#M68127</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2025-12-26T07:03:30Z</dc:date>
    </item>
  </channel>
</rss>

