<?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 loss of arbitration on LPC5512 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-loss-of-arbitration-on-LPC5512/m-p/1515821#M50029</link>
    <description>&lt;P&gt;I'm using SDK 2.11 on an LPC5512 using MCUexpresso 11.5.1.&amp;nbsp; I've got an I2C bus (400KHz) and am using an I2S amplifier.&amp;nbsp; The LPC is bus master and there are a couple of slaves on it. I2C driver version is 2.3.0&lt;/P&gt;&lt;P&gt;Every so often (random) I see an loss of arbitration error on the I2C using a write/read.&amp;nbsp; Code:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;i2c_master_transfer_t masterXfer;&lt;BR /&gt;memset(&amp;amp;masterXfer, 0, sizeof(masterXfer));&lt;BR /&gt;masterXfer.slaveAddress = Device;&lt;BR /&gt;masterXfer.direction = kI2C_Read;&lt;BR /&gt;masterXfer.subaddress = reg_addr;&lt;BR /&gt;masterXfer.subaddressSize = 1;&lt;BR /&gt;masterXfer.data = rxBuff;&lt;BR /&gt;masterXfer.dataSize = rxSize;&lt;BR /&gt;masterXfer.flags = kI2C_TransferDefaultFlag;&lt;/P&gt;&lt;P&gt;/* direction=write : start+device_write;cmdbuff;xBuff; */&lt;BR /&gt;/* direction=recive : start+device_write;cmdbuff;repeatStart+device_read;xBuff; */&lt;/P&gt;&lt;P&gt;RetVal = I2C_MasterTransferBlocking(ACCEL_I2C_PERIPHERAL, &amp;amp;masterXfer);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This will go like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="randylee_0-1662067185397.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/192203iDD04BD5970CE28AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="randylee_0-1662067185397.png" alt="randylee_0-1662067185397.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This appears to be something connected to power somehow BUT I'd like to recover from it.&amp;nbsp; If I just restart the transfer I get something more interesting:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="randylee_1-1662067245833.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/192204i0EF69657E1916D5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="randylee_1-1662067245833.png" alt="randylee_1-1662067245833.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and the transfer hangs forever waiting for some status to happen that never does in fsl_i2c.c around line 425&lt;/P&gt;&lt;P&gt;Interestingly enough, I've got the I2C channel supposedly configured in the peripherals tool to timeout in like 35mS but it never does.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="randylee_2-1662067485682.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/192206i863B17B8C3F5B7AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="randylee_2-1662067485682.png" alt="randylee_2-1662067485682.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How do I get this thing reset and running again?&lt;/P&gt;&lt;P&gt;I don't find any reference to the timeout code being enabled.&amp;nbsp; Is the tool not putting out the right stuff there? Or does it just not do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2022 21:30:48 GMT</pubDate>
    <dc:creator>randylee</dc:creator>
    <dc:date>2022-09-01T21:30:48Z</dc:date>
    <item>
      <title>I2C loss of arbitration on LPC5512</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-loss-of-arbitration-on-LPC5512/m-p/1515821#M50029</link>
      <description>&lt;P&gt;I'm using SDK 2.11 on an LPC5512 using MCUexpresso 11.5.1.&amp;nbsp; I've got an I2C bus (400KHz) and am using an I2S amplifier.&amp;nbsp; The LPC is bus master and there are a couple of slaves on it. I2C driver version is 2.3.0&lt;/P&gt;&lt;P&gt;Every so often (random) I see an loss of arbitration error on the I2C using a write/read.&amp;nbsp; Code:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;i2c_master_transfer_t masterXfer;&lt;BR /&gt;memset(&amp;amp;masterXfer, 0, sizeof(masterXfer));&lt;BR /&gt;masterXfer.slaveAddress = Device;&lt;BR /&gt;masterXfer.direction = kI2C_Read;&lt;BR /&gt;masterXfer.subaddress = reg_addr;&lt;BR /&gt;masterXfer.subaddressSize = 1;&lt;BR /&gt;masterXfer.data = rxBuff;&lt;BR /&gt;masterXfer.dataSize = rxSize;&lt;BR /&gt;masterXfer.flags = kI2C_TransferDefaultFlag;&lt;/P&gt;&lt;P&gt;/* direction=write : start+device_write;cmdbuff;xBuff; */&lt;BR /&gt;/* direction=recive : start+device_write;cmdbuff;repeatStart+device_read;xBuff; */&lt;/P&gt;&lt;P&gt;RetVal = I2C_MasterTransferBlocking(ACCEL_I2C_PERIPHERAL, &amp;amp;masterXfer);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This will go like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="randylee_0-1662067185397.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/192203iDD04BD5970CE28AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="randylee_0-1662067185397.png" alt="randylee_0-1662067185397.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This appears to be something connected to power somehow BUT I'd like to recover from it.&amp;nbsp; If I just restart the transfer I get something more interesting:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="randylee_1-1662067245833.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/192204i0EF69657E1916D5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="randylee_1-1662067245833.png" alt="randylee_1-1662067245833.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and the transfer hangs forever waiting for some status to happen that never does in fsl_i2c.c around line 425&lt;/P&gt;&lt;P&gt;Interestingly enough, I've got the I2C channel supposedly configured in the peripherals tool to timeout in like 35mS but it never does.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="randylee_2-1662067485682.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/192206i863B17B8C3F5B7AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="randylee_2-1662067485682.png" alt="randylee_2-1662067485682.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How do I get this thing reset and running again?&lt;/P&gt;&lt;P&gt;I don't find any reference to the timeout code being enabled.&amp;nbsp; Is the tool not putting out the right stuff there? Or does it just not do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 21:30:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-loss-of-arbitration-on-LPC5512/m-p/1515821#M50029</guid>
      <dc:creator>randylee</dc:creator>
      <dc:date>2022-09-01T21:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: I2C loss of arbitration on LPC5512</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-loss-of-arbitration-on-LPC5512/m-p/1516752#M50052</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Pls try to use non blocking mode, in other words, use the interrupt mechanism to transfer data.&lt;/P&gt;
&lt;P&gt;i2c_master_transfer_t masterXfer;&lt;BR /&gt;memset(&amp;amp;masterXfer, 0, sizeof(masterXfer));&lt;BR /&gt;masterXfer.slaveAddress = Device;&lt;BR /&gt;masterXfer.direction = kI2C_Read;&lt;BR /&gt;masterXfer.subaddress = reg_addr;&lt;BR /&gt;masterXfer.subaddressSize = 1;&lt;BR /&gt;masterXfer.data = rxBuff;&lt;BR /&gt;masterXfer.dataSize = rxSize;&lt;BR /&gt;masterXfer.flags = kI2C_TransferDefaultFlag;&lt;/P&gt;
&lt;P&gt;/* direction=write : start+device_write;cmdbuff;xBuff; */&lt;BR /&gt;/* direction=recive : start+device_write;cmdbuff;repeatStart+device_read;xBuff; */&lt;/P&gt;
&lt;P&gt;RetVal = I2C_MasterTransferNonBlocking(ACCEL_I2C_PERIPHERAL, &amp;amp;g_m_handle,&amp;amp;masterXfer);&lt;/P&gt;
&lt;P&gt;You can refer to the example code like:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xiangjun_rong_0-1662357805663.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/192431iAB69406DD3147105/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xiangjun_rong_0-1662357805663.png" alt="xiangjun_rong_0-1662357805663.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because I use the example based on LPC55S69-EVK, I do not know if there is similar example based on LPC5512-EVK.&lt;/P&gt;
&lt;P&gt;static bool I2C_ReadAccelRegs(I2C_Type *base, uint8_t device_addr, uint8_t reg_addr, uint8_t *rxBuff, uint32_t rxSize)&lt;BR /&gt;{&lt;BR /&gt;i2c_master_transfer_t masterXfer;&lt;BR /&gt;memset(&amp;amp;masterXfer, 0, sizeof(masterXfer));&lt;BR /&gt;masterXfer.slaveAddress = device_addr;&lt;BR /&gt;masterXfer.direction = kI2C_Read;&lt;BR /&gt;masterXfer.subaddress = reg_addr;&lt;BR /&gt;masterXfer.subaddressSize = 1;&lt;BR /&gt;masterXfer.data = rxBuff;&lt;BR /&gt;masterXfer.dataSize = rxSize;&lt;BR /&gt;masterXfer.flags = kI2C_TransferDefaultFlag;&lt;/P&gt;
&lt;P&gt;/* direction=write : start+device_write;cmdbuff;xBuff; */&lt;BR /&gt;/* direction=recive : start+device_write;cmdbuff;repeatStart+device_read;xBuff; */&lt;/P&gt;
&lt;P&gt;I2C_MasterTransferNonBlocking(BOARD_ACCEL_I2C_BASEADDR, &amp;amp;g_m_handle, &amp;amp;masterXfer);&lt;/P&gt;
&lt;P&gt;/* wait for transfer completed. */&lt;BR /&gt;while ((!nakFlag) &amp;amp;&amp;amp; (!completionFlag))&lt;BR /&gt;{&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;nakFlag = false;&lt;/P&gt;
&lt;P&gt;if (completionFlag == true)&lt;BR /&gt;{&lt;BR /&gt;completionFlag = false;&lt;BR /&gt;return true;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;return false;&lt;BR /&gt;}&lt;BR /&gt;}&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>Mon, 05 Sep 2022 06:05:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-loss-of-arbitration-on-LPC5512/m-p/1516752#M50052</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2022-09-05T06:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: I2C loss of arbitration on LPC5512</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-loss-of-arbitration-on-LPC5512/m-p/1520563#M50111</link>
      <description>&lt;P&gt;actually, I had that exact code in there to begin with and changed to blocking to see if that helped (it didn't).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 12:59:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-loss-of-arbitration-on-LPC5512/m-p/1520563#M50111</guid>
      <dc:creator>randylee</dc:creator>
      <dc:date>2022-09-12T12:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: I2C loss of arbitration on LPC5512</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-loss-of-arbitration-on-LPC5512/m-p/1520592#M50112</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; How do I get this thing reset and running again?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Many I2C devices, especially older and less complex one's, seem to be simple state machines. If some impulse gets lost or an additional one interspersed by e.g. EMI, synchonisation is lost. Often, not even a stop event helps. While an amplifier seems not "simple", it might have inherited simpler I2C-IP from older devices ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;One commonly used method is to manually drive CLK pulse (perhaps reconfigure the I2C pins), until the slave releases the bus.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would try a lower clock frequency as well. Not that I think it is the bus speed per se, assuming the slave has clock stretching implemented.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 13:53:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-loss-of-arbitration-on-LPC5512/m-p/1520592#M50112</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2022-09-12T13:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: I2C loss of arbitration on LPC5512</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-loss-of-arbitration-on-LPC5512/m-p/1955239#M56870</link>
      <description>&lt;P&gt;How did you finally resolve this issue?&lt;/P&gt;&lt;P&gt;I'm asking as I think&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.nxp.com/t5/LPC-Microcontrollers/LPC5526-I2C-stuck-after-SCL-pulled-low-briefly/m-p/1954390" target="_self"&gt;I see a similar behavior&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;when I force SCL low for even a very short amount of time during times when the I2C bus is idle (for example manually with a push button). That is enough to stop the I2C system in my LPC5526 from working as expected.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 14:09:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-loss-of-arbitration-on-LPC5512/m-p/1955239#M56870</guid>
      <dc:creator>danielholala</dc:creator>
      <dc:date>2024-09-16T14:09:49Z</dc:date>
    </item>
  </channel>
</rss>

