<?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>Kinetis MicrocontrollersのトピックRe: FTM counter reset / start couting on external trigger event?</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611170#M36133</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I attach the an5142.pdf&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Nov 2016 06:08:01 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2016-11-22T06:08:01Z</dc:date>
    <item>
      <title>FTM counter reset / start couting on external trigger event?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611168#M36131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;currently I'm trying to port an application from a MC56F847 controller to a Kinetis V4x controller. Therefore I need and an FTM counter to start counting based on an the beginning of an PWM cycle / signal. After two configureable delays I need to enable two outputs (independently).&lt;/P&gt;&lt;P&gt;So here is my concept so far:&lt;/P&gt;&lt;P&gt;- PWM generation: PWMA_0A -&amp;gt; PWMA0_TRG0&lt;/P&gt;&lt;P&gt;- Connection between PWM &amp;amp; FTM component: PWMA_A0_TRG0 -&amp;gt; over xbar -&amp;gt; FTM0_TRIG2&lt;/P&gt;&lt;P&gt;- Two channels as output compar mode: FTM0_CH0 &amp;amp; FTM0_CH1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use the following code o initializ the timer component:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ftmConfig.extTriggers =kFTM_Chnl0Trigger;&lt;BR /&gt;ftmConfig.chnlInitState =0;&lt;BR /&gt;ftmConfig.pwmSyncMode =kFTM_HardwareTrigger_2;&lt;BR /&gt;if (FTM_Init(FTM0, &amp;amp;ftmConfig) != kStatus_Success)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FTM_SetupOutputCompare(FTM0, kFTM_Chnl_0, kFTM_SetOnMatch, 1000);&lt;/P&gt;&lt;P&gt;FTM0-&amp;gt;SYNC |= (1&amp;lt;&amp;lt;2);&amp;nbsp;&amp;nbsp; &amp;nbsp;// reinit&lt;BR /&gt;FTM0-&amp;gt;CNTIN =0U;&lt;BR /&gt;FTM0-&amp;gt;MOD =0xFFFFU;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here the problem begins. If I now enable the timer via FTM_StartTimer(...) it starts counting and the channel 0 output will be set after a while. Is it possible start the counting when the signal TRIG2 occurs? The other problem is, that the counter currently just overflows and starts counting from zero again - but it should stop counting and reset the outputs to their initial values - is that possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Florian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Nov 2016 08:34:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611168#M36131</guid>
      <dc:creator>florianharmuth</dc:creator>
      <dc:date>2016-11-21T08:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: FTM counter reset / start couting on external trigger event?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611169#M36132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Florian,&lt;/P&gt;&lt;P&gt;I think your solution is okay.&lt;/P&gt;&lt;P&gt;You have the PWMA_0A triggering signals(XBARA_IN20 or PWMA0_TRG0)&amp;nbsp; route to FTM0_TRIG2(XBARA_OUT34) via crossbar, and use the FTM0_TRIG2 to synchronize FTM0 counter. You can set the FTM0 MOD register as the maximum value 0xFFFF, when the FTM0_TRIG2 signal arrives, the FTM counter FTM0_CNT register is initialized by the FTM0_CNTIN register, the FTM0_CNT will begin to count from the FTM0_CNTIN value. The FTM_StartTimer(...) function only sets the CLKS bits in FTM0_SC register so that the FTM0_CNT begins to count. As I said the FTM0_CNT will be initialized with FTM0_CNTIN value when the rising edge of FTM0_TRIG2 comes.&lt;/P&gt;&lt;P&gt;I suggest you refer to an5142, which has the code for hardware triggering.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2016 06:06:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611169#M36132</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2016-11-22T06:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: FTM counter reset / start couting on external trigger event?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611170#M36133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I attach the an5142.pdf&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2016 06:08:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611170#M36133</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2016-11-22T06:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: FTM counter reset / start couting on external trigger event?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611171#M36134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i think counter will count till MOD value. In this case MOD is 0xFFFF so it will count till max value. try changing MOD value to your desired value&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2016 06:22:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611171#M36134</guid>
      <dc:creator>sumitnandi</dc:creator>
      <dc:date>2016-11-22T06:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: FTM counter reset / start couting on external trigger event?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611172#M36135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello XiangJun,&lt;/P&gt;&lt;P&gt;thanks for your fast response. I have tried the exmaple in chapter 3.11.4 (Updating the FTM register with hardware control) which was the base for my previous tests. I have used the code from the application note with only one change - I have to use FTM0_FLT1 instead of FTM0_FLT0. I can't get the example running...I have also attached the a screenshot of the signals. The yellow one show the input signal of FTM0_FLT1 (GC0) and the green one show the signal of PTC1 - you can see that the rising edge of the yellow signal is ignored by the timer component. Any suggestions / ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Florian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;CODE&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLOCK_EnableClock(kCLOCK_PortC);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;CLOCK_EnableClock(kCLOCK_Ftm0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;PORT_SetPinMux(PORTC, 0u, kPORT_MuxAlt6);&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// FTM0_FLT1 (alt6) on PTC0&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;PORT_SetPinMux(PORTC, 1u, kPORT_MuxAlt4);&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// FTM0_CH0 on PTC1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;PORT_SetPinMux(PORTC, 2u, kPORT_MuxAlt4);&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// FTM0_CH1 on PTC2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// configure hardware trigger&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SIM-&amp;gt;SOPT4 &amp;amp;=~(SIM_SOPT4_FTM0FLT1_MASK);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;SYNC |= 0x40;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// enable hw trigger 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;SYNCONF |= 0x30001;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// configure PWM on FTM0_CH0/1 (PTC1/2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CONF=0xC0; //set up BDM in 11&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;FMS=0x00; //clear the WPEN so that WPDIS is set in FTM0_MODE reg&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;MODE|=0x05; //enable write the FTM CnV register&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;MOD=1000;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CONTROLS[0].CnSC=0x28; //High_Low_High for center-alignment&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CONTROLS[1].CnSC=0x28; //High_Low_High for center-alignment&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;COMBINE|=0x20; //enable update the FTM_C0V/FTM0_C1V register&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;COMBINE|=0x02; //complementary mode for CH0&amp;amp;CH1 of FTM0&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;COMBINE|=0x10; // dead timer insertion enabled in complementary mode for //CH0&amp;amp;CH1 of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;DEADTIME=0x00; //dead time is 0 system clock cycles&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CONTROLS[1].CnV=500;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CONTROLS[0].CnV=500;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CNTIN=0x00;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;SC=0x28; //PWM center_alignment, system clock driving, dividing by 1&lt;/P&gt;&lt;P&gt;&amp;lt;/CODE&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image32363.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/10129iBDB5C705A29BA65E/image-size/large?v=v2&amp;amp;px=999" role="button" title="image32363.png" alt="image32363.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2016 08:16:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611172#M36135</guid>
      <dc:creator>florianharmuth</dc:creator>
      <dc:date>2016-11-23T08:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: FTM counter reset / start couting on external trigger event?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611173#M36136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello sumit,&lt;/P&gt;&lt;P&gt;thanks for your response but the overflow itself isn't the problem - the hardware trigger doesn't work as expected which should reset the counter long time before the overlfow happens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Florian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2016 08:23:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611173#M36136</guid>
      <dc:creator>florianharmuth</dc:creator>
      <dc:date>2016-11-23T08:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: FTM counter reset / start couting on external trigger event?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611174#M36137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Florian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suppose that you can NOT use FTM0_FLT1(PTC0) as hardware triggering signal. Pls refer to sectin 39.1.6 FTM Hardware Triggers in the reference manual of KV4x, only XBARA_OUT34 can be used as FTM0 hardware triggering source2. If you want to use external signal as FTM0 hardware triggering source2, you can connect the signal to any XB_INx pin and route the signal to XBARA_OUT34.&lt;/P&gt;&lt;P&gt;for example, you can connect the external triggering signal to PTC5/XBAR0_IN2&lt;/P&gt;&lt;P&gt;CLOCK_EnableClock(kCLOCK_PortC);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;PORT_SetPinMux(PORTC, 5u, kPORT_MuxAlt4);&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; //PTC5 as XBAR0_IN2/ALT4&lt;/P&gt;&lt;P&gt;XBARA_SEL17&amp;amp;=~(0x3F);&lt;/P&gt;&lt;P&gt;XBARA_SEL17|=0x02; //route the XBAR0_IN2 to XBARA_OUT34.&lt;/P&gt;&lt;P&gt;If you use the PWMA_0A triggering signal&lt;/P&gt;&lt;P&gt;XBARA_SEL17&amp;amp;=~(0x3F);&lt;/P&gt;&lt;P&gt;XBARA_SEL17|=20; //route the PWMA0_TRG0 to XBARA_OUT34.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it can help you&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Nov 2016 03:31:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611174#M36137</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2016-11-24T03:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: FTM counter reset / start couting on external trigger event?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611175#M36138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello XiangJun,&lt;/P&gt;&lt;P&gt;thanks again for your fast response. After changing the trigger signal as explained the synchronization wasn't working (xbarin-xbarout34 and the direct soultion (pwma0_trig0 - xbarout34)). After reading the reference manual again and again I have found the comment "only the enhanced PWM synchronization must be used" - so my gues is that the legacy PWM mode shouldn't be used on this device right? I have changed the corresponding bit in the SYSCONF register and now its working. I have attached the working code - if someone else will have the same issue in the future....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Florian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;CODE&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLOCK_EnableClock(kCLOCK_PortC);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;CLOCK_EnableClock(kCLOCK_Ftm0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORT_SetPinMux(PORTC, 1u, kPORT_MuxAlt4);&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; // FTM0_CH0 on PTC1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;PORT_SetPinMux(PORTC, 2u, kPORT_MuxAlt4);&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; // FTM0_CH1 on PTC2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;XBARA_SetSignalsConnection(XBARA, kXBARA_InputPwm0Trg0, kXBARA_OutputFtm0Trig2);&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// connect&amp;nbsp;&amp;nbsp; kXBARA_InputPwm0Trg0 to kXBARA_OutputFtm0Trig2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// configure hardware trigger&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SIM-&amp;gt;SOPT4 |= (SIM_SOPT4_FTM0TRG2SRC_MASK);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;SYNC |= 0x40;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // enable hw trigger 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;SYNCONF |= 0x30081;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// configure PWM on FTM0_CH0/1 (PTC1/2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CONF=0xC0; //set up BDM in 11&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;FMS=0x00; //clear the WPEN so that WPDIS is set in FTM0_MODE reg&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;MODE|=0x05; //enable write the FTM CnV register&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;MOD=2000;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CONTROLS[0].CnSC=0x28; //High_Low_High for center-alignment&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CONTROLS[1].CnSC=0x28; //High_Low_High for center-alignment&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;COMBINE|=0x20; //enable update the FTM_C0V/FTM0_C1V register&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;COMBINE|=0x02; //complementary mode for CH0&amp;amp;CH1 of FTM0&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;COMBINE|=0x10; // dead timer insertion enabled in complementary mode for //CH0&amp;amp;CH1 of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;DEADTIME=0x00; //dead time is 0 system clock cycles&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CONTROLS[1].CnV=500;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CONTROLS[0].CnV=500;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;CNTIN=0x00;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTM0-&amp;gt;SC=0x08; // system clock driving, dividing by 1&lt;/P&gt;&lt;P&gt;&amp;lt;/CODE&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Nov 2016 08:05:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-counter-reset-start-couting-on-external-trigger-event/m-p/611175#M36138</guid>
      <dc:creator>florianharmuth</dc:creator>
      <dc:date>2016-11-24T08:05:38Z</dc:date>
    </item>
  </channel>
</rss>

