<?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: LPC1114 Timer resolution issue</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545360#M13052</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Tue Jan 27 10:23:06 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: jschimpf255&lt;/STRONG&gt;&lt;BR /&gt;...have given me much to do with the scope.&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Looking at the disassembly of your interrupt will surprise you how many cycles are required to set / reset your pin&amp;nbsp; :O &lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 19:45:15 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:45:15Z</dc:date>
    <item>
      <title>LPC1114 Timer resolution issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545356#M13048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by jschimpf255 on Mon Jan 26 11:30:14 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I am using the the 32 bit timer03 in the chip with a 48 MHz clock, minimum resolution with a prescale of 1 should be about 20 ns.&amp;nbsp; I am attempting to generate ticks at about 500 ns. I set it up like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_TIMER_Init(LPC_TIMER32_0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* Timer rate is system clock rate */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;timerFreq = Chip_Clock_GetSystemClockRate();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Set up for match at 500 ns intervals&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_TIMER_Reset(LPC_TIMER32_0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_TIMER_PrescaleSet(LPC_TIMER32_0, 1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_TIMER_MatchEnableInt(LPC_TIMER32_0, 1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;val = (timerFreq /2000000);// 500.0 nsec = 48,000,000/2,000,000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_TIMER_SetMatch(LPC_TIMER32_0, 1, val);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_TIMER_ResetOnMatchEnable(LPC_TIMER32_0, 1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_TIMER_Enable(LPC_TIMER32_0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* Enable timer interrupt */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NVIC_ClearPendingIRQ(TIMER_32_0_IRQn);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The match value is 24 which should give me the 500 ns ticks I need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using this in a&amp;nbsp; program running under FreeRtos. I want to get 4 500 ns ticks to generate a waveform then I disable the timer till I need it again. I start it like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_TIMER_Reset(LPC_TIMER32_0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NVIC_EnableIRQ(TIMER_32_0_IRQn);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It then begins to call an interrupt routine.&amp;nbsp; In that routine for testing now, I have it turn on GPIO 7 on entrance and then turn it off on exit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run this and observe the GPIO 7 toggles on a scope I cannot get less than about 2.5 micro second period between the toggles. (this is trying all sorts of smaller values than 24 also)&amp;nbsp; Is there some overhead in FreeRtos should I be using a different timer # or the 16 bit timers ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;--jim schimpf&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:45:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545356#M13048</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1114 Timer resolution issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545357#M13049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by starblue on Tue Jan 27 03:06:56 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Your processor is not fast enough for that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fcommunity.arm.com%2Fdocs%2FDOC-2607" rel="nofollow" target="_blank"&gt;http://community.arm.com/docs/DOC-2607&lt;/A&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:45:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545357#M13049</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1114 Timer resolution issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545358#M13050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by jschimpf255 on Tue Jan 27 10:07:18 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for the very useful article.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From the article there are about 16 (15 ?) cycles of latency for the LPC1114 which is about 320 ns.&amp;nbsp; Also looking at the example in the LPC1114 manual (21.8.1 figure 81) they show an interrupt happening in 12 clock cycles (~ 240 ns). This should mean with those settings I should be able to generate an interrupt in 560 ns or even faster with prescale = 1.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The closest&amp;nbsp; time between ticks I can get is about 1400 ns.&amp;nbsp; Is there additional software overhead beyond 16 cycles of latency ? Should I try to run this with FreeRtos turned off or up the priority of my timer interrupt ?&amp;nbsp; I realize the latency puts a lower limit of about 320 ns but I would like to get closer than 1400 ns.&amp;nbsp; Also my interrupt routine is very bare bones doing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void TIMER32_0_IRQHandler(void)&amp;nbsp; &amp;lt;- 16 cycles of latency to here right ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// Clear status &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_TIMER_ClearMatch(LPC_TIMER32_0, 1);&amp;nbsp;&amp;nbsp; &amp;lt;- This point timer should start next count ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Blip scope&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetPinState(LPC_GPIO, 0, 7, 1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetPinState(LPC_GPIO, 0, 7, 0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&amp;nbsp;&amp;nbsp; &amp;lt;-- Does this take another 16 cycles ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On the scope the blip is very short and there is a relatively long time before the next one.&amp;nbsp; I.e. &amp;gt; 500 ns before the next one.&amp;nbsp; (sorry don't have a picture but I can get one later.)&amp;nbsp; I will put blip markers around the clear match routine and see how long that takes.&amp;nbsp; I should set the GPIO 7 high on entrance and low on exit to see how long the int routine really takes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And perhaps enable the external interrupt so I can see what that occurs and that would measure the latency.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wow, you and the article have given me much to do with the scope.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you again for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;--jim schimpf&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:45:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545358#M13050</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1114 Timer resolution issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545359#M13051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheFallGuy on Tue Jan 27 10:14:15 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't forget that the article assumes a 'perfect' (0 wait-state) memory system. When running from flash, you are going to introduce some wait states (1?) and pipeline flushes (when doing a branch etc).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:45:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545359#M13051</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1114 Timer resolution issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545360#M13052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Tue Jan 27 10:23:06 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: jschimpf255&lt;/STRONG&gt;&lt;BR /&gt;...have given me much to do with the scope.&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Looking at the disassembly of your interrupt will surprise you how many cycles are required to set / reset your pin&amp;nbsp; :O &lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:45:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545360#M13052</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1114 Timer resolution issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545361#M13053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by jschimpf255 on Wed Jan 28 02:02:56 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Yes I did some more testing, did not look at the timer int out pin but found that just setting/clear interrupt &amp;amp; clear the pin took 254 ns.&amp;nbsp; When I added in the code I needed to do my work I got 2.1 us so you are quite right, need a faster processor.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for the guidance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;--jim schimpf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:45:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545361#M13053</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1114 Timer resolution issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545362#M13054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by starblue on Wed Jan 28 02:34:23 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe you can do it in straight line code by counting cycles for timing (see the ARM Cortex-M0 technical reference manual). Putting the code in RAM could help to get it fast enough and remove uncertainties about wait states for flash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe you could use some hardware unit to generate your waveform, e.g. shift it out from SPI.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe an SCT could do it (not available on LPC1100, but AFAIK on all newer LPC controllers).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:45:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545362#M13054</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1114 Timer resolution issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545363#M13055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by jschimpf255 on Wed Jan 28 06:43:20 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I have bit banging routine now that runs ints off/Freertos off and uses inline assembly delay code.&amp;nbsp; This works OK. But I want to do it a bit more elegantly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I think I might be able to do a hybrid version, use the timer to generate a period I can get (~ 2.5 usec) and then use the asm delays inside the int routine to do the fast bit twiddling.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Will let you know how this works out....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;--jim schimpf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:45:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1114-Timer-resolution-issue/m-p/545363#M13055</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:45:18Z</dc:date>
    </item>
  </channel>
</rss>

