<?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: Timer accuracy issue in Other NXP Products</title>
    <link>https://community.nxp.com/t5/Other-NXP-Products/Timer-accuracy-issue/m-p/1411400#M13193</link>
    <description>&lt;P&gt;Hi sachin:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The PN7462 family IC provides four general-purpose timers. Timer0 and timer1 are 12bit timers at 3kz frequency . Timer2 and Timer3 are 32-bit at 20Mhz frequency， so timer2 and timer3 have a higher accuracy.&amp;nbsp; I would suggest you use timer2 or timer3.&lt;/P&gt;
&lt;P&gt;The Timer HAL provides APIs to manage the lifecycle of an HW timer.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielchen_0-1644449310105.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/170109i4167D2E86C36FAC0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="danielchen_0-1644449310105.png" alt="danielchen_0-1644449310105.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Feb 2022 23:28:53 GMT</pubDate>
    <dc:creator>danielchen</dc:creator>
    <dc:date>2022-02-09T23:28:53Z</dc:date>
    <item>
      <title>Timer accuracy issue</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/Timer-accuracy-issue/m-p/1402566#M13079</link>
      <description>&lt;P&gt;Hi everyone&lt;BR /&gt;I am trying to create a timer for 1000 milliseconds using TIMER0 in NXP PN7462 but it will generate a ~1050 milliseconds timer&lt;BR /&gt;and that will create an issue for me so help me to resolve this issue.&lt;/P&gt;&lt;P&gt;Here I share the code for that timer.&lt;/P&gt;&lt;P&gt;static void vAPP_TXTime_Off_Timer_Callback(void)&lt;BR /&gt;{&lt;BR /&gt;//GPIO LOW&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void vAPP_Timer0_ConfigureTimer (phhalTimer_Timers_t * psTimer,uint32_t dwTimePeriod, pphhalTimer_CallbackFun_t pCallBackFunc)&lt;BR /&gt;{&lt;BR /&gt;phStatus_t Status = PH_ERR_INVALID_PARAMETER;&lt;BR /&gt;//set callback function and time period&lt;BR /&gt;psTimer-&amp;gt;pCallBackFunc = pCallBackFunc;&lt;BR /&gt;psTimer-&amp;gt;dwTimePeriod = dwTimePeriod;&lt;/P&gt;&lt;P&gt;//Set fix count for 1 sec&lt;BR /&gt;psTimer-&amp;gt;dwTimeOutRegVal = 3412;//count for 1 sec&lt;BR /&gt;Status = PH_ERR_SUCCESS;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Timer_StartTimer (&lt;BR /&gt;phhalTimer_Timers_t * psTimer,&lt;BR /&gt;phhalTimer_Mode_t eRunMode)&lt;BR /&gt;{&lt;BR /&gt;phhalTimer_Regs_t *psTimerRegs;&lt;BR /&gt;phhalTimer_Id_t eTMode;&lt;BR /&gt;eTMode = psTimer-&amp;gt;bTimerId;&lt;/P&gt;&lt;P&gt;psTimerRegs = (phhalTimer_Regs_t *)(TIMERS_TIMER0_CONTROL_REG + (uint32_t)(eTMode * PHHAL_HWTIMER_REGS_SIZE));&lt;/P&gt;&lt;P&gt;psTimerRegs-&amp;gt;dwCtrlReg = (uint32_t)eRunMode;&lt;/P&gt;&lt;P&gt;/* set timeout wrt units. */&lt;BR /&gt;psTimerRegs-&amp;gt;dwTimeoutReg = psTimer-&amp;gt;dwTimeOutRegVal;&lt;/P&gt;&lt;P&gt;if (psTimer-&amp;gt;dwTimeOutRegVal)&lt;BR /&gt;{&lt;BR /&gt;/* Enable interrupt. */&lt;BR /&gt;PH_REG_SET(TIMERS_INT_SET_ENABLE_REG, (1UL &amp;lt;&amp;lt; eTMode) );&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return PH_ERR_SUCCESS;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void vAPP_Timer0_Start ( uint32_t dwTimerInterval, void *pTimerCallback )&lt;BR /&gt;{&lt;BR /&gt;uint32_t dwTimerVal = 0;&lt;BR /&gt;phhalTimer_Units_t eTimerUnit = E_TUNIT_MILLI_SECS;&lt;/P&gt;&lt;P&gt;// Check if the Timer Period passed in greater than specified milliseconds&lt;BR /&gt;// and needs to be converted into seconds.&lt;/P&gt;&lt;P&gt;if(dwTimerInterval &amp;gt; 4096)&lt;BR /&gt;{&lt;BR /&gt;dwAPP_Tx_Off_TimerInterval_Remaining = dwTimerInterval - 4096;&lt;BR /&gt;dwTimerVal = 4096;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;dwAPP_Tx_Off_TimerInterval_Remaining = 0;&lt;BR /&gt;dwTimerVal = dwTimerInterval;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Request the Timer 0&lt;BR /&gt;if (phAPP_Timer_RequestTimer0(eTimerUnit, &amp;amp;pstHAL_HostTxOffTimer) != PH_ERR_SUCCESS)&lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;// Configure the Timer with the Time Period and Call back&lt;BR /&gt;vAPP_Timer0_ConfigureTimer(pstHAL_HostTxOffTimer, dwTimerVal , (pphhalTimer_CallbackFun_t)pTimerCallback);&lt;/P&gt;&lt;P&gt;// Start the timer in free running mode&lt;BR /&gt;Timer_StartTimer(pstHAL_HostTxOffTimer, E_TIMER_FREE_RUNNING);&lt;/P&gt;&lt;P&gt;// Set the Timer Status as Timer Started&lt;BR /&gt;bAPP_Tx_Off_Timer_Status = 1;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;main()&lt;BR /&gt;{&lt;BR /&gt;//GPPIO HIGH&lt;BR /&gt;vAPP_Timer0_Start(3412,&amp;amp;vAPP_TXTime_Off_Timer_Callback)&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 10:24:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/Timer-accuracy-issue/m-p/1402566#M13079</guid>
      <dc:creator>sachin1296</dc:creator>
      <dc:date>2022-01-20T10:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Timer accuracy issue</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/Timer-accuracy-issue/m-p/1411400#M13193</link>
      <description>&lt;P&gt;Hi sachin:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The PN7462 family IC provides four general-purpose timers. Timer0 and timer1 are 12bit timers at 3kz frequency . Timer2 and Timer3 are 32-bit at 20Mhz frequency， so timer2 and timer3 have a higher accuracy.&amp;nbsp; I would suggest you use timer2 or timer3.&lt;/P&gt;
&lt;P&gt;The Timer HAL provides APIs to manage the lifecycle of an HW timer.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielchen_0-1644449310105.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/170109i4167D2E86C36FAC0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="danielchen_0-1644449310105.png" alt="danielchen_0-1644449310105.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 23:28:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/Timer-accuracy-issue/m-p/1411400#M13193</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2022-02-09T23:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Timer accuracy issue</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/Timer-accuracy-issue/m-p/1411778#M13203</link>
      <description>&lt;P&gt;Thanks, Daniel&amp;nbsp;&lt;/P&gt;&lt;P&gt;But timer 2 and timer 3 are used for another purpose in my code and I have to use timer 1. So please suggest any solution&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 11:04:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/Timer-accuracy-issue/m-p/1411778#M13203</guid>
      <dc:creator>sachin1296</dc:creator>
      <dc:date>2022-02-10T11:04:13Z</dc:date>
    </item>
  </channel>
</rss>

