<?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 Why does FTM_UpdatePwmDutycycle work but directly setting FTM2_C1V do nothing? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-does-FTM-UpdatePwmDutycycle-work-but-directly-setting-FTM2/m-p/831682#M50289</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm developing an application wherein we need finer granularity on the PWM output than a strict duty cycle (0-100) will give us.&amp;nbsp; I've run into a snag wherein directly setting the FTM2_C1V register seems to do nothing.&amp;nbsp; Calling `FTM_UpdatePwmDutycycle` followed by `FTM_SetSoftwareTrigger` works fine.&amp;nbsp; When I inspect these functions it appears that all `FTM_UpdatePwmDutycycle` basically does is set the value of FTMx_CnV, and `FTM_SetSoftwareTrigger` sets SYNC.&amp;nbsp; If I directly set FTM2_C1V in my code and then make the same call `&lt;SPAN&gt;FTM_SetSoftwareTrigger` nothing happens.&amp;nbsp; Why?&amp;nbsp; What do I need to do to get this working?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Works:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;FTM_UpdatePwmDutycycle(FTM2, (ftm_chnl_t)1, kFTM_EdgeAlignedPwm, dutyCycle);&lt;BR /&gt; FTM_SetSoftwareTrigger(FTM2, true);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does not work:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;FTM2-&amp;gt;CONTROLS[1].CnV = (uint32_t)cnt;&lt;BR /&gt;FTM_SetSoftwareTrigger(FTM2, true);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My FTM initialization follows the example in&amp;nbsp;ftm_pwm_twochannel.c&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Sep 2018 21:01:50 GMT</pubDate>
    <dc:creator>pcpro178</dc:creator>
    <dc:date>2018-09-17T21:01:50Z</dc:date>
    <item>
      <title>Why does FTM_UpdatePwmDutycycle work but directly setting FTM2_C1V do nothing?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-does-FTM-UpdatePwmDutycycle-work-but-directly-setting-FTM2/m-p/831682#M50289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm developing an application wherein we need finer granularity on the PWM output than a strict duty cycle (0-100) will give us.&amp;nbsp; I've run into a snag wherein directly setting the FTM2_C1V register seems to do nothing.&amp;nbsp; Calling `FTM_UpdatePwmDutycycle` followed by `FTM_SetSoftwareTrigger` works fine.&amp;nbsp; When I inspect these functions it appears that all `FTM_UpdatePwmDutycycle` basically does is set the value of FTMx_CnV, and `FTM_SetSoftwareTrigger` sets SYNC.&amp;nbsp; If I directly set FTM2_C1V in my code and then make the same call `&lt;SPAN&gt;FTM_SetSoftwareTrigger` nothing happens.&amp;nbsp; Why?&amp;nbsp; What do I need to do to get this working?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Works:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;FTM_UpdatePwmDutycycle(FTM2, (ftm_chnl_t)1, kFTM_EdgeAlignedPwm, dutyCycle);&lt;BR /&gt; FTM_SetSoftwareTrigger(FTM2, true);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does not work:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;FTM2-&amp;gt;CONTROLS[1].CnV = (uint32_t)cnt;&lt;BR /&gt;FTM_SetSoftwareTrigger(FTM2, true);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My FTM initialization follows the example in&amp;nbsp;ftm_pwm_twochannel.c&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 21:01:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-does-FTM-UpdatePwmDutycycle-work-but-directly-setting-FTM2/m-p/831682#M50289</guid>
      <dc:creator>pcpro178</dc:creator>
      <dc:date>2018-09-17T21:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why does FTM_UpdatePwmDutycycle work but directly setting FTM2_C1V do nothing?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-does-FTM-UpdatePwmDutycycle-work-but-directly-setting-FTM2/m-p/831683#M50290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jim Fell,&lt;/P&gt;&lt;P&gt;I can get it work on FRDM-K64F board, PWM waveform will change on PTB18 and PTB19 pins.&lt;BR /&gt;You can download the attached files and test it on FRDM-K64F board.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="ftm_pwm_twochannel.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/71006i8FE3458559AEED01/image-size/large?v=v2&amp;amp;px=999" role="button" title="ftm_pwm_twochannel.png" alt="ftm_pwm_twochannel.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&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>Tue, 18 Sep 2018 09:17:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-does-FTM-UpdatePwmDutycycle-work-but-directly-setting-FTM2/m-p/831683#M50290</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2018-09-18T09:17:34Z</dc:date>
    </item>
  </channel>
</rss>

