<?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>LPC Microcontrollers中的主题 Re: I2C library in LPC11U68</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522130#M4766</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rubensm on Thu Jan 08 15:54:34 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Just another thing. I've added I2C1 functionality in the 'periph_i2c' example project since it wasn't still implemented.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The new code affects in the functions Init_I2C_PinMux, i2c_set_mode and i2c_app_init and the new one I2C1_IRQHandler&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;static void Init_I2C_PinMux(I2C_ID_T id)
{
switch(id){
case I2C0:
Chip_SYSCTL_PeriphReset(RESET_I2C0);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 4,
(IOCON_FUNC1 | I2C_FASTPLUS_BIT) | IOCON_DIGMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 5,
(IOCON_FUNC1 | I2C_FASTPLUS_BIT) | IOCON_DIGMODE_EN);

break;
case I2C1:
Chip_SYSCTL_PeriphReset(RESET_I2C1);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 7,
IOCON_FUNC3 | IOCON_DIGMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 24,
IOCON_FUNC2 | IOCON_DIGMODE_EN);
break;
}
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;static void i2c_set_mode(I2C_ID_T id, int polling)
{
if (!polling) {
mode_poll &amp;amp;= ~(1 &amp;lt;&amp;lt; id);
Chip_I2C_SetMasterEventHandler(id, Chip_I2C_EventHandler);
if(id == I2C0)
NVIC_EnableIRQ(I2C0_IRQn);
else if(id == I2C1)
NVIC_EnableIRQ(I2C1_IRQn);
}
else {
mode_poll |= 1 &amp;lt;&amp;lt; id;
if(id == I2C0)
NVIC_DisableIRQ(I2C0_IRQn);
else if(id == I2C1)
NVIC_DisableIRQ(I2C1_IRQn);
Chip_I2C_SetMasterEventHandler(id, Chip_I2C_EventHandlerPolling);
}
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;static void i2c_app_init(I2C_ID_T id, int speed)
{
Init_I2C_PinMux(id);

/* Initialize I2C */
Chip_I2C_Init(id);
Chip_I2C_SetClockRate(id, speed);

/* Set default mode to interrupt */
i2c_set_mode(id, 0);
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;void I2C1_IRQHandler(void)
{
i2c_state_handling(I2C1);
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I2C0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]SDA: PIO0_5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]SCL: PIO0_4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I2C1:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]SDA: PIO1_24&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]SCL: PIO0_7&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I attach my whole "periph_i2c.c". It's been tested with NXP LPC11U68, where the LPC11U68 is the master and Arduino UNO is the slave. Polling mode has not been tested. Please, note that the file is a custom version of i2c_periph without iox emulation nor rom emulation. It just sends through I2C0 or I2C1 pins the bytes defined in the buffer as master. I hope it is useful for someone.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rubén.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 16:36:54 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T16:36:54Z</dc:date>
    <item>
      <title>I2C library in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522122#M4758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rubensm on Sun Jan 04 04:36:48 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm new with LPC devices and I have some doubts about the use I2C protocol on these boards. I've read all the stuff related with I2C in the datasheet, but I don't know if there exists a encapsulated library or it must be the developer who have to handle all the I2C states using software.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been looking for info in the forum and searching in the Internet, but I haven't been able to clarify this issue. In the example files there is the file "i2c_11u6x.c", but it is enough to have a communication as master and as slave? Is it so simple as, for example, use the function &lt;/SPAN&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;Chip_I2C_MasterTransfer(I2C_ID_T id, I2C_XFER_T *xfer)&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt; to write in the slave or &lt;/SPAN&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;Chip_I2C_MasterRead(I2C_ID_T id, uint8_t slaveAddr, uint8_t *buff, int len)&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt; for a slave writing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is very little information about I2C and LPC, so I would be very greatful if someone could help me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rubén.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522122#M4758</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: I2C library in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522123#M4759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Sun Jan 04 05:04:59 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;In Chip_I2C_Master... functions your LPC is the master.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Usually there's a Chip_I2C_MasterRead function to read from a slave and a Chip_I2C_MasterSend function to write to a slave. This functions require a correct slave address and a buffer to read / write. They are both using Chip_I2C_MasterTransfer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To start with I2C it's just necessary to init I2C correct and use Chip_I2C_MasterRead / Chip_I2C_MasterSend functions (as shown in example) and of course a working hardware&amp;nbsp; :) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522123#M4759</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: I2C library in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522124#M4760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rubensm on Mon Jan 05 05:34:03 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for your reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to communicate with an Arduino UNO in order to test the proper work of the communication but it is being fruitless.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The LPC is the master and Arduino the slave with the address 0x12 and about the hardware, I'm using pull-up resistors (10k) in SDA and SCL.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code is attatched as I am neither able to post it nor post a link to pastebin.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I initiliazing improperly the I2C interface?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rubén&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522124#M4760</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: I2C library in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522125#M4761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Mon Jan 05 06:16:54 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: rubensm&lt;/STRONG&gt;&lt;BR /&gt;The code is attatched as I am neither able to post it nor post a link to pastebin.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's a special forum 'feature'&amp;nbsp; :(( &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: rubensm&lt;/STRONG&gt;&lt;BR /&gt;Am I initiliazing improperly the I2C interface?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this a LPCOpen sample?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Usually there's a good i2c sample 'periph_i2c' which is showing how to communicate...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: rubensm&lt;/STRONG&gt;&lt;BR /&gt;I'm trying to communicate with an Arduino UNO in order to test the proper work of the communication but it is being fruitless.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure what communication your Arduino is expecting in detail...&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522125#M4761</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: I2C library in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522126#M4762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rubensm on Thu Jan 08 12:45:51 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems that it's working with the 'periph_i2c', but I have a problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm sending all the time the same:&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;buffer[0][0] = 0x48;//H
buffer[0][1] = 0x6F;//o
buffer[0][2] = 0x6C;//l
buffer[0][3] = 0x61;//a
buffer[0][4] = 0x20;//_
buffer[0][5] = 0x6D;//m
buffer[0][6] = 0x75;//u
buffer[0][7] = 0x6E;//n
buffer[0][8] = 0x64;//d
buffer[0][9] = 0x6F;//o

xfer.slaveAddr = 4; //Slave address 4
xfer.txSz = 10;//10 bytes to send
xfer.txBuff = buffer[0];
xfer.rxSz = 0;//0 bytes to send
xfer.txBuff = 0;//Flush del buffer
tmp = Chip_I2C_MasterSend(i2cDev, xfer.slaveAddr, xfer.txBuff, xfer.txSz);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and what I'm receiving in the Arduino is: '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp; q&amp;nbsp;&amp;nbsp; 5 '. They are 10 characters but not the corresponding ones.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've attached a screenshot for clarity.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for your help &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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522126#M4762</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: I2C library in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522127#M4763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Thu Jan 08 13:03:18 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;You are printing (with 9600 bps&amp;nbsp; :D ) in your receive event&amp;nbsp; :quest: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Probably that's no LPC problem&amp;nbsp; :(( &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could be a good idea to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- use an oscilloscope or logic analyser to read your I2C data...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- send a shorter message and use a delay between messages...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- store received data in a buffer instead using a slow printing...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522127#M4763</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: I2C library in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522128#M4764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by capiman on Thu Jan 08 13:26:23 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;xfer.slaveAddr = 4; //Slave address 4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;xfer.txSz = 10;//10 bytes to send&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;xfer.[color=#f30]txBuff[/color] = buffer[0];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;xfer.rxSz = 0;//0 bytes to send&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;xfer.[color=#f30]txBuff[/color] = 0;//Flush del buffer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tmp = Chip_I2C_MasterSend(i2cDev, xfer.slaveAddr, xfer.txBuff, xfer.txSz);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it correct that you use both times txBuff?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you print the 10 bytes in hex?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522128#M4764</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: I2C library in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522129#M4765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rubensm on Thu Jan 08 14:07:09 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;That was the mistake! I did copy and paste and I forgot to change it. I was actually sending zeros, that in ASCII are the NULL character.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now it works perfectly!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much both R2D2 and capiman!&amp;nbsp; :D&amp;nbsp;&amp;nbsp; :D&amp;nbsp;&amp;nbsp; :D&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522129#M4765</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: I2C library in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522130#M4766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rubensm on Thu Jan 08 15:54:34 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Just another thing. I've added I2C1 functionality in the 'periph_i2c' example project since it wasn't still implemented.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The new code affects in the functions Init_I2C_PinMux, i2c_set_mode and i2c_app_init and the new one I2C1_IRQHandler&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;static void Init_I2C_PinMux(I2C_ID_T id)
{
switch(id){
case I2C0:
Chip_SYSCTL_PeriphReset(RESET_I2C0);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 4,
(IOCON_FUNC1 | I2C_FASTPLUS_BIT) | IOCON_DIGMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 5,
(IOCON_FUNC1 | I2C_FASTPLUS_BIT) | IOCON_DIGMODE_EN);

break;
case I2C1:
Chip_SYSCTL_PeriphReset(RESET_I2C1);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 7,
IOCON_FUNC3 | IOCON_DIGMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 24,
IOCON_FUNC2 | IOCON_DIGMODE_EN);
break;
}
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;static void i2c_set_mode(I2C_ID_T id, int polling)
{
if (!polling) {
mode_poll &amp;amp;= ~(1 &amp;lt;&amp;lt; id);
Chip_I2C_SetMasterEventHandler(id, Chip_I2C_EventHandler);
if(id == I2C0)
NVIC_EnableIRQ(I2C0_IRQn);
else if(id == I2C1)
NVIC_EnableIRQ(I2C1_IRQn);
}
else {
mode_poll |= 1 &amp;lt;&amp;lt; id;
if(id == I2C0)
NVIC_DisableIRQ(I2C0_IRQn);
else if(id == I2C1)
NVIC_DisableIRQ(I2C1_IRQn);
Chip_I2C_SetMasterEventHandler(id, Chip_I2C_EventHandlerPolling);
}
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;static void i2c_app_init(I2C_ID_T id, int speed)
{
Init_I2C_PinMux(id);

/* Initialize I2C */
Chip_I2C_Init(id);
Chip_I2C_SetClockRate(id, speed);

/* Set default mode to interrupt */
i2c_set_mode(id, 0);
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;void I2C1_IRQHandler(void)
{
i2c_state_handling(I2C1);
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I2C0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]SDA: PIO0_5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]SCL: PIO0_4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I2C1:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]SDA: PIO1_24&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]SCL: PIO0_7&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I attach my whole "periph_i2c.c". It's been tested with NXP LPC11U68, where the LPC11U68 is the master and Arduino UNO is the slave. Polling mode has not been tested. Please, note that the file is a custom version of i2c_periph without iox emulation nor rom emulation. It just sends through I2C0 or I2C1 pins the bytes defined in the buffer as master. I hope it is useful for someone.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rubén.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-library-in-LPC11U68/m-p/522130#M4766</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:54Z</dc:date>
    </item>
  </channel>
</rss>

