<?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>LPC Microcontrollers中的主题 Re: Systick Reset or Recalibration</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Systick-Reset-or-Recalibration/m-p/527552#M9423</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by kwinchell on Fri Aug 30 11:44:59 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I found the problem. User error (of all things??)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like the systick timer works according to spec.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;K Winchell&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 19:28:12 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:28:12Z</dc:date>
    <item>
      <title>Systick Reset or Recalibration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Systick-Reset-or-Recalibration/m-p/527551#M9422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by kwinchell on Wed Aug 28 15:42:52 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an application that uses systick.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void Scheduler_Start(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC_SetPriority(PendSV_IRQn, 3);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __enable_irq();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SysTick-&amp;gt;CTRL = (1&amp;lt;&amp;lt;SYSTICK_CLKSOURCE) | (1&amp;lt;&amp;lt;SYSTICK_ENABLE) | (1&amp;lt;&amp;lt;SYSTICK_TICKINT); // enable the timer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void Scheduler_Init(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Disable the scheduler&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SysTick-&amp;gt;STCTRL = (uint8_t) 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetSchedulerPeriod();&amp;nbsp;&amp;nbsp; // set period to correct value for PCLK&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC_SetPriority(SysTick_IRQn, 3);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SchedulerTicks = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // the Scheduler Clock (SysTick) is ready to run, just needs to be enabled&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&amp;nbsp;&amp;nbsp; // end of function Scheduler_Init()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/***********************************************************************&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ** SetSchedulerPeriod&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; *&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; *&amp;nbsp; DESCRIPTION: Set the systick timer reload value to the correct value for the clock&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; *&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ***********************************************************************/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;void SetSchedulerPeriod(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SysTick-&amp;gt;STRELOAD = GetClocksPerMicrosecond() * SCHEDULER_TICK_TIME_US;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SysTick-&amp;gt;STCURR = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It all works fine, normally.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My application requires an interrupt event to resynchronize the period to the current event.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;According to the UM, this can be done by writing to System Timer Current value register (STCURR - 0xE000 E018)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The note is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;23:0 CURRENT Reading this register returns the current value of the System Tick&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;counter. Writing any value clears the System Tick counter and the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;COUNTFLAG bit in STCTRL.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Therefore I call SetSchedulerPeriod() to write to STCUR.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, my Systick time is set to 100uSec.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Therefore, I expect the next interrupt to occur at 100 uSec.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead, I get the interrupt at 125 uSec.&amp;nbsp; This is not a problem for me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that every once in a while, it happens in 25 uSec.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a MAJOR problem for me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Why is this happening?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. How can I get a consistant reset time?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:28:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Systick-Reset-or-Recalibration/m-p/527551#M9422</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Systick Reset or Recalibration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Systick-Reset-or-Recalibration/m-p/527552#M9423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by kwinchell on Fri Aug 30 11:44:59 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I found the problem. User error (of all things??)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like the systick timer works according to spec.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;K Winchell&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:28:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Systick-Reset-or-Recalibration/m-p/527552#M9423</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Systick Reset or Recalibration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Systick-Reset-or-Recalibration/m-p/527553#M9424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by kwinchell on Fri Aug 30 11:47:52 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I found the problem. User Error (of all things??)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like the systick timer works according to spec.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:28:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Systick-Reset-or-Recalibration/m-p/527553#M9424</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:28:13Z</dc:date>
    </item>
  </channel>
</rss>

