<?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: LPC55S28-EVK Working both as I2C master and slave at same time. in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1275716#M44983</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;Ariel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 May 2021 14:51:09 GMT</pubDate>
    <dc:creator>ArielF</dc:creator>
    <dc:date>2021-05-12T14:51:09Z</dc:date>
    <item>
      <title>LPC55S28-EVK Working both as I2C master and slave at same time.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1273078#M44908</link>
      <description>&lt;P&gt;I'm working with a LPC55S28 microcontroller that communicates with another device via I2C.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The flow is as following: The LPC working as master sends a message to the device (acting as slave).&lt;/P&gt;&lt;P&gt;When the device receives the LPC's packet, answers to the LPC's slave address, with another message.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I need the LPC to work both as I2c master and slave.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to configure it by merging&amp;nbsp;lpcxpresso55s28_i2c_polling_b2b_master and&amp;nbsp;lpcxpresso55s28_i2c_interrupt_b2b_transfer_slave samples. But it doesn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do that? Is there any sample code?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ariel&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 14:20:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1273078#M44908</guid>
      <dc:creator>ArielF</dc:creator>
      <dc:date>2021-05-06T14:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28-EVK Working both as I2C master and slave at same time.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1273480#M44927</link>
      <description>&lt;P&gt;Hi, Ariel,&lt;/P&gt;
&lt;P&gt;I think it is okay that you use the IIC module as master to access the device. The master means that it generates the SCL signal to access slave IIC, the master can write the device, it also can READ message from the device.&lt;/P&gt;
&lt;P&gt;This is the procedure to read the device from master side, the master send the 7 bits address and one bit WRITE/READ command to the slave , the slave detects whether the address match with predefined slave address, if it matches, the slave polls if WRITE or READ bit command, if it is READ command, it will drive SDA line for each SCL clock, so the master can get message from slave.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 07:26:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1273480#M44927</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-05-07T07:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28-EVK Working both as I2C master and slave at same time.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1274065#M44945</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;XiangJun Rong,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks for your answer. The issue is that the device that acted as slave, when it answer to the LPC, answers as master so the LPC must act as slave.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ariel&lt;/P&gt;</description>
      <pubDate>Sun, 09 May 2021 06:14:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1274065#M44945</guid>
      <dc:creator>ArielF</dc:creator>
      <dc:date>2021-05-09T06:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28-EVK Working both as I2C master and slave at same time.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1274073#M44947</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to explain it more the flow is the following&lt;/P&gt;&lt;P&gt;1) LPC send message to device&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LPC (Master)&amp;nbsp; &amp;nbsp;---------------------&amp;gt;&amp;nbsp; Device (Slave)&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; &amp;nbsp; Device answers to the LPC&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Device (Master) -------------------&amp;gt; LPC (Slave)&lt;/P&gt;&lt;P&gt;Because that I can't use master read from the slave to receive the answer.&lt;/P&gt;&lt;P&gt;I need the LPC will be able to work both as master and slave.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ariel&lt;/P&gt;</description>
      <pubDate>Sun, 09 May 2021 08:59:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1274073#M44947</guid>
      <dc:creator>ArielF</dc:creator>
      <dc:date>2021-05-09T08:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28-EVK Working both as I2C master and slave at same time.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1274187#M44949</link>
      <description>&lt;P&gt;Hi, Ariel,&lt;/P&gt;
&lt;P&gt;I think it is okay to exchange the master and slave for the LPC55S28.&lt;/P&gt;
&lt;P&gt;If you set the MSTEN bit and clear SLVEN bit, the LPC is master, if you clear MSTEN and set the SLVEN bit, the LPC is slave.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xiangjun_rong_0-1620618562158.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/144309iEB0D982A2C8D63DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xiangjun_rong_0-1620618562158.png" alt="xiangjun_rong_0-1620618562158.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 03:51:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1274187#M44949</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-05-10T03:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28-EVK Working both as I2C master and slave at same time.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1274346#M44952</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your answer.&lt;/P&gt;&lt;P&gt;Do you mean I need to set the SLVEN and to unset the MSTEN immediately after the LPC sends the message to the slave device? And once the LPC receives the message (acting as slave) to set again the MSTEN and to unset the SLVEN?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ariel&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 08:39:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1274346#M44952</guid>
      <dc:creator>ArielF</dc:creator>
      <dc:date>2021-05-10T08:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28-EVK Working both as I2C master and slave at same time.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1274707#M44961</link>
      <description>&lt;P&gt;Hi, Ariel,&lt;/P&gt;
&lt;P&gt;The answer is Yes, you can configure the IIC as either master or slave by configuring the MSTEN and&amp;nbsp; the SLVEN bits. There is IIC status register, you can check the IIC status register to know the status of IIC, then decide when you configure it as master or slave.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 02:15:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1274707#M44961</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-05-11T02:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28-EVK Working both as I2C master and slave at same time.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1275060#M44970</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;As we spoke I wrote the code below, where I send the message to the slave and immediately after it I set the SLVEN bit and unset the MSTEN bit. Is it ok?&lt;/P&gt;&lt;P&gt;Because since I added the line:&amp;nbsp;I2C_CFG-&amp;gt;CFG = I2C_CFG_MSTEN(0) | I2C_CFG_SLVEN(1); the slave stopped receiving the I2C message?&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;res = I2C_MasterStart(I2C_CFG, address, kI2C_Write);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;if (res != kStatus_Success) return res;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;res = I2C_MasterWriteBlocking(I2C_CFG, buffer, length, 4);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;if (res != kStatus_Success) return res;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;res = I2C_MasterStop(I2C_CFG);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;if (res != kStatus_Success) return res;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;I2C_CFG-&amp;gt;CFG = I2C_CFG_MSTEN(0) | I2C_CFG_SLVEN(1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ariel&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 14:47:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1275060#M44970</guid>
      <dc:creator>ArielF</dc:creator>
      <dc:date>2021-05-11T14:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28-EVK Working both as I2C master and slave at same time.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1275352#M44974</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I think your code is correct, the &lt;FONT color="#0000FF"&gt; I2C_MasterWriteBlocking(I2C_CFG, buffer, length, 4)&lt;/FONT&gt; will transfer the buffer data with the length size before it returns.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 05:40:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1275352#M44974</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-05-12T05:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28-EVK Working both as I2C master and slave at same time.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1275716#M44983</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;Ariel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 14:51:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-EVK-Working-both-as-I2C-master-and-slave-at-same-time/m-p/1275716#M44983</guid>
      <dc:creator>ArielF</dc:creator>
      <dc:date>2021-05-12T14:51:09Z</dc:date>
    </item>
  </channel>
</rss>

