<?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: Re: FTM Mode &amp;quot;Enable DMA&amp;quot; K60 in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273137#M9497</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;I'm using one channel in input capture mode. I also tried dual edge capture mode by combining two channels. The timer module is the same for all channels. When I receive ir code, I have to count number of rising edges in a pulstrain, and if the time between the pulstrains.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could store the count value raw in an array&amp;nbsp; when a input occour or I could store the difference from rising edge to rising edge in an array, it doesn't matter. I just need to store it without missing an input or missing an overflow. &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Using DMA seems to be the only solution, but I really need some basic examples of how to set it up. How to read and write date to memory and how to trigger DMA on overflow, so that I don't have to count it in ISR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kennet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Oct 2013 13:04:13 GMT</pubDate>
    <dc:creator>kenrenjen</dc:creator>
    <dc:date>2013-10-23T13:04:13Z</dc:date>
    <item>
      <title>FTM Mode "Enable DMA" K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273131#M9491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hi&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I'm working on a K60 MCU and I have tried to use DMA along with a flextimer.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I can see in the manual that the mode for the flextimer can be set to enable DMA. Nothing else is mentioned about this using flextimers.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I've tried several guides and examples, but they are hard to understand.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I have no clue how to implement DMA, but I understand the principles. Is there a very basic example out there, where for instance when an rising edge occur the value of the counter can be transferred by DMA? Or can anyone take me through step-by-step how to implement it.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;In my head, when the K60 offers the opportunity to enable DMA for flextimer by a single bit, it shouldn't be so hard to setup as the DMA-ADC example.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I'm using uTasker and I posted my code beneath. I hope someone can help me out, I've been stuck to this for weeks now.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Thanks in advance.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13814017499203632" jivemacro_uid="_13814017499203632" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;void ftm_init(void)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; POWER_UP(6, SIM_SCGC6_FTM0); // Enable clock &lt;/P&gt;
&lt;P&gt;&amp;nbsp; PORTC_PCR1 = PC_1_FTM0_CH0; // Multiplexer (MUX) for flextimer (FTM) initialized to port FTM0 and channel 0&amp;nbsp; (route the desired signal to the pin)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; FTM0_MODE = (FTM_MODE_WPDIS | FTM_MODE_FTMEN); // Disable write protection&lt;/P&gt;
&lt;P&gt;&amp;nbsp; FTM0_CONF = FTM_CONF_BDMMODE_3; // FTM_DEBUG_BEHAVIOUR: Allow timer to continue operating when debugging&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; FTM0_COMBINE = ( FTM_COMBINE_COMBINE0 | FTM_COMBINE_DECAPEN0 | FTM_COMBINE_DECAP0 ); // Channels combined, Dual edge capture enabled and activated.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; FTM0_CNTIN = 0x0000; // Counter initial value&lt;/P&gt;
&lt;P&gt;&amp;nbsp; FTM0_MOD = 0xFFFF; // Modulo to max&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // Capture set to rising edge (ELSB:ELSA = 0:1) and Mode set to continious (MSA:MSB = 1:0) on both channels&lt;/P&gt;
&lt;P&gt;&amp;nbsp; FTM0_C0SC = (FTM_CSC_ELSA | FTM_CSC_MSA | FTM_CSC_DMA);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; FTM0_C1SC = (FTM_CSC_ELSA | FTM_CSC_MSA | FTM_CSC_DMA | FTM_CSC_CHIE);&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; FTM0_SC = (FTM_SC_CLKS_SYS | FTM_SC_PS_1 | FTM_SC_TOIE); // Sets the source to system clock and define the prescalar. Timer overflow interrupt enabled (1)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; fnEnterInterrupt(irq_FTM0_ID, PRIORITY_HW_TIMER, ftm0_isr); //Configure and enter the ftm0 handling interrupt routine in the vector table &lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 10:46:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273131#M9491</guid>
      <dc:creator>kenrenjen</dc:creator>
      <dc:date>2013-10-10T10:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Mode "Enable DMA" K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273132#M9492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jensen Kenneth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; We don't have the example about FTM with DMA based on K60, but I think, in you code,if you want to use FTM DMA transfer, you not only need to enable FTMx_CnSC[DMA], but also you need to configure the DMA MUX and DMA controller module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, you should to configure the DMA MUX to choose the request source, eg, you configure DMAMUX_CHCFGn, enable DMA channel by bit [ENBL] ,choose DMA Channel Source by register[SOURECE], you can find the request source from according reference manual,souce number=24 is FTM0 channel0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, you should to configure DMA controller, details you can find in reference manual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3,enable the FTM channel DMA by FTMX_CnSC[DMA].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Actually, in the Kinetis Peripheral Module Quick Reference,there has a chapter to describe how to configure DMA and the steps.&lt;/P&gt;&lt;P&gt; the Kinetis Peripheral Module Quick Reference:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://cache.freescale.com/files/32bit/doc/quick_ref_guide/KQRUG.pdf?fpsp=1&amp;amp;WT_TYPE=Quick"&gt;http://cache.freescale.com/files/32bit/doc/quick_ref_guide/KQRUG.pdf?fpsp=1&amp;amp;WT_TYPE=Quick&lt;/A&gt; Reference Guides&amp;amp;WT_VENDOR=FREESCALE&amp;amp;WT_FILE_FORMAT=pdf&amp;amp;WT_ASSET=Documentation&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can refer to the chapter 7:enhanced direct memory access controller.&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.1.4 Configuration steps.&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;Best regards!&lt;/P&gt;&lt;P&gt;Jing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Oct 2013 07:24:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273132#M9492</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2013-10-14T07:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Mode "Enable DMA" K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273133#M9493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply. I was wondering if it is possible to trigger the DMA channel whenever a timer overflow has appeared to count the number of overflows.&lt;/P&gt;&lt;P&gt;The reason for this is that I will eleminate number of ISR request, becouse I have two interrupts in the same routine, channel and overflow. &lt;/P&gt;&lt;P&gt;I was thinking that it would be the most efficient solution instead of trigger DMA whenever a channel interrupt appears.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kenneth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 09:02:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273133#M9493</guid>
      <dc:creator>kenrenjen</dc:creator>
      <dc:date>2013-10-21T09:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Re: FTM Mode "Enable DMA" K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273134#M9494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kenneth,&lt;/P&gt;&lt;P&gt;The FTM can generate an interrupt on overflow per the Reference Manual for K60:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The generation of an interrupt when the counter overflows&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="JA" style="font-family: TimesLTStd-Roman; font-size: 10pt;"&gt;&lt;SPAN lang="JA" style="font-family: TimesLTStd-Roman;"&gt;The FTMx_SC[TOIE] bit does this.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you could set the MOD register to 0xFFFF.&lt;/P&gt;&lt;P&gt;The code attached can play with FTM in Polled or Interrupt mode and you can set the MOD to whatever you want.&lt;/P&gt;&lt;P&gt;Just place it in the following path to play with:&lt;/P&gt;&lt;P&gt;C:\Freescale\Freescale_MQX_4_0_2_GA\mqx\examples\timer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 14:05:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273134#M9494</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2013-10-21T14:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Re: FTM Mode "Enable DMA" K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273135#M9495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for you reply. I think you misunderstood my problem. I know that the timer can generate an interrupt by setting the TOF..&lt;/P&gt;&lt;P&gt;What I want is to eleminate numbers of interrupts and do the "counting" without locking the CPU.&lt;/P&gt;&lt;P&gt;The reason for this is that I have a channel interrupt in the same vector and I have problem triggering all channel interrupts if they happen after or before the overflow, without overloading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be more specifig. I am recording time between rising edges, on up to 500kzh IR signals. The timer overflows every 546uS (system clock = 120mHz) and I get channel interrupt every 2uS.&lt;/P&gt;&lt;P&gt;The think the "easiest" way to eleminate&lt;SPAN style="text-decoration: underline;"&gt; number of interrupts&lt;/SPAN&gt; is by counting the timer overflows in a register using DMA. The other solution could be to store all times when a channel interrupt appers in registers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kenneth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2013 06:15:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273135#M9495</guid>
      <dc:creator>kenrenjen</dc:creator>
      <dc:date>2013-10-22T06:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Re: FTM Mode "Enable DMA" K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273136#M9496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kenneth,&lt;/P&gt;&lt;P&gt;You are right.&amp;nbsp; I didn't understand the question.&lt;/P&gt;&lt;P&gt;Thank you for elaborating.&lt;/P&gt;&lt;P&gt;How many timing input channels are you using?&amp;nbsp; Are all channels used to the same FTMx module or are multiple FTMx modules being used?&lt;/P&gt;&lt;P&gt;I think your idea of using DMA is good idea.&lt;/P&gt;&lt;P&gt;Once you record the time between rising edges, how soon do you have to do something based on that information?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2013 15:12:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273136#M9496</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2013-10-22T15:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Re: FTM Mode "Enable DMA" K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273137#M9497</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;I'm using one channel in input capture mode. I also tried dual edge capture mode by combining two channels. The timer module is the same for all channels. When I receive ir code, I have to count number of rising edges in a pulstrain, and if the time between the pulstrains.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could store the count value raw in an array&amp;nbsp; when a input occour or I could store the difference from rising edge to rising edge in an array, it doesn't matter. I just need to store it without missing an input or missing an overflow. &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Using DMA seems to be the only solution, but I really need some basic examples of how to set it up. How to read and write date to memory and how to trigger DMA on overflow, so that I don't have to count it in ISR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kennet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 13:04:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Mode-quot-Enable-DMA-quot-K60/m-p/273137#M9497</guid>
      <dc:creator>kenrenjen</dc:creator>
      <dc:date>2013-10-23T13:04:13Z</dc:date>
    </item>
  </channel>
</rss>

