<?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 Events</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Events/m-p/522458#M5094</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 Fri Jan 16 04:17:20 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It's very very very sad buy what you think is a good product but then you can neither find quality information nor anyone who can help you...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NXP: thank you very much for the all the wasted time I spent trying to decipher how the hell I can use your LPC11U68 as slave with I2C. I have had to give up the project after hours and hours of read and tryings.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 16:39:19 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T16:39:19Z</dc:date>
    <item>
      <title>I2C Events</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Events/m-p/522457#M5093</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 11 08:47:57 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone explain what does function i2c_iox_events do exactly? I want to edit this function in order to fit it according to my needs, but I don't understand the differences between I2C_EVENT_DONE, I2C_EVENT_SLAVE_RX and I2C_EVENT_SLAVE_TX. How do I have to handle these events to send or receive correctly my data as slave?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I understand is when master resquests for data to the slave, I2C_EVENT_SLAVE_TX is active. But if I do 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;&amp;nbsp; case I2C_EVENT_SLAVE_TX:
&amp;nbsp; iox_data[0] = 0x49;//H
&amp;nbsp; iox_data[1] = 0x48;//i

&amp;nbsp; iox_xfer.txBuff = iox_data;// buffer[0];

&amp;nbsp; break;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, LPC11U68 only sends H. If I request for 2 bytes, what I get is HH.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The original function is:&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;/* Slave event handler for simulated EEPROM */
static void i2c_iox_events(I2C_ID_T id, I2C_EVENT_T event)
{
switch (event) {
case I2C_EVENT_DONE:
iox_xfer.rxBuff = &amp;amp;iox_data[1];
iox_xfer.rxSz = sizeof(iox_data);
iox_xfer.txBuff = (const uint8_t *) iox_data;
iox_xfer.txSz = sizeof(iox_data) + 1;
break;

case I2C_EVENT_SLAVE_RX:
iox_xfer.rxBuff = &amp;amp;iox_data[1];
iox_xfer.rxSz = sizeof(iox_data);
i2c_iox_update_regs(1);
break;

case I2C_EVENT_SLAVE_TX:
if (iox_xfer.txSz == 1) {
iox_xfer.txBuff = (const uint8_t *) iox_data[0];
iox_xfer.txSz = sizeof(iox_data) + 1;
}
break;
}
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And this function is called by i2c_iox_events:&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;/*-------- IO Expansion slave device implementation ----------*/
/* Update IN/OUT port states to real devices */
void i2c_iox_update_regs(int ops)
{
if (ops &amp;amp; 1) {/* update out port */
Board_LED_Set(0, iox_data[1] &amp;amp; 1);
Board_LED_Set(1, iox_data[1] &amp;amp; 2);
Board_LED_Set(2, iox_data[1] &amp;amp; 4);
Board_LED_Set(3, iox_data[1] &amp;amp; 8);
}
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:39:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Events/m-p/522457#M5093</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Events</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Events/m-p/522458#M5094</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 Fri Jan 16 04:17:20 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It's very very very sad buy what you think is a good product but then you can neither find quality information nor anyone who can help you...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NXP: thank you very much for the all the wasted time I spent trying to decipher how the hell I can use your LPC11U68 as slave with I2C. I have had to give up the project after hours and hours of read and tryings.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:39:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Events/m-p/522458#M5094</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:39:19Z</dc:date>
    </item>
  </channel>
</rss>

