<?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>LPCXpresso IDEのトピックRe: Problems with multiple interrupts</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594023#M30737</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ex-kayoda on Sat Sep 29 07:10:40 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't know what you are trying to do but using this timer while onewire is using it and changing MCR registers several times doesn't look like a really good idea ;)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 21:33:35 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T21:33:35Z</dc:date>
    <item>
      <title>Problems with multiple interrupts</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594022#M30736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lennyk87 on Sat Sep 29 06:17:20 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hey guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i've got a problem with timer interrupts. I use the OneWire-bus implementation of this post &lt;/SPAN&gt;&lt;A href="http://" rel="nofollow noopener noreferrer" target="_blank"&gt;http://knowledgebase.nxp.com/showpost.php?p=5896&amp;amp;postcount=20&lt;/A&gt;&lt;SPAN&gt; to read my DS18S20. It works fine until I try to use a second timer to generate a 300kHz Signal that calls an interrupt. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's my code for the 300kHz-timer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
void timer_init(void) {

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* disable timer */
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TMR16B0-&amp;gt;TCR = 0;

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* External Match Register 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TMR16B0-&amp;gt;EMR = (1&amp;lt;&amp;lt;6)|(1&amp;lt;&amp;lt;1);

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Outputs */
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_IOCON-&amp;gt;PIO0_9 = 1&amp;lt;&amp;lt;1;

&amp;nbsp;&amp;nbsp;&amp;nbsp; /*
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * 1 -&amp;gt; PWM for EM1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TMR16B0-&amp;gt;PWMC = 1&amp;lt;&amp;lt;1;

&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TMR16B0-&amp;gt;MR3 = 160; // 300kHz
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TMR16B0-&amp;gt;MR1 = 80; // 50% PWM

&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TMR16B0-&amp;gt;MCR = (1&amp;lt;&amp;lt;10) | (1&amp;lt;&amp;lt;9);

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* start timer */
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TMR16B0-&amp;gt;TCR = 1;

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* enable interrupt */
&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC_EnableIRQ(TIMER_16_0_IRQn);
}

void TIMER16_0_IRQHandler(void) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; /*
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * just to test
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */
&amp;nbsp;&amp;nbsp;&amp;nbsp; if(LPC_TMR16B0-&amp;gt;IR &amp;amp; (1&amp;lt;&amp;lt;3)) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TMR16B0-&amp;gt;IR |= (1&amp;lt;&amp;lt;3);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;The interrupt works, if I don't use the second timer of the One-Wire-bus implementation. The other way round, the One-Wire-bus works, if I don't use the 300kHz-timer. I've also got a third interrupt for an UART. The UART stops working if I use both but works if I only use one of the other interrupts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope you can help me, I'm running out of ideas what the error could be.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Greetings,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Lenny.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:33:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594022#M30736</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with multiple interrupts</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594023#M30737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ex-kayoda on Sat Sep 29 07:10:40 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't know what you are trying to do but using this timer while onewire is using it and changing MCR registers several times doesn't look like a really good idea ;)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:33:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594023#M30737</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with multiple interrupts</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594024#M30738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by vasanth on Sat Sep 29 10:46:54 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Kayoda is right. Using TIMER16B0 for both one wire implementation and simultaneously for 300Khz frequency generation is not safe design practice.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;One easy solution is to try to use the any other unused timers such as TIMER16B1 to generate your frequency in your application.:)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or even better you could use something like an analog temperature sensor like LM35...which also unfortunately requires only one pin....;)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:33:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594024#M30738</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with multiple interrupts</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594025#M30739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lennyk87 on Sun Sep 30 02:27:16 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using TMR16B1 for the onewire-bus of course :P Sorry, I didn't mention that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It doesn't work anyway...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:33:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594025#M30739</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with multiple interrupts</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594026#M30740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ex-kayoda on Sun Sep 30 03:35:13 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Ahh, it's a christmas guessing game :)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So week 2 :D&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#1 Why do you use interrupts to generate a PWM and what is happening if you generate your PWM without Interrupt?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#2 How did you set your Interrupt Priorities?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:33:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594026#M30740</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with multiple interrupts</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594027#M30741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lennyk87 on Sun Sep 30 03:58:28 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, I'm sorry my posts were so sketchy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use the interrupts to count the PWM cycles and toggle one pin after 30 cycles (I need kind of a burst mode). Plus I need to toggle another Pin after another number of cycles. Thats realised by a switch case statement.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I don't use the interrupt, everything works fine. Note that it doesn't even work with an empty interrupt routine (and interrupt enabled).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope I gave you enough information now, sorry again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:33:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594027#M30741</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with multiple interrupts</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594028#M30742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ex-kayoda on Sun Sep 30 08:16:41 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;I hope I gave you enough information now...&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;Yes, that's enough :confused: Now I know that you don't use the original linked sample, your timer code is different from timer code above and you're not answering my questions :rolleyes:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And it's enough to show that you don't know how NVIC works &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; I would guess that your code suffers from Tail Chaining :eek: A simple change of Priority would show that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
 NVIC_SetPriority(TIMER_16_0_IRQn,1);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:33:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problems-with-multiple-interrupts/m-p/594028#M30742</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:33:38Z</dc:date>
    </item>
  </channel>
</rss>

