<?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: How to synchronize two FTM modules? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-synchronize-two-FTM-modules/m-p/829296#M50109</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found the most effective way to synchronize two FTM modules whose moduli are related by an integer multiple is to use the Global Time Base.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example to synchronize FTM0 (MOD = 4095) and FTM3 (MOD = 65535, free-running):&lt;/P&gt;&lt;P&gt;1. Initialize the FTM counters you wish to synchronize&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;FTM_Init(FTM_0_PERIPHERAL, &amp;amp;FTM_0_config);&lt;/P&gt;&lt;P&gt;FTM_Init(FTM_3_PERIPHERAL, &amp;amp;FTM_3_config);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;where the config struct for &lt;EM&gt;both&lt;/EM&gt; FTM0 and FTM3 includes the following:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;const ftm_config_t FTM_0_config = {&lt;BR /&gt;// make sure to set the config option:&lt;BR /&gt; .useGlobalTimeBase = true&lt;BR /&gt;};&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;2. enable the clock source for both modules&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;FTM_StartTimer(FTM_0_PERIPHERAL, kFTM_SystemClock);&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FTM_StartTimer(FTM_0_PERIPHERAL, kFTM_SystemClock);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;(note: this doesn't actually start the FTM counters, it just sets them in a "ready" state to await the Global Time Base start trigger).&lt;/P&gt;&lt;P&gt;3. set the Global Time Base output&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;FTM_SetGlobalTimeBaseOutputEnable(FTM_0_PERIPHERAL, true);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I found that only FTM0 can serve as the master GTB out source (I am using a K64).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Sep 2018 19:26:53 GMT</pubDate>
    <dc:creator>aberger</dc:creator>
    <dc:date>2018-09-17T19:26:53Z</dc:date>
    <item>
      <title>How to synchronize two FTM modules?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-synchronize-two-FTM-modules/m-p/829294#M50107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to synchronize two FTM modules (e.g. FTM0 and FTM1) on a K64, such that a CNT = CNTIN event on FTM1 also forces CNT = CNTIN on FTM0. Specifically, I have setup FTM1 as a free-running counter (MOD = 0xFFFF) and FTM0 with MOD = 0xFFF (i.e. FTM0 should rollover 16 times for every rollover of FTM1).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FTM1 is set to generate an external trigger whenever its counter is updated with CNTIN (which is set to 0), and FTM0 is set to receive this trigger, causing a PWM sync (pwmSyncMode = kFTM_HardwareTrigger_0). [see attached peripherals.c code, generated by MCUXpresso Config Tools]. I have also set up FTM0 hardware trigger source to be driven by the FTM1 hardware trigger [see attached pin_mux.c].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, it does not appear that the rollover events are in-fact synchronized. In the attached FTM_Synchro.c code, I am generating a GPIO output toggle on each rollover (GPIOB_Pin9 toggles on FTM0 rollovers, and GPIOB_Pin10 toggles on FTM1 rollovers). By putting a variable delay between the FTM0 and FTM1 timer start events (i.e. adding or removing a printf statement between the FTM_StartTimer calls for the two timers), I can see that the synchronization is not working (specifically, I measure a 1 µs delay when the FTM_StartTimer events are back-to-back, and a 13&amp;nbsp;&lt;SPAN&gt;µs delay when the printf statement is inserted between the two calls).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a more effective way to implement FTM synchronization?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2018 18:29:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-synchronize-two-FTM-modules/m-p/829294#M50107</guid>
      <dc:creator>aberger</dc:creator>
      <dc:date>2018-07-19T18:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to synchronize two FTM modules?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-synchronize-two-FTM-modules/m-p/829295#M50108</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 think your path is ok. I found there is another similar question in community. It&amp;nbsp;could give you some help.&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/message/854291?commentID=854291#comment-854291"&gt;https://community.nxp.com/message/854291?commentID=854291#comment-854291&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And&amp;nbsp;there is an application note&amp;nbsp;AN4560 which should also helpful.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.nxp.com/docs/en/application-note/AN4560.pdf"&gt;https://www.nxp.com/docs/en/application-note/AN4560.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jul 2018 09:59:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-synchronize-two-FTM-modules/m-p/829295#M50108</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2018-07-25T09:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to synchronize two FTM modules?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-synchronize-two-FTM-modules/m-p/829296#M50109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found the most effective way to synchronize two FTM modules whose moduli are related by an integer multiple is to use the Global Time Base.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example to synchronize FTM0 (MOD = 4095) and FTM3 (MOD = 65535, free-running):&lt;/P&gt;&lt;P&gt;1. Initialize the FTM counters you wish to synchronize&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;FTM_Init(FTM_0_PERIPHERAL, &amp;amp;FTM_0_config);&lt;/P&gt;&lt;P&gt;FTM_Init(FTM_3_PERIPHERAL, &amp;amp;FTM_3_config);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;where the config struct for &lt;EM&gt;both&lt;/EM&gt; FTM0 and FTM3 includes the following:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;const ftm_config_t FTM_0_config = {&lt;BR /&gt;// make sure to set the config option:&lt;BR /&gt; .useGlobalTimeBase = true&lt;BR /&gt;};&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;2. enable the clock source for both modules&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;FTM_StartTimer(FTM_0_PERIPHERAL, kFTM_SystemClock);&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FTM_StartTimer(FTM_0_PERIPHERAL, kFTM_SystemClock);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;(note: this doesn't actually start the FTM counters, it just sets them in a "ready" state to await the Global Time Base start trigger).&lt;/P&gt;&lt;P&gt;3. set the Global Time Base output&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;FTM_SetGlobalTimeBaseOutputEnable(FTM_0_PERIPHERAL, true);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I found that only FTM0 can serve as the master GTB out source (I am using a K64).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 19:26:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-synchronize-two-FTM-modules/m-p/829296#M50109</guid>
      <dc:creator>aberger</dc:creator>
      <dc:date>2018-09-17T19:26:53Z</dc:date>
    </item>
  </channel>
</rss>

