<?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: IMXRT1024 PIT GetCurrentTimerCount in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/IMXRT1024-PIT-GetCurrentTimerCount/m-p/1346441#M180645</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/187781"&gt;@Lukas_Frank&lt;/a&gt;&amp;nbsp;；&lt;/P&gt;
&lt;P&gt;PIT_GetCurrentTimerCount is used to read current timer counting value.&lt;/P&gt;
&lt;P&gt;COUNT_TO_USEC is used to convert a raw count alue to microsecond.&lt;/P&gt;
&lt;P&gt;Please see below line for the usage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;uint32_t usecVal = COUNT_TO_USEC((uint64_t)PIT_GetCurrentTimerCount(DEMO_PIT_BASEADDR, DEMO_PIT_CHANNEL), PIT_SOURCE_CLOCK);&lt;BR /&gt;PRINTF("\r\n useVal is %d",usecVal);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielchen_0-1632712735758.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/157427i6F9836E3083CA279/image-size/medium?v=v2&amp;amp;px=400" role="button" title="danielchen_0-1632712735758.png" alt="danielchen_0-1632712735758.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Mon, 27 Sep 2021 03:23:24 GMT</pubDate>
    <dc:creator>danielchen</dc:creator>
    <dc:date>2021-09-27T03:23:24Z</dc:date>
    <item>
      <title>IMXRT1024 PIT GetCurrentTimerCount</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/IMXRT1024-PIT-GetCurrentTimerCount/m-p/1341599#M180245</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just want to try use Periodic Interrupt Timer in my board. I was only changed/added below lines in default SDK example(pit).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;volatile uint32_t globalCounter = 0; //new line for test&lt;/LI-CODE&gt;&lt;LI-CODE lang="c"&gt;void PIT_LED_HANDLER(void)
{
    /* Clear interrupt flag.*/
    PIT_ClearStatusFlags(DEMO_PIT_BASEADDR, DEMO_PIT_CHANNEL, kPIT_TimerFlag);
    pitIsrFlag = true;
    globalCounter++; //new line for test
    __DSB();
}&lt;/LI-CODE&gt;&lt;LI-CODE lang="c"&gt;...
..
.    
/* Start channel 0 */
PRINTF("\r\nStarting channel No.0 ...");
PIT_StartTimer(DEMO_PIT_BASEADDR, DEMO_PIT_CHANNEL);

uint64_t startVal = PIT_GetCurrentTimerCount(DEMO_PIT_BASEADDR, DEMO_PIT_CHANNEL);
while (true)                                                                              
{                                                                                         
    /* Check whether occur interupt and toggle LED */                                     
    if (true == pitIsrFlag &amp;amp;&amp;amp; globalCounter &amp;lt; 6)                                          
    {                                                                                     
        PRINTF("\r\n Channel No.0 interrupt is occurred !");                              
        LED_TOGGLE();                                                                     
        pitIsrFlag = false;                                                               
    }                                                                                     
    if(globalCounter &amp;gt;= 6)//new lines below                                                         
    {                                                                                     
    	uint64_t endVal = PIT_GetCurrentTimerCount(DEMO_PIT_BASEADDR, DEMO_PIT_CHANNEL);  
    	uint64_t resultVal = endVal - startVal;                                           
    	uint64_t usecVal = COUNT_TO_USEC(resultVal, PIT_SOURCE_CLOCK);                    
    }                                                                                     
}                                                                                         
                                                                                          &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am just waiting for usecVal will be equal to the 5 sec so about 5000000 mikrosecond. I am just trying to use ticks for chronometer usage in my project. But in this code neither usecVal is equal 5sec or resultVal is equal to tick corresponding 5sec after run the project. What is wrong with that? All codes belowed in attachment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and Regards.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 13:09:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/IMXRT1024-PIT-GetCurrentTimerCount/m-p/1341599#M180245</guid>
      <dc:creator>Lukas_Frank</dc:creator>
      <dc:date>2021-09-16T13:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: IMXRT1024 PIT GetCurrentTimerCount</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/IMXRT1024-PIT-GetCurrentTimerCount/m-p/1346441#M180645</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/187781"&gt;@Lukas_Frank&lt;/a&gt;&amp;nbsp;；&lt;/P&gt;
&lt;P&gt;PIT_GetCurrentTimerCount is used to read current timer counting value.&lt;/P&gt;
&lt;P&gt;COUNT_TO_USEC is used to convert a raw count alue to microsecond.&lt;/P&gt;
&lt;P&gt;Please see below line for the usage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;uint32_t usecVal = COUNT_TO_USEC((uint64_t)PIT_GetCurrentTimerCount(DEMO_PIT_BASEADDR, DEMO_PIT_CHANNEL), PIT_SOURCE_CLOCK);&lt;BR /&gt;PRINTF("\r\n useVal is %d",usecVal);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielchen_0-1632712735758.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/157427i6F9836E3083CA279/image-size/medium?v=v2&amp;amp;px=400" role="button" title="danielchen_0-1632712735758.png" alt="danielchen_0-1632712735758.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 03:23:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/IMXRT1024-PIT-GetCurrentTimerCount/m-p/1346441#M180645</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2021-09-27T03:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: IMXRT1024 PIT GetCurrentTimerCount</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/IMXRT1024-PIT-GetCurrentTimerCount/m-p/1349098#M180888</link>
      <description>&lt;P&gt;Hi Dear&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/369"&gt;@danielchen&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate for your supports.&lt;/P&gt;&lt;P&gt;Best Regards.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 11:11:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/IMXRT1024-PIT-GetCurrentTimerCount/m-p/1349098#M180888</guid>
      <dc:creator>Lukas_Frank</dc:creator>
      <dc:date>2021-09-30T11:11:38Z</dc:date>
    </item>
  </channel>
</rss>

