<?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 Reading GPIO stops program execution? in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Reading-GPIO-stops-program-execution/m-p/552993#M12545</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by fpg on Mon Mar 07 11:56:02 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;First of all I'm sorry if the solution to my problem is already mentioned somewhere, but I have no idea where to search for it...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use LPCXpresso LPC1769 with the Embedded Artists LPCXPresso Baseboard. There is a project handed with the baseboard called disp7seg-rotary. It runs perfectly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I try to use the functions of the rotary encoder, program execution stops after a few times of executing rotary_read function. By placing a breakpoint I found the very line, where it stops working:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;uint8_t state = ROTARY_READ_STATE();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On the right there is a macro, it's just reading in the values of GPIO Port 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define ROTARY_READ_STATE() ((GPIO_ReadValue(0) &amp;gt;&amp;gt; 24) &amp;amp; 0x03)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this is coming next and I try to step over, debugging icons become inactive except stop and pause. If I just let it run, it reads the values for a while after that it simply stops running.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone got any idea, what am I missing... ? :eek: :confused:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 02:05:33 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T02:05:33Z</dc:date>
    <item>
      <title>Reading GPIO stops program execution?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Reading-GPIO-stops-program-execution/m-p/552993#M12545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by fpg on Mon Mar 07 11:56:02 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;First of all I'm sorry if the solution to my problem is already mentioned somewhere, but I have no idea where to search for it...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use LPCXpresso LPC1769 with the Embedded Artists LPCXPresso Baseboard. There is a project handed with the baseboard called disp7seg-rotary. It runs perfectly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I try to use the functions of the rotary encoder, program execution stops after a few times of executing rotary_read function. By placing a breakpoint I found the very line, where it stops working:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;uint8_t state = ROTARY_READ_STATE();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On the right there is a macro, it's just reading in the values of GPIO Port 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define ROTARY_READ_STATE() ((GPIO_ReadValue(0) &amp;gt;&amp;gt; 24) &amp;amp; 0x03)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this is coming next and I try to step over, debugging icons become inactive except stop and pause. If I just let it run, it reads the values for a while after that it simply stops running.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone got any idea, what am I missing... ? :eek: :confused:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:05:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Reading-GPIO-stops-program-execution/m-p/552993#M12545</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reading GPIO stops program execution?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Reading-GPIO-stops-program-execution/m-p/552994#M12546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by william.vh on Mon Mar 07 13:42:55 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: fpg&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;On the right there is a macro, it's just reading in the values of GPIO Port 0:&lt;BR /&gt;#define ROTARY_READ_STATE() ((GPIO_ReadValue(0) &amp;gt;&amp;gt; 24) &amp;amp; 0x03)&lt;BR /&gt;&lt;BR /&gt;Anyone got any idea, what am I missing... ? :eek: :confused:&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've not looked at the code carefully, but GPIO_ReadValue(0) is also a macro, and I suspect that in that macro there is a line something like while(!data_ready){} that holds execution until the ADC sets a flag saying the data is ready.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you find your self at that line and ADC isn't running, you'll get stuck.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ran into a problem on the LPC2148 ADC where the ADC would have that bit cleared (or not properly set) and I would get stuck. I got around it by clearing the ADC by doing a dummy read (calling for conversion but not check in the data_ready bit). Fixed my problem, even though I never really understood why that bit would get cleared prior to reading.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;These days I use a counter in the while(!data_ready){} loop and if too much time has passed, I restart the ADC process to get me back in business.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:05:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Reading-GPIO-stops-program-execution/m-p/552994#M12546</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: Reading GPIO stops program execution?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Reading-GPIO-stops-program-execution/m-p/552995#M12547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CodeRedSupport on Tue Mar 08 02:10:52 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Try "stepping in" rather than "stepping over". I've not looked at this specific example, but I imagine that program execution is stuck in a loop inside the [FONT=Courier New][SIZE=1]GPIO_ReadValue(0)[/SIZE][/FONT]function that the macro invokes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CodeRedSupport&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:05:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Reading-GPIO-stops-program-execution/m-p/552995#M12547</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:05:34Z</dc:date>
    </item>
  </channel>
</rss>

