<?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>i.MX RT Crossover MCUsのトピックRe: Problem with simultaneous QTMR interrupts</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Problem-with-simultaneous-QTMR-interrupts/m-p/859353#M1968</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh yes, that makes sense.&lt;/P&gt;&lt;P&gt;Thanks for your helpful suggestions, I hadn't noticed the CSCTRL[TCF1] flag.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Seimon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Mar 2019 09:48:54 GMT</pubDate>
    <dc:creator>seimonwilliams</dc:creator>
    <dc:date>2019-03-05T09:48:54Z</dc:date>
    <item>
      <title>Problem with simultaneous QTMR interrupts</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Problem-with-simultaneous-QTMR-interrupts/m-p/859351#M1966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using a QTMR to capture an input. But I've noticed that if I have both the Compare and Edge interrupts enabled then, if both interrupts happen very close together, sometimes one of them isn't processed in my ISR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a sample code. I started with the MCUXpresso i.MX RT1050 qtmr_timer sample.&lt;/P&gt;&lt;P&gt;TMR3.Timer0 is the primary timer that is used to capture the input.&lt;/P&gt;&lt;P&gt;TMR3.Timer1 is simulating my external hardware that is generating interrupts approx every 100us. It's output pin is fed back into Timer0's input capture pin.&lt;/P&gt;&lt;P&gt;TMR3.Timer2 has the same period as Timer0, but has the output enabled for debug on the oscilloscope.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the ISR, if the Compare flag is set then for debug I also toggle a GPIO pin - this should follow the Timer2 output pin.&lt;/P&gt;&lt;P&gt;I've noticed that this GPIO pin sometimes doesn't toggle, this always seems to be when the Edge and Compare happen very close together.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The attached png file shows the scope waveform. Overview at the top and zoomed-in in the main area.&lt;/P&gt;&lt;P&gt;Blue is the Input Trigger / Timer1 output.&lt;/P&gt;&lt;P&gt;Yellow is Timer2 output. At this point the Purple should have gone high, but didn't until the next Compare interrupt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something not right with my ISR, or is this a known behaviour of the QTMR interrupts / status flags?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2019 17:13:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Problem-with-simultaneous-QTMR-interrupts/m-p/859351#M1966</guid>
      <dc:creator>seimonwilliams</dc:creator>
      <dc:date>2019-02-28T17:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with simultaneous QTMR interrupts</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Problem-with-simultaneous-QTMR-interrupts/m-p/859352#M1967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Seimon,&lt;/P&gt;&lt;P&gt;It seems this is a driver problem. QTMR_ClearStatusFlags() is used to clear status flag. No matter which flag should be cleared, it always write something both to SCTRL and CSCTRL.This is a problem. For example, line 465 read SCTRL, at this time IEF didn't come. But after several step, IEF come and reg don't know. So, at line 481, a zero is written to IEF. Then this interrupt is disappear.&lt;/P&gt;&lt;P&gt;My suggestion is&lt;/P&gt;&lt;P&gt;1. Split QTMR_ClearStatusFlags() into QTMR_ClearSCTRLStatusFlags() and QTMR_ClearCSCTRLStatusFlags().&lt;/P&gt;&lt;P&gt;2. Don't use SCTRL[IEF] and SCTRL[TCF] together. They are in same register and improper writting will cover each other. You can use SCTRL[IEF]+CSCTRL[TCF1].&lt;/P&gt;&lt;P&gt;3. Split QTMR_GetStatus() into QTMR_GetSCTRLStatus() and QTMR_GetCSCTRLStatus()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the isr code should looks like:&lt;/P&gt;&lt;P&gt;void TMRx_IRQHandler(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (QTMR_GetSCTRLStatus())&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QTMR_ClearSCTRLStatusFlags()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (QTMR_GetCSCTRLStatus())&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QTMR_ClearCSCTRLStatusFlags()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll report this problem. Hope we can see any improvement in next SDK version.&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>Tue, 05 Mar 2019 08:59:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Problem-with-simultaneous-QTMR-interrupts/m-p/859352#M1967</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2019-03-05T08:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with simultaneous QTMR interrupts</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Problem-with-simultaneous-QTMR-interrupts/m-p/859353#M1968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh yes, that makes sense.&lt;/P&gt;&lt;P&gt;Thanks for your helpful suggestions, I hadn't noticed the CSCTRL[TCF1] flag.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Seimon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2019 09:48:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Problem-with-simultaneous-QTMR-interrupts/m-p/859353#M1968</guid>
      <dc:creator>seimonwilliams</dc:creator>
      <dc:date>2019-03-05T09:48:54Z</dc:date>
    </item>
  </channel>
</rss>

