<?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 I2C Interrupt in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Interrupt/m-p/545319#M13042</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by adrian0211 on Fri Mar 14 15:03:10 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need help with the i2c bus. First i implemented the initializing:&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;void I2C_Init()
{
LPC_SYSCON-&amp;gt;PRESETCTRL |= PRESETCTRL_I2C_RST_N;// I2C reset de-asserted
LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= SYSAHBCLKCTRL_I2C;// Enables Clock for I2C

LPC_IOCON-&amp;gt;PIO0_4 |= 0x10;// I2C SCL
LPC_IOCON-&amp;gt;PIO0_5 |= 0x10;// I2C SDA

LPC_I2C-&amp;gt;CONCLR |= I2CONCLR_AAC | I2CONCLR_SIC | I2CONCLR_STAC | I2CONCLR_I2ENC;//Init I2C Reg

LPC_I2C-&amp;gt;SCLL&amp;nbsp;&amp;nbsp; = I2SCLL_SCLL;// configuration I2C Bus Frequency
LPC_I2C-&amp;gt;SCLH&amp;nbsp;&amp;nbsp; = I2SCLH_SCLH;// configuration I2C Bus Frequency

NVIC_EnableIRQ(I2C_IRQn); // Enable the I2C Interrupt

LPC_I2C-&amp;gt;CONSET = I2CONSET_I2EN;//Enable I2C Interface

return;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That seems to work. ...Then I wrote an I2C_IRQHandler to handle the interrupt states. (I use the microcontroller as Master only!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The implemented states are 0x8, 0x10, 0x18, 0x28,...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;After setting the Startbit I expected a state of 0x8. The manual says that the SI (interruption) bit is set automatically. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But I neither get a state of 0x8 nor enter the interrupt routine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would be thankful for some help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to see some more code i can publish the hole project.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Adrian&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &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:44:55 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:44:55Z</dc:date>
    <item>
      <title>I2C Interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Interrupt/m-p/545319#M13042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by adrian0211 on Fri Mar 14 15:03:10 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need help with the i2c bus. First i implemented the initializing:&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;void I2C_Init()
{
LPC_SYSCON-&amp;gt;PRESETCTRL |= PRESETCTRL_I2C_RST_N;// I2C reset de-asserted
LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= SYSAHBCLKCTRL_I2C;// Enables Clock for I2C

LPC_IOCON-&amp;gt;PIO0_4 |= 0x10;// I2C SCL
LPC_IOCON-&amp;gt;PIO0_5 |= 0x10;// I2C SDA

LPC_I2C-&amp;gt;CONCLR |= I2CONCLR_AAC | I2CONCLR_SIC | I2CONCLR_STAC | I2CONCLR_I2ENC;//Init I2C Reg

LPC_I2C-&amp;gt;SCLL&amp;nbsp;&amp;nbsp; = I2SCLL_SCLL;// configuration I2C Bus Frequency
LPC_I2C-&amp;gt;SCLH&amp;nbsp;&amp;nbsp; = I2SCLH_SCLH;// configuration I2C Bus Frequency

NVIC_EnableIRQ(I2C_IRQn); // Enable the I2C Interrupt

LPC_I2C-&amp;gt;CONSET = I2CONSET_I2EN;//Enable I2C Interface

return;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That seems to work. ...Then I wrote an I2C_IRQHandler to handle the interrupt states. (I use the microcontroller as Master only!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The implemented states are 0x8, 0x10, 0x18, 0x28,...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;After setting the Startbit I expected a state of 0x8. The manual says that the SI (interruption) bit is set automatically. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But I neither get a state of 0x8 nor enter the interrupt routine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would be thankful for some help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to see some more code i can publish the hole project.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Adrian&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &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:44:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Interrupt/m-p/545319#M13042</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Interrupt/m-p/545320#M13043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by xianghuiwang on Thu Apr 10 11:05:07 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, Adrian, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would suggest you check the ICCON setting for P0_4 and P0_5, I suspect they are wrong so the I2C functionality are not activated:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_4 &amp;amp;= ~0x3F;/*&amp;nbsp; I2C I/O config */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_4 |= 0x01;/* I2C SCL */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_IOCON-&amp;gt;PIO0_5 &amp;amp;= ~0x3F;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_IOCON-&amp;gt;PIO0_5 |= 0x01;/* I2C SDA */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:44:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Interrupt/m-p/545320#M13043</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:44:56Z</dc:date>
    </item>
  </channel>
</rss>

