<?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: troubles with debugging the &amp;quot;gpio&amp;quot; example</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/troubles-with-debugging-the-quot-gpio-quot-example/m-p/535157#M4482</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by asieg on Thu Jul 01 12:51:27 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you, Zero, for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've copied your code into gpiotest.c and my debugger hangs on the line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[FONT=Arial]if(counter != p2_1_counter) //new edge interrupt[/FONT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regardless if the port 2 pin 1 pulled to GND or not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If I comment this line out the other part of programm works fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;By the way: my question was why do I have different behaiviours depending on when the pin is down?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But it would help if your code would work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 21:50:40 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T21:50:40Z</dc:date>
    <item>
      <title>troubles with debugging the "gpio" example</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/troubles-with-debugging-the-quot-gpio-quot-example/m-p/535155#M4480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by asieg on Wed Jun 30 13:31:09 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I just tried to readout the interrupt status from port 2 pin1 and I've trouble with it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[LEFT][SIZE=2][COLOR=#3f7f5f][FONT=Arial][SIZE=2][COLOR=#3f7f5f]/* use port2_1 as input event, interrupt test. */[/COLOR][/SIZE][/FONT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/COLOR][/SIZE][SIZE=2][FONT=Arial]GPIOSetDir( PORT2, 1, 0 );[/FONT][/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f][FONT=Arial]/* port2_1, single trigger, active high. */[/FONT][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/COLOR][/SIZE][SIZE=2][FONT=Arial]GPIOSetInterrupt( PORT2, 1, 1, 0, 0 );[/FONT][/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][FONT=Arial]GPIOIntEnable( PORT2, 1 );[/FONT][/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][FONT=Arial]while[/FONT][/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][FONT=Arial]( 1 )[/FONT][/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][FONT=Arial]{[/FONT][/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][FONT=Arial]if[/FONT][/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][FONT=Arial] ( GPIOIntStatus( PORT2, 1 )==1 )[/FONT][/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][FONT=Arial]{ i++;[/FONT][/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][FONT=Arial]GPIOIntClear( PORT2, 1 );[/FONT][/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][FONT=Arial]}[/FONT][/SIZE][/LEFT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][FONT=Arial]}[/FONT][/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][SIZE=3]I step to the line with "if" and when I don't pull the port 2 pin1 to GND the debugger goes to the function GPIOIntStatus. In this function I step to the line:[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]case&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]PORT2:[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ( LPC_GPIO2-&amp;gt;MIS &amp;amp; (0x1&amp;lt;&amp;lt;bitPosi) )[/SIZE][/LEFT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2]regVal = 1;[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=3]and then pull the port 2 pin 1 to GND. Then the regVal is 1 and if I step back to the main my variable "i" will be increased.[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=3]BUT if i pull the port2 pin 1 to GND before the debugger is on the line "[/SIZE][SIZE=2]case PORT2:" , [SIZE=3]for example I'm at the line "[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][FONT=Arial]if[/FONT][/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][FONT=Arial] ( GPIOIntStatus( PORT2, 1 )==1 )[/FONT][/SIZE][/SIZE]" [/SIZE][SIZE=3]in main() then the debugger crashes.[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=3]Why???[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/SIZE][/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/LEFT]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:50:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/troubles-with-debugging-the-quot-gpio-quot-example/m-p/535155#M4480</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: troubles with debugging the "gpio" example</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/troubles-with-debugging-the-quot-gpio-quot-example/m-p/535156#M4481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Wed Jun 30 18:04:32 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Reading and clearing interrupt status should be done by PIOINT2_IRQHandler in gpio.c and not in your main loop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would suggest to check this with a breakpoint in this handler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also p2_1_counter could be used to count this pin interrupt if you include something like this in gpiotest:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt; 
extern volatile uint32_t p2_1_counter;
uint32_t counter;
uint32_t on;
uint32_t off;
...
 
/* use port2_1 as input event, interrupt test. */
GPIOSetDir( PORT2, 1, 0 );
/* port0_1, single edge trigger, active high. */
GPIOSetInterrupt( PORT2, 1, 0, 0, 0 );
GPIOIntEnable( PORT2, 1 );
...
 
counter = p2_1_counter;
while( 1 )
{
 if(counter != p2_1_counter) //new edge interrupt
 {
&amp;nbsp; if(LPC_GPIO2-&amp;gt;DATA &amp;amp; (1&amp;lt;&amp;lt;1)) //pin set?
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; on++;
&amp;nbsp; }
&amp;nbsp; else
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; off++;
&amp;nbsp; }
&amp;nbsp; counter = p2_1_counter;
 } //end new interrupt
}&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:50:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/troubles-with-debugging-the-quot-gpio-quot-example/m-p/535156#M4481</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: troubles with debugging the "gpio" example</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/troubles-with-debugging-the-quot-gpio-quot-example/m-p/535157#M4482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by asieg on Thu Jul 01 12:51:27 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you, Zero, for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've copied your code into gpiotest.c and my debugger hangs on the line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[FONT=Arial]if(counter != p2_1_counter) //new edge interrupt[/FONT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regardless if the port 2 pin 1 pulled to GND or not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If I comment this line out the other part of programm works fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;By the way: my question was why do I have different behaiviours depending on when the pin is down?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But it would help if your code would work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:50:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/troubles-with-debugging-the-quot-gpio-quot-example/m-p/535157#M4482</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: troubles with debugging the "gpio" example</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/troubles-with-debugging-the-quot-gpio-quot-example/m-p/535158#M4483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Thu Jul 01 13:40:27 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;What do you mean with 'debugger hangs' ??&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you check this part of the program in 'Disassembly' window with Single Step (F5) ? There you can see what is going on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you check 'PC' and 'Cycle' in 'Core' window ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There you should see that line&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt; 
if(counter != p2_1_counter) //new edge interrupt
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;is exactly doing what intended for: waiting for PIO2 Interrupt.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If on / off are not incremeting, there's something wrong with your interrupt handler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So set breakpoint in PIO2 Interrupt handler and check it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And BTW: The different behavier seems to result from inexperienced debugger usage. So just play around with breakpoints, disassembly- and core-windows and you will learn a lot about debugger and Cortex M3.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:50:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/troubles-with-debugging-the-quot-gpio-quot-example/m-p/535158#M4483</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:50:41Z</dc:date>
    </item>
  </channel>
</rss>

