<?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: Kinetis FTM: Control triac with zero detection in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396731#M21857</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Arno,&lt;/P&gt;&lt;P&gt;It is dependent on the the waveform of the zero-crossing signal, if the zero-crossing signal can provide both rising edge in one AC cycle, of course, the FTM hardware triggering solution is okay. In detail, if the zero-crossing signal can generate a rising edge when the AC voltage crosses zero from negative to positive, while the zero-crossing signal can generate another rising edge when the AC voltage crosses zero from positive to negative voltage, the hardware triggering solution is okay. Can you provide two edge for the zero-crossing signal in on e AC cycle?&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>Tue, 14 Apr 2015 06:16:12 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2015-04-14T06:16:12Z</dc:date>
    <item>
      <title>Kinetis FTM: Control triac with zero detection</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396725#M21851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using a Kinetis K60.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to command a Triac with a specific delay after the Zero detection to adjust output power:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="triac.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/49770iC6AA53869319F63F/image-size/large?v=v2&amp;amp;px=999" role="button" title="triac.jpg" alt="triac.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To do this, I have a hardware which generate a pulse when signal is 0.&lt;/P&gt;&lt;P&gt;Then from this time, I must generate a pulse a (configurable) time after.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My first Idea was:&lt;/P&gt;&lt;P&gt;ZeroDetection pulse connected to an GPIO which generate an interrupt on the edge. In this interrupt, I get the FTM counter and Set CnV and Cn+1V (Combine mode) to generate a pulse of certain time in a controlled delay:&lt;/P&gt;&lt;P&gt;CnV = Current FTM + Delay&lt;/P&gt;&lt;P&gt;Cn+1V = Current FTM + Delay + Pulse wide&lt;/P&gt;&lt;P&gt;Generate IT on Cn1V compare to disable Output (ElsnA, ElsnB = 0)&lt;/P&gt;&lt;P&gt;Bad: Delay between input rise and Get FTM counter (due to interrupt save context time)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My second Idea was:&lt;/P&gt;&lt;P&gt;ZeroDetection pulse is connected on CH0 of FTMx. CH0 is configured in Capture Input mode and generate an interrupt.&lt;/P&gt;&lt;P&gt;In this interrupt, I have the Real timer value when input was Rised.&lt;/P&gt;&lt;P&gt;Then I made the same operation on FTMx (CH2+CH3)&lt;/P&gt;&lt;P&gt;CnV = Current FTM + Delay&lt;/P&gt;&lt;P&gt;Cn+1V = Current FTM + Delay + Pulse wide&lt;/P&gt;&lt;P&gt;Generate IT on Cn1V compare to disable Output (ElsnA, ElsnB = 0)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;But this system require software operation. (Input compare IT + calcul to set CnV and&amp;nbsp; Cn1V and then in Cn1V IT, disable output..)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are they a way to generate a pulse (with configurable wide) a certain time (configurable) after an input rise without any software intervention (except in initialization time)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;:smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; font-size: 11pt; mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: FR; mso-fareast-language: FR; mso-bidi-language: AR-SA;"&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 09:14:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396725#M21851</guid>
      <dc:creator>arnogir</dc:creator>
      <dc:date>2015-04-10T09:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Kinetis FTM: Control triac with zero detection</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396726#M21852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Setup up output compare with auto-reload to drive the output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the input to resynchronize output compare to the line, rather than fixed time from each zero crossing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In&amp;nbsp; the real world there will be extra zeros and missing zeros due to line noise; refrigerator coming on, lightning, person in next apartment arc welding who knows.&lt;/P&gt;&lt;P&gt;So only accept zero crossing inputs when you expect to get them.&amp;nbsp; In the end it ends up acting like a PLL to clean up the line signal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 15:38:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396726#M21852</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2015-04-10T15:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Kinetis FTM: Control triac with zero detection</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396727#M21853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Arno,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not know if you use tri-ac to control a universal motor or heater based on power resistor, but I think the an4609.pdf is very helpful, the an4609 describes how to control a universal motor with tri-ac as power device with low cost solution, if you control a heater based on power resistor with ac line, it is also helpful, the mechanism is the same.&lt;/P&gt;&lt;P&gt;The application note an4609 connects the zero-crossing signal to GPIO pin, the GPIO generates an interrupt, in the ISR of GPIO, launch a PIT timer which can control the firing angle. In the ISR of PIT, set up the reload register of PIT to a new value and set/clear another GPIO which can control of the width of the firing angle signal directly.&lt;/P&gt;&lt;P&gt;I think it is okay to use the FTM to generate the tri-ac gate signal rather than GPIO pin controlled by PIT as the application note.&lt;/P&gt;&lt;P&gt;As a simplest solution, as you know that the FTM supports hardware triggering mode, in this way, you can connect the zero-crossing signal to FTM hardware triggering pin, if you set up the FTM in combined mode( both the rising/falling edge of the FTM signal can be controlled), in other words, you can control both the delay(firing angle) and the width of the tri-ac gate triggering signal by FTM module only.&lt;/P&gt;&lt;P&gt;This is the website of&amp;nbsp; an4608.pdf.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A class="jive-link-external-small" href="http://tinyurl.com/llx697e" target="_blank"&gt;http://tinyurl.com/llx697e&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hope it can help you.&lt;/P&gt;&lt;P&gt;B R&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 03:04:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396727#M21853</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2015-04-13T03:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Kinetis FTM: Control triac with zero detection</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396728#M21854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Bob: I not fully understand your mind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@xiangjun:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;I think it is okay to use the FTM to generate the tri-ac gate signal rather than GPIO pin controlled by PIT as the application note.&lt;/P&gt;
&lt;P&gt;As a simplest solution, as you know that the FTM supports hardware triggering mode, in this way, you can connect the zero-crossing signal to FTM hardware triggering pin, if you set up the FTM in combined mode( both the rising/falling edge of the FTM signal can be controlled), in other words, you can control both the delay(firing angle) and the width of the tri-ac gate triggering signal by FTM module only.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hps"&gt;I do&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;not know if&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;I understand&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;your idea.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hps"&gt;I feel&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;that you&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;tell me&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;that it is&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;possible to&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;trigger&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the start&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;of the counter&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;on each&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;edge of an&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;input,&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;and then to&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;generate a&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;pulse&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;with &lt;/SPAN&gt;&lt;SPAN class="hps"&gt;combine mode.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hps"&gt;I do not know&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;technically&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;how to configure the&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;FTM&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;for it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hps"&gt;About my idea of my&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;first&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;post&lt;/SPAN&gt;, &lt;SPAN class="hps"&gt;the&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;problem I&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;encounter is&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;that the&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;registrer&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;values&lt;/SPAN&gt; are really set only when FTM &lt;SPAN class="hps"&gt;counter loop &lt;/SPAN&gt;&lt;SPAN class="hps"&gt;back to 0.&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;Or&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;I must&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;stop the&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;FTM&lt;/SPAN&gt; &lt;SPAN class="atn hps"&gt;(&lt;/SPAN&gt;Clk &lt;SPAN class="hps"&gt;= 0),&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;updates register and&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;restart.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hps"&gt;If you&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;think they can&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;do everything&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;in a simpler way&lt;/SPAN&gt;, &lt;SPAN class="hps"&gt;can&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;you tell me&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;briefly&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;&lt;/SPAN&gt;&lt;SPAN class="hps"&gt;registers values of&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;your idea?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;/SPAN&gt;:smileyhappy:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 06:09:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396728#M21854</guid>
      <dc:creator>arnogir</dc:creator>
      <dc:date>2015-04-13T06:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Kinetis FTM: Control triac with zero detection</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396729#M21855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Arno,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have checked the FTM module, I know that ONLY RISING edge of hardware triggering signal can trigger FTM to start counting, the falling edge of hardware triggering signal can not trigger FTM to start counting. I suppose you hope that the tri-ac works in both positive and negative cycles, in other words, one AC cycle can trigger FTM twice, so the FTM hardware triggering solution is NOT feasible.&lt;/P&gt;&lt;P&gt;Regarding your two solution, I think both solution are okay, both GPIO interrupt source and capture interrupt source supports rising/falling edge to trigger interrupt. In the ISR, you can initialize the FTM_CNT to zero by writting the FTM_CNT register directly, if you set up the FTM channel in COMBINED mode, you can set up the FTM_CnV register and FTM_Cn+1V register to control both the delay and width of the tri-ac gate signal, you can set up the FTM_MOD as maximum so that the PWM signal only generate one cycle.&lt;/P&gt;&lt;P&gt;The solution based on an4608 is okay.&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, 14 Apr 2015 04:16:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396729#M21855</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2015-04-14T04:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Kinetis FTM: Control triac with zero detection</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396730#M21856</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;Yes I want work in both positive and negative cycle.&lt;/P&gt;&lt;P&gt;But it is possible to obtain a positive edge on each by design an hardware zero crossing detection which provide positive edge on both. This is not a problem for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you seem say that it is possible to triggering start counter by&amp;nbsp; directly by hardware, without software. How do&amp;nbsp; it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 05:48:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396730#M21856</guid>
      <dc:creator>arnogir</dc:creator>
      <dc:date>2015-04-14T05:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Kinetis FTM: Control triac with zero detection</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396731#M21857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Arno,&lt;/P&gt;&lt;P&gt;It is dependent on the the waveform of the zero-crossing signal, if the zero-crossing signal can provide both rising edge in one AC cycle, of course, the FTM hardware triggering solution is okay. In detail, if the zero-crossing signal can generate a rising edge when the AC voltage crosses zero from negative to positive, while the zero-crossing signal can generate another rising edge when the AC voltage crosses zero from positive to negative voltage, the hardware triggering solution is okay. Can you provide two edge for the zero-crossing signal in on e AC cycle?&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>Tue, 14 Apr 2015 06:16:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396731#M21857</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2015-04-14T06:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Kinetis FTM: Control triac with zero detection</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396732#M21858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I will study an hardware solution to generate a rising edge in both zero crossing (Positive to negative and Negative to positive alternance).&lt;/P&gt;&lt;P&gt;I havn't yet looking for the solution, but I think this will be possible without any problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But today my problem is to know how configure the FTM to trig FTM counter without any Software intervention?? (Currently done in a keyboard interrupt from a generic GPIO PTA6)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 09:16:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396732#M21858</guid>
      <dc:creator>arnogir</dc:creator>
      <dc:date>2015-04-14T09:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Kinetis FTM: Control triac with zero detection</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396733#M21859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,Arno,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your zero-crossing circuit can generate two rising edges in one AC cycle, no problem to use FTM hardware triggering solution. For the K60, the FTM hardware triggering pins are predefined.&amp;nbsp; Pls refer to section 3.8.2.6 FTM Hardware Triggers in reference manual of K60. I copy it here:&lt;/P&gt;&lt;P&gt;assume that you use FTM0 module, the only FTM0 hardware triggering pin is FTM0_FLT0 pin, which is multiplexed with PTB3 or PTD6, in other words, if you use the solution, the zero-crossing signal has to be connected to PTB3 or PTD6.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.8.2.6 FTM Hardware Triggers&lt;/P&gt;&lt;P&gt;The FTM synchronization hardware triggers are connected in the chip as follows:&lt;/P&gt;&lt;P&gt;FTM0 hardware trigger 0 = CMP0 Output or FTM1 Match (when enabled in the&lt;/P&gt;&lt;P&gt;FTM1 External Trigger (EXTTRIG) register)&lt;/P&gt;&lt;P&gt;• FTM0 hardware trigger 1 = PDB channel 1 Trigger Output or FTM2 Match (when&lt;/P&gt;&lt;P&gt;enabled in the FTM2 External Trigger (EXTTRIG) register)&lt;/P&gt;&lt;P&gt;• FTM0 hardware trigger 2 = FTM0_FLT0 pin&lt;/P&gt;&lt;P&gt;• FTM1 hardware trigger 0 = CMP0 Output&lt;/P&gt;&lt;P&gt;• FTM1 hardware trigger 1 = CMP1 Output&lt;/P&gt;&lt;P&gt;• FTM1 hardware trigger 2 = FTM1_FLT0 pin&lt;/P&gt;&lt;P&gt;• FTM2 hardware trigger 0 = CMP0 Output&lt;/P&gt;&lt;P&gt;• FTM2 hardware trigger 1 = CMP2 Output&lt;/P&gt;&lt;P&gt;• FTM2 hardware trigger 2 = FTM2_FLT0 pin&lt;/P&gt;&lt;P&gt;For the triggers with more than one option, the SOPT4 register in the SIM module&lt;/P&gt;&lt;P&gt;controls the selection.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2015 03:13:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396733#M21859</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2015-04-15T03:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Kinetis FTM: Control triac with zero detection</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396734#M21860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok,&lt;/P&gt;&lt;P&gt;Then I can configure trigger by FTMx_FTL0 (trigger2)&lt;/P&gt;&lt;P&gt;So I have to configure FTMx_SYNC_TRIG2 = 1.&lt;/P&gt;&lt;P&gt;And so after?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So currently, bellow is the code I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;At init time:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;MODE_WPDIS + MODE_INIT set to 1&lt;/P&gt;&lt;P&gt;MODE_FTMEN set to 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SC =0 (To switch off all the FTM during intitializing)&lt;/P&gt;&lt;P&gt;CNTIN = 1&lt;/P&gt;&lt;P&gt;MOD = 65535&lt;/P&gt;&lt;P&gt;C0SC = 0&lt;/P&gt;&lt;P&gt;COMBINE_CONBINE0 + COMBINE_SYNCEN0 set to 1&amp;nbsp;&amp;nbsp; (I'm using Channel 0 + 1 to generate a pulse)&lt;/P&gt;&lt;P&gt;C0V = My specific value "Set pulse time"&lt;/P&gt;&lt;P&gt;C1V= My specific value "Clear pulse time"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;In a GPIO keyboard interrupt on which Zero Crossing signal is connected&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SC = 0 (To can change all value without wait FTM counter overflow to refresh register value due to synchronization)&lt;/P&gt;&lt;P&gt;C0SC |= ELSB_MASK ( to configure a pin set on C0V value match and a pin clear on C1V value match)&lt;/P&gt;&lt;P&gt;CNT = 0 ( To reset FTM counter)&lt;/P&gt;&lt;P&gt;SC = TOIE + CLKS(1) + PS(My div)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In TOIE interrupt à stop the Timer (SC = 0) but this can never occurs because Timer Overflow time is bigger than my Input Keyboard interrupt (Zero crossing).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The question is how do to make the work of the Keyboard interrupt directly by hardware (without software intervention) by using FTM_FLT0?&lt;/P&gt;&lt;P&gt;I think:&lt;/P&gt;&lt;P&gt;At init time, configure C0SC_ELSB to 1.&lt;/P&gt;&lt;P&gt;Add FTMx_SYNC_TRIG2 = 1&lt;/P&gt;&lt;P&gt;Configure SC = TOIE + CLKS(1) + PS(My div)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then counter will restart to 0&amp;nbsp; at each FTMx_FLT0 rising up.&lt;/P&gt;&lt;P&gt;I have true?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2015 06:12:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396734#M21860</guid>
      <dc:creator>arnogir</dc:creator>
      <dc:date>2015-04-15T06:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Kinetis FTM: Control triac with zero detection</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396735#M21861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Thank for your help.&lt;/P&gt;&lt;P&gt;Now it work correctly without any software except in initialization time &lt;IMG alt="Smiley Happy" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="https://community.nxp.com/i/smilies/16x16_smiley-happy.png" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bellow, the init code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14290861884796603" jivemacro_uid="_14290861884796603"&gt;
&lt;P&gt;/* Set up mode register */
 FTMx_MODE = FTM_MODE_WPDIS_MASK | FTM_MODE_INIT_MASK ; 
 /* FTMEN bit is write protected. Can be written only when WPDIS = 1 */&amp;nbsp; 
 FTMx_MODE |= FTM_MODE_FTMEN_MASK;&amp;nbsp; 

 /* Clear status and control register */
 FTMx_SC = (uint32_t)0x00UL;&amp;nbsp; 

 /* Clear counter initial register */
 FTMx_CNTIN = (uint32_t)0x01UL; /* Set to 1. By this way, if CnV And Cn1V = 0, ouput have no signal&amp;nbsp; 

 /* Set up modulo register */
 FTMx_MOD = (uint32_t)(MODULO-1);&amp;nbsp; 

 /* Set up channel status and control register */
 FTMx_CnV = 0;
 FTMx_Cn1V = 0;
 FTMx_CnSC |= FTM_CnSC_ELSB_MASK; /* To generate positive pulse */

 /* Set FTM_COMBINE_COMBINE{0,1,2,3}_MASK and FTM_COMBINE_SYNCEN{0,1,2,3}_MASK */
 FTMx_COMBINE |= ((FTM_COMBINE_COMBINE0_MASK + FTM_COMBINE_SYNCEN0_MASK) &amp;lt;&amp;lt; (i*8));

 /* To trig with Hardware Pin */
 FTMx_SYNCONF = FTM_SYNCONF_HWTRIGMODE_MASK | FTM_SYNCONF_SYNCMODE_MASK | FTM_SYNCONF_HWRSTCNT_MASK | FTM_SYNCONF_HWWRBUF_MASK;&amp;nbsp; 
 FTMx_SYNC = FTM_SYNC_TRIG2_MASK | FTM_SYNC_CNTMIN_MASK;

 /* FTM run normally in debbeguer */
 //debug AG FTMx_CONF |= FTM_CONF_BDMMODE(0x03); 

 /* Start FTM */
 FTMx_SC= (uint32_t)(FTM_SC_TOIE_MASK | FTM_SC_CLKS(1) | FTM_SC_PS(PRESCALER));&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:16:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-FTM-Control-triac-with-zero-detection/m-p/396735#M21861</guid>
      <dc:creator>arnogir</dc:creator>
      <dc:date>2020-11-02T13:16:38Z</dc:date>
    </item>
  </channel>
</rss>

