<?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のトピックLPC1113 as i2c slave</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1113-as-i2c-slave/m-p/545756#M13121</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by andrewjfox on Mon Mar 24 17:14:55 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm having trouble setting the micro to function correctly as an i2c slave. The problem is that the device responds to any address on the bus, rather than only the matching slave address set in the ADR0 register. Everything else like the interrupt and the state handling works ok. Attached is initialisation code, where I set the address matching register and mask to my slave address (in this sample it is 0x58).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW I've been debugging using a Saleae 8 channel Logic analyser (awesome debug tool at reasonable price), so can see exactly what's happening on the i2c bus.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NVIC_DisableIRQ(I2C_IRQn);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_4 = 0x1;// enable I2C pins&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_5 = 0x1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// enable I2C clock, deassert peripheral reset&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET_BITS(LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL,SYSAHBCLKCTRL_I2C);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET_BITS(LPC_SYSCON-&amp;gt;PRESETCTRL,(0x1&amp;lt;&amp;lt;1));&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;CONCLR&amp;nbsp; = I2C_CON_STA | I2C_CON_STO | I2C_CON_SI | I2C_CON_AA | I2C_CON_EN;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* i2c bit freq = i2c PCLK / (SCLL + SCLH)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; * for SCLL = SCLH = PCLK / i2c freq / 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;SCLL = (SystemCoreClock/I2C_FREQ)/2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;SCLH = LPC_I2C-&amp;gt;SCLL;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MMCTRL = 0; // disable monitor mode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;ADR0 = 0; LPC_I2C-&amp;gt;ADR1 = 0; LPC_I2C-&amp;gt;ADR2 = 0; LPC_I2C-&amp;gt;ADR3 = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MASK0 = 0;LPC_I2C-&amp;gt;MASK1 = 0;LPC_I2C-&amp;gt;MASK2 = 0;LPC_I2C-&amp;gt;MASK3 = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;ADR0 = 0x58;&amp;nbsp; // disable General Call bit0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MASK0 = 0x0FE;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;CONSET = I2C_CON_EN | I2C_CON_AA;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NVIC_EnableIRQ(I2C_IRQn);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone have success getting the micro to function as a slave, and only responding to it's matching slave address? I can't find any notes on the NXP site, if anyone knows of a bug in the hardware let me know.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 19:45:49 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:45:49Z</dc:date>
    <item>
      <title>LPC1113 as i2c slave</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1113-as-i2c-slave/m-p/545756#M13121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by andrewjfox on Mon Mar 24 17:14:55 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm having trouble setting the micro to function correctly as an i2c slave. The problem is that the device responds to any address on the bus, rather than only the matching slave address set in the ADR0 register. Everything else like the interrupt and the state handling works ok. Attached is initialisation code, where I set the address matching register and mask to my slave address (in this sample it is 0x58).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW I've been debugging using a Saleae 8 channel Logic analyser (awesome debug tool at reasonable price), so can see exactly what's happening on the i2c bus.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NVIC_DisableIRQ(I2C_IRQn);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_4 = 0x1;// enable I2C pins&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_5 = 0x1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// enable I2C clock, deassert peripheral reset&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET_BITS(LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL,SYSAHBCLKCTRL_I2C);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET_BITS(LPC_SYSCON-&amp;gt;PRESETCTRL,(0x1&amp;lt;&amp;lt;1));&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;CONCLR&amp;nbsp; = I2C_CON_STA | I2C_CON_STO | I2C_CON_SI | I2C_CON_AA | I2C_CON_EN;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* i2c bit freq = i2c PCLK / (SCLL + SCLH)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; * for SCLL = SCLH = PCLK / i2c freq / 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;SCLL = (SystemCoreClock/I2C_FREQ)/2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;SCLH = LPC_I2C-&amp;gt;SCLL;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MMCTRL = 0; // disable monitor mode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;ADR0 = 0; LPC_I2C-&amp;gt;ADR1 = 0; LPC_I2C-&amp;gt;ADR2 = 0; LPC_I2C-&amp;gt;ADR3 = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MASK0 = 0;LPC_I2C-&amp;gt;MASK1 = 0;LPC_I2C-&amp;gt;MASK2 = 0;LPC_I2C-&amp;gt;MASK3 = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;ADR0 = 0x58;&amp;nbsp; // disable General Call bit0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MASK0 = 0x0FE;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;CONSET = I2C_CON_EN | I2C_CON_AA;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NVIC_EnableIRQ(I2C_IRQn);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone have success getting the micro to function as a slave, and only responding to it's matching slave address? I can't find any notes on the NXP site, if anyone knows of a bug in the hardware let me know.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:45:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1113-as-i2c-slave/m-p/545756#M13121</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1113 as i2c slave</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1113-as-i2c-slave/m-p/545757#M13122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by andrewjfox on Wed Mar 26 22:23:45 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Solved my own problem, though I'd post it just in case anyone has some trouble&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The manual description of the slave address MASK bits is counter-intuitive. I read it as setting the MASK bits enables comparison on that bit, and so set them to 1, however after experimenting I've found that they have to be 0 for slave address to be matched. Ie Setting the mask bit disables comparison on that bit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:45:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1113-as-i2c-slave/m-p/545757#M13122</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:45:50Z</dc:date>
    </item>
  </channel>
</rss>

