<?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: Delay using PIT driver</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900080#M2932</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 have used the same procedure above. I am facing an issue when multiple timer channels are configured. I am using 2 timer channels. one is configured using PIT component and other 1 is written using code as it is used for blocking delay of usec.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am using config tool to configure PIT component for channel 0 to generate a recurring delay of 25msec and have a ISR handler which clears the flag according to respective channel status.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have delay function below which uses channel 1 of PIT but channel 1 is not configured in PIT component. it is configured in below function.&lt;/P&gt;&lt;P&gt;void DelayUs(uint32_t usec){&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// /// Set channel 1 period to usec&lt;BR /&gt;// PIT_SetTimerPeriod(PIT, kPIT_Chnl_1, USEC_TO_COUNT(usec,PIT_SOURCE_CLOCK));&lt;BR /&gt;//&lt;BR /&gt;// /// Enable interrupts from channel 1&lt;BR /&gt;// PIT_EnableInterrupts(PIT, kPIT_Chnl_1, kPIT_TimerInterruptEnable);&lt;BR /&gt;//&lt;BR /&gt;// /// Start Timer&lt;BR /&gt;// PIT_StartTimer(PIT, kPIT_Chnl_1);&lt;BR /&gt;//&lt;BR /&gt;//&lt;BR /&gt;// /// Check for interrupt flag set in ISR handler&lt;BR /&gt;// &lt;STRONG&gt;while(!mainObject.usecFLG)&lt;/STRONG&gt;{&lt;BR /&gt;//&lt;BR /&gt;// status = PIT_GetStatusFlags(PIT, kPIT_Chnl_1);&lt;BR /&gt;// status &amp;amp;= 0x01 ;&lt;BR /&gt;// }&lt;BR /&gt;//&lt;BR /&gt;// mainObject.usecFLG = false ;&lt;BR /&gt;// /// Disable interrupts from channel 1&lt;BR /&gt;// PIT_DisableInterrupts(PIT, kPIT_Chnl_1, kPIT_TimerInterruptEnable);&lt;BR /&gt;//&lt;BR /&gt;// /// Stop Timer&lt;BR /&gt;// PIT_StopTimer(PIT, kPIT_Chnl_1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;common ISR handler which clears flags as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void PIT_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt; volatile uint32_t status ;&lt;/P&gt;&lt;P&gt;status = PIT_GetStatusFlags(PIT, kPIT_Chnl_0);&lt;BR /&gt; if(status &amp;amp; kPIT_TimerFlag){&lt;BR /&gt; PIT_ClearStatusFlags(PIT, kPIT_Chnl_0, kPIT_TimerFlag);&lt;BR /&gt; mainObject.runFLG = true ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;status = PIT_GetStatusFlags(PIT, kPIT_Chnl_1);&lt;BR /&gt;&amp;nbsp;if(status &amp;amp; kPIT_TimerFlag){&lt;BR /&gt;&amp;nbsp;PIT_ClearStatusFlags(PIT, kPIT_Chnl_1, kPIT_TimerFlag);&lt;BR /&gt;&amp;nbsp;mainObject.usecFLG = true ;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second channel which is configured in code by above delay function does not work in this case. the 25msec configured for channel 0 is continuously running ok and i get the status as 1 for channel 0 but not of channel 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;am calling the delay(100) in while loop as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While(1){&lt;/P&gt;&lt;P&gt;Delay(100);&lt;/P&gt;&lt;P&gt;some code to make pin low&lt;/P&gt;&lt;P&gt;Delay(100);&lt;/P&gt;&lt;P&gt;some code to make pin high&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 operation gets stuck in above highlighted line in bold&amp;nbsp;&lt;STRONG&gt;while(!mainObject.usecFLG) in delay function.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if i only keep the delay function and not the 25 msec recurring timer then delay function works and status is received ok.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;but if channel 0 and channel 1 are used together then delay function does not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please let me know what could be the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anuj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 May 2019 15:26:08 GMT</pubDate>
    <dc:creator>anujtanksali</dc:creator>
    <dc:date>2019-05-23T15:26:08Z</dc:date>
    <item>
      <title>Delay using PIT driver</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900076#M2928</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;Am using iMXRT1064 controller. I wanted to generate a blocking delay of msec or usec. where can i find the delay routines in the driver code. Any example would help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anuj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 May 2019 07:08:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900076#M2928</guid>
      <dc:creator>anujtanksali</dc:creator>
      <dc:date>2019-05-03T07:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Delay using PIT driver</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900077#M2929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Have you download RT1064 SDK. There is PIT example in SDK_2.5.0_EVK-MIMXRT1060\boards\evkmimxrt1060\driver_examples\pit&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>Sun, 05 May 2019 08:14:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900077#M2929</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2019-05-05T08:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Delay using PIT driver</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900078#M2930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for the reply. I have gone through the PIT driver but it uses an interrupt when timer count is over. i dont want to use interrupt.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my ex function would be&amp;nbsp;&lt;/P&gt;&lt;P&gt;Delayms(1000)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;loop 1000 times&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;call pit driver function which will wait for 1ms&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;how do i achieve this using pit driver or is there any other method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anuj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2019 08:51:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900078#M2930</guid>
      <dc:creator>anujtanksali</dc:creator>
      <dc:date>2019-05-09T08:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Delay using PIT driver</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900079#M2931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Then you have to poll TFLG register. After you start PIT, you keep polling TFLG until it become 1.&lt;/P&gt;&lt;P&gt;You can use PIT_GetStatusFlags to read TFLG.&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>Mon, 13 May 2019 06:20:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900079#M2931</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2019-05-13T06:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Delay using PIT driver</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900080#M2932</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 have used the same procedure above. I am facing an issue when multiple timer channels are configured. I am using 2 timer channels. one is configured using PIT component and other 1 is written using code as it is used for blocking delay of usec.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am using config tool to configure PIT component for channel 0 to generate a recurring delay of 25msec and have a ISR handler which clears the flag according to respective channel status.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have delay function below which uses channel 1 of PIT but channel 1 is not configured in PIT component. it is configured in below function.&lt;/P&gt;&lt;P&gt;void DelayUs(uint32_t usec){&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// /// Set channel 1 period to usec&lt;BR /&gt;// PIT_SetTimerPeriod(PIT, kPIT_Chnl_1, USEC_TO_COUNT(usec,PIT_SOURCE_CLOCK));&lt;BR /&gt;//&lt;BR /&gt;// /// Enable interrupts from channel 1&lt;BR /&gt;// PIT_EnableInterrupts(PIT, kPIT_Chnl_1, kPIT_TimerInterruptEnable);&lt;BR /&gt;//&lt;BR /&gt;// /// Start Timer&lt;BR /&gt;// PIT_StartTimer(PIT, kPIT_Chnl_1);&lt;BR /&gt;//&lt;BR /&gt;//&lt;BR /&gt;// /// Check for interrupt flag set in ISR handler&lt;BR /&gt;// &lt;STRONG&gt;while(!mainObject.usecFLG)&lt;/STRONG&gt;{&lt;BR /&gt;//&lt;BR /&gt;// status = PIT_GetStatusFlags(PIT, kPIT_Chnl_1);&lt;BR /&gt;// status &amp;amp;= 0x01 ;&lt;BR /&gt;// }&lt;BR /&gt;//&lt;BR /&gt;// mainObject.usecFLG = false ;&lt;BR /&gt;// /// Disable interrupts from channel 1&lt;BR /&gt;// PIT_DisableInterrupts(PIT, kPIT_Chnl_1, kPIT_TimerInterruptEnable);&lt;BR /&gt;//&lt;BR /&gt;// /// Stop Timer&lt;BR /&gt;// PIT_StopTimer(PIT, kPIT_Chnl_1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;common ISR handler which clears flags as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void PIT_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt; volatile uint32_t status ;&lt;/P&gt;&lt;P&gt;status = PIT_GetStatusFlags(PIT, kPIT_Chnl_0);&lt;BR /&gt; if(status &amp;amp; kPIT_TimerFlag){&lt;BR /&gt; PIT_ClearStatusFlags(PIT, kPIT_Chnl_0, kPIT_TimerFlag);&lt;BR /&gt; mainObject.runFLG = true ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;status = PIT_GetStatusFlags(PIT, kPIT_Chnl_1);&lt;BR /&gt;&amp;nbsp;if(status &amp;amp; kPIT_TimerFlag){&lt;BR /&gt;&amp;nbsp;PIT_ClearStatusFlags(PIT, kPIT_Chnl_1, kPIT_TimerFlag);&lt;BR /&gt;&amp;nbsp;mainObject.usecFLG = true ;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second channel which is configured in code by above delay function does not work in this case. the 25msec configured for channel 0 is continuously running ok and i get the status as 1 for channel 0 but not of channel 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;am calling the delay(100) in while loop as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While(1){&lt;/P&gt;&lt;P&gt;Delay(100);&lt;/P&gt;&lt;P&gt;some code to make pin low&lt;/P&gt;&lt;P&gt;Delay(100);&lt;/P&gt;&lt;P&gt;some code to make pin high&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 operation gets stuck in above highlighted line in bold&amp;nbsp;&lt;STRONG&gt;while(!mainObject.usecFLG) in delay function.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if i only keep the delay function and not the 25 msec recurring timer then delay function works and status is received ok.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;but if channel 0 and channel 1 are used together then delay function does not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please let me know what could be the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anuj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2019 15:26:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900080#M2932</guid>
      <dc:creator>anujtanksali</dc:creator>
      <dc:date>2019-05-23T15:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Delay using PIT driver</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900081#M2933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Sorry, I don't quite understand your meaning. Can you attach the whole code here?&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, 29 May 2019 05:58:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Delay-using-PIT-driver/m-p/900081#M2933</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2019-05-29T05:58:27Z</dc:date>
    </item>
  </channel>
</rss>

