<?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 Re: i2c waiting for ever in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594268#M30899</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dragilla on Wed Feb 01 06:14:12 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It makes sense of course. Why is the cmsis example constructed the other way around? Maybe there is a reason for that? Anyone?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wow. Now I look in the original cmsis file and it is like this: first clear SI, then set STA. Some evil gnomes must have changed it in my code ;) I'm closing the thread :)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 02:52:22 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T02:52:22Z</dc:date>
    <item>
      <title>i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594254#M30885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dragilla on Sun Jan 29 07:58:15 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello again &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;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I fixed all my hard faults, and other silly errors and now I faced another behavior of my hardware which I don't understand. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an IMU 6DOF board (accelerometer and gyroscope) connected to my lpcxpresso 1769 board through i2c. The whole set works 100% ok... for a while &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; Last time it run for almost 3 hours with no fault. But if I wait long enough the program always gets stuck in one 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;
static uint32_t I2C_Start (LPC_I2C_TypeDef *I2Cx)
{
I2Cx-&amp;gt;I2CONSET = I2C_I2CONSET_STA;
I2Cx-&amp;gt;I2CONCLR = I2C_I2CONCLR_SIC;

// Wait for complete
while (!(I2Cx-&amp;gt;I2CONSET &amp;amp; I2C_I2CONSET_SI)); // &amp;lt;--- HERE IT GETS STUCK
I2Cx-&amp;gt;I2CONCLR = I2C_I2CONCLR_STAC;
return (I2Cx-&amp;gt;I2STAT &amp;amp; I2C_STAT_CODE_BITMASK);
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;And it stops here from the function that reads data from the gyroscope (ITG3200) - never the accelerometer. 3 hours is kind of long... my loop reading data from this IMU board runs at 100hz... so I don't have much idea of what can happen. Do you?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried changing clock speeds for the I2C - the default was 100khz, I tried 120khz as my core clock is 120mhz, then I tried 60khz - same result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The itg3200 can run on frequencies from 0 to 400khz.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I even tried rearranging the code, to put the accelerometer reading before the gyroscope. I tried putting some other commands between the two reads, to make a time gap between using the i2c - nothing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please give me an idea what can I try. Maybe I should try to do something with my hardware, or something?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594254#M30885</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594255#M30886</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 Jan 29 08:33:46 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: dragilla&lt;/STRONG&gt;&lt;BR /&gt;Please give me an idea what can I try.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Timeout counter :eek:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594255#M30886</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594256#M30887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dragilla on Sun Jan 29 08:38:17 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: kayoda&lt;/STRONG&gt;&lt;BR /&gt;Timeout counter :eek:&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you be more precise?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will try something like this:&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;
static uint32_t I2C_Start (LPC_I2C_TypeDef *I2Cx)
{
int i = 10000, retry = 3;

// Wait for complete
while (retry){
i = 10000;
I2Cx-&amp;gt;I2CONSET = I2C_I2CONSET_STA;
I2Cx-&amp;gt;I2CONCLR = I2C_I2CONCLR_SIC;
while(!(I2Cx-&amp;gt;I2CONSET &amp;amp; I2C_I2CONSET_SI) &amp;amp;&amp;amp; i --);
if(i) break;
retry --;
}
// if retry == 0 create infinite loop
if(!retry) while(1);
I2Cx-&amp;gt;I2CONCLR = I2C_I2CONCLR_STAC;
return (I2Cx-&amp;gt;I2STAT &amp;amp; I2C_STAT_CODE_BITMASK);
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;What do you think?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594256#M30887</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594257#M30888</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 Jan 29 09:01:12 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Could be useful to add a global retry counter to control how often this effect occurs&amp;nbsp; :rolleyes:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594257#M30888</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594258#M30889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dragilla on Sun Jan 29 09:20:33 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: kayoda&lt;/STRONG&gt;&lt;BR /&gt;Could be useful to add a global retry counter to control how often this effect occurs&amp;nbsp; :rolleyes:&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good idea... for starters...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But the real question is why it happens? And how to prevent it? You think it's normal?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594258#M30889</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594259#M30890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Sun Jan 29 16:07:41 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;This sequence is incorrect. I'm actually surprised you say it works.&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;&amp;nbsp; I2Cx-&amp;gt;I2CONSET = I2C_I2CONSET_STA;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; I2Cx-&amp;gt;I2CONCLR = I2C_I2CONCLR_SIC;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You don't want to clear the interrupt flag until you're ready for the next state. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The code [U]should[/U] get stuck there since you're clearing the INT flag right before you check if it's set.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594259#M30890</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594260#M30891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dragilla on Mon Jan 30 02:06:52 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: atomicdog&lt;/STRONG&gt;&lt;BR /&gt;This sequence is incorrect. I'm actually surprised you say it works.&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;&amp;nbsp; I2Cx-&amp;gt;I2CONSET = I2C_I2CONSET_STA;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; I2Cx-&amp;gt;I2CONCLR = I2C_I2CONCLR_SIC;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;You don't want to clear the interrupt flag until you're ready for the next state. &lt;BR /&gt;The code [U]should[/U] get stuck there since you're clearing the INT flag right before you check if it's set.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is not my code, this is cmsis1.3 &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;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway... what's really odd (especially after what you say) is: I added the global counter to the code from my previous post, to count how many times retry is substracted and guess what - it worked the whole night and the global counter (global_retries) still shows 0 ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The code now looks like this:&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;
static uint32_t I2C_Start (LPC_I2C_TypeDef *I2Cx)
{
int i = 10000, retry = 3;

// Wait for complete
while (retry){
i = 10000;
I2Cx-&amp;gt;I2CONSET = I2C_I2CONSET_STA;
I2Cx-&amp;gt;I2CONCLR = I2C_I2CONCLR_SIC;
while(!(I2Cx-&amp;gt;I2CONSET &amp;amp; I2C_I2CONSET_SI) &amp;amp;&amp;amp; i --);
if(i) break;
global_retries ++;
retry --;
}
// if retry == 0 create infinite loop
if(!retry) while(1);
I2Cx-&amp;gt;I2CONCLR = I2C_I2CONCLR_STAC;
return (I2Cx-&amp;gt;I2STAT &amp;amp; I2C_STAT_CODE_BITMASK);
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594260#M30891</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594261#M30892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dragilla on Mon Jan 30 06:42:53 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Besides, reading the manual, I think the order is ok (first set start, then clear interrupt, then wait for interrupt - not check the interrupt flag as you mentioned).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;From the UM10360:&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;
The master transmitter mode may now be entered by setting the STA bit. The I2C logic will
now test the I2C-bus and generate a START condition as soon as the bus becomes free.
When a START condition is transmitted, the serial interrupt flag (SI) is set ...
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, any idea what's going on here? Why adding my code (which only adds some checks) prevents the problem?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594261#M30892</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594262#M30893</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 Mon Jan 30 07:05:50 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: dragilla&lt;/STRONG&gt;&lt;BR /&gt;Why adding my code (which only adds some checks) prevents the problem?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Doesn't your question include the answer? You're changing the timing :eek:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Probably adding a few nops would do the same :rolleyes:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594262#M30893</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594263#M30894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dragilla on Mon Jan 30 09:00:00 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;But I don't add any code between setting the start flag, clearing the interrupt and then checking. The order and timing of these 3 operations should stay the same?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594263#M30894</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594264#M30895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Mon Jan 30 10:33:39 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: dragilla&lt;/STRONG&gt;&lt;BR /&gt;Besides, reading the manual, I think the order is ok (first set start, then clear interrupt, then wait for interrupt - not check the interrupt flag as you mentioned).&lt;BR /&gt;From the UM10360:&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
The master transmitter mode may now be entered by setting the STA bit. The I2C logic will
now test the I2C-bus and generate a START condition as soon as the bus becomes free.
When a START condition is transmitted, the serial interrupt flag (SI) is set ...
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;So, any idea what's going on here? Why adding my code (which only adds some checks) prevents the problem?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;:confused::confused::confused:&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;...then wait for interrupt == ..check the interrupt flag&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;Why doe you think their different?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You quoted the user manual but where do you see it saying to clear the interrupt flag right after setting the start flag? :confused:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594264#M30895</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594265#M30896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Mon Jan 30 13:59:09 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;Well the manual says that after sending the start flag the SI flag is set.&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;I agree.&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;So checking for this flag after setting the STA bit makes perfect sense to me. I just check if I2C is started this way...&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;I agree.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I never said either of those things were the problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594265#M30896</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594266#M30897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dragilla on Tue Jan 31 01:04:05 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok. So clearing the interrupt flag. How else would I check the interrupt flag if it's not cleared first?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or maybe you mean, that I clear it after setting STA, so the interrupt flag actually may be set first, then I clear it? Hm...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But it works now, another night of flawless operation... Only I added those checks, which actually don't do anything since it just works now. I don't get it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594266#M30897</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594267#M30898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Wed Feb 01 00:48:00 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: dragilla&lt;/STRONG&gt;&lt;BR /&gt;Ok. So clearing the interrupt flag. How else would I check the interrupt flag if it's not cleared first?&lt;BR /&gt;Or maybe you mean, that I clear it after setting STA, so the interrupt flag actually may be set first, then I clear it? Hm...&lt;BR /&gt;&lt;BR /&gt;But it works now, another night of flawless operation... Only I added those checks, which actually don't do anything since it just works now. I don't get it.&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;Clear it before you set STA. Before you try to start a new transaction you should have the I2C peripheral in a know good state.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594267#M30898</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594268#M30899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dragilla on Wed Feb 01 06:14:12 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It makes sense of course. Why is the cmsis example constructed the other way around? Maybe there is a reason for that? Anyone?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wow. Now I look in the original cmsis file and it is like this: first clear SI, then set STA. Some evil gnomes must have changed it in my code ;) I'm closing the thread :)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594268#M30899</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594269#M30900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dragilla on Wed Feb 01 14:21:06 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I changed the order, removed my 'safety code' and again I get the same infinite loop, waiting for interrupt flag forever.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So it must be something else than just the order.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594269#M30900</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594270#M30901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by yoko on Thu Feb 02 12:31:00 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; You might want to check the I/O pin config.&amp;nbsp; I2C requires open drain with pullups.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hoan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594270#M30901</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: i2c waiting for ever</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594271#M30902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Thu Feb 02 12:31:31 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: dragilla&lt;/STRONG&gt;&lt;BR /&gt;I changed the order, removed my 'safety code' and again I get the same infinite loop, waiting for interrupt flag forever.&lt;BR /&gt;So it must be something else than just the order.&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;Check the hardware.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the SCL line is low when the STA is sent it will wait until the SCL line goes high.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:52:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/i2c-waiting-for-ever/m-p/594271#M30902</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:52:24Z</dc:date>
    </item>
  </channel>
</rss>

