<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23601/twi-stops-working---sda-bus-always-low</link><description>Hi! 
 I&amp;#39;m developing a project with nrf52832 and I&amp;#39;m getting some problems. The micro is only communicating with an accelerometer (MMA8453) and after some time the communication stops. Using a digital analyzer is possible observe that the SDA bus get</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 11 Sep 2017 10:01:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23601/twi-stops-working---sda-bus-always-low" /><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92743?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2017 10:01:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6730f87-acff-4fb2-9058-64fa1ce90252</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Thanks. So just so I have it clear:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You have tried two or more slave devices?&lt;/li&gt;
&lt;li&gt;You have tried two or more master devices?&lt;/li&gt;
&lt;li&gt;The first image seems to show a working transfer of two bytes with the receiving device ACKing and then a repeated start to the right in the image?&lt;/li&gt;
&lt;li&gt;The second image seems to show both SDA and SCL pulled to ~3.3V, with a weird spike at the beginning?&lt;/li&gt;
&lt;li&gt;The waveforms themselves in your images seems fine. How are the GPIOs configured in these tests?&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92739?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 07:54:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a91c6a18-810a-4ea4-8ac9-34e2d4934078</guid><dc:creator>Rafa</dc:creator><description>&lt;p&gt;here is two screenshots. It&amp;#39;s messing one that is when the I2C stops working. The SCL line is UP but the SDA is LOW and it only works when we force SCL to go LOW.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://ibb.co/gs7GPF"&gt;https://ibb.co/gs7GPF&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ibb.co/mCLEBv"&gt;https://ibb.co/mCLEBv&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92741?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 13:42:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ae05075-043e-4efb-a55b-f8235ba0fbc9</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Do you mind attaching some screenshots in your original question? I was looking at &lt;a href="https://www.i2c-bus.org/i2c-primer/analysing-obscure-problems/"&gt;this&lt;/a&gt; and figured it might be that (due to poor signal conditions) some clock pulses are missed by the receiver and then it just stalls while waiting for more bits.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92740?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 13:23:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c64f5ed-fded-43b0-b5d8-fc35a230dfa9</guid><dc:creator>Rafa</dc:creator><description>&lt;p&gt;Dear @Martin Børs-Lind, thank you for your answer.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I already used an oscilloscope to look at the signals. During some tests it seems that, when SDA line is waiting for an SCL variation, that variation never comes up and if I force the SCL pin to LOW/HIGH (deepening on the state it was stuck), the communication start working again.
-I already tried with my circuit and also with a nRF52 devkit. The behavior is the same. In another test with a different slave, even if I change the GPIO settings, TWI stops working.&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92742?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 12:42:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9410966d-1a8b-4d6f-85f3-2f76b2694d4e</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;@RK: Where in the documentation does it explicitly say that GPIO settings only matter when the peripheral is disabled? That may not be entirely correct.&lt;/p&gt;
&lt;p&gt;I talked to one of our TWI architects and he said that the GPIO settings actually do influence the pin even when the TWI is enabled. In other words, changing the drive strength from S0D1 to S0S1 will have an effect on the TWI bus. In light of this I suppose OP&amp;#39;s issue might be related to the impedance of the TWI lines. The fact that lowering the frequency helps seems to support this.&lt;/p&gt;
&lt;p&gt;@Rafa:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Are you able to look at the signals using an oscilloscope? Maybe the nRF52 struggles to drive the lines to correct voltage levels, and that might be easier to spot using an oscilloscope rather than a logic analyzer.&lt;/li&gt;
&lt;li&gt;Have you tried a different nRF52 device?&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92747?ContentTypeID=1</link><pubDate>Wed, 06 Sep 2017 09:39:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e5c3e40-89e1-47fd-95a4-d0ad7d01881e</guid><dc:creator>Rafa</dc:creator><description>&lt;p&gt;Hi, No I haven&amp;#39;t. I&amp;#39;m using SDK 13 but it stills happening. I&amp;#39;m traying to find a solution but for now I didn&amp;#39;t find it. Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92746?ContentTypeID=1</link><pubDate>Thu, 31 Aug 2017 08:06:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f35a3a21-81a2-4be4-8a3f-b9a366f27c86</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi, Have you managed to solve this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92737?ContentTypeID=1</link><pubDate>Wed, 19 Jul 2017 10:49:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ce82c5f-93a1-4a02-a643-9aa379d88317</guid><dc:creator>Rafa</dc:creator><description>&lt;p&gt;I understand and I agree with you but, in practice something is happening. I left some demo working all night and in the morning it was working. If I change that, it crash after a few minutes.
When I change the frequency of TWI to 100K it works a little longer.
I know that&amp;#39;s not the solution, thats why I&amp;#39;m asking for some help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92738?ContentTypeID=1</link><pubDate>Wed, 19 Jul 2017 09:59:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36d9c0e1-c547-4f8f-8cc8-fb9470f05df3</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;That post has nothing at all to do with TWI, that&amp;#39;s only concerned with drive strength when the pins are used as normal GPIOs. It doesn&amp;#39;t mention TWI at all. So if changing that made a difference it&amp;#39;s a total fluke and your bug, whatever it is, still persists.&lt;/p&gt;
&lt;p&gt;The manual is very clear that the GPIO settings ONLY matter when the peripheral is disabled. When the TWI is active, it takes full control of the pins and detaches them entirely from the GPIO system. Also the manual stipulates S0D1 must be used as the drive strength on the pins (for when the TWI is disabled and they are acting as regular GPIOs).&lt;/p&gt;
&lt;p&gt;So you may have masked your problem, but that is not the solution, and you&amp;#39;ve a fairly good chance it&amp;#39;s coming back at some point.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92745?ContentTypeID=1</link><pubDate>Wed, 19 Jul 2017 08:53:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b9ba6dc-0d3d-4335-b2e9-85202707c6dd</guid><dc:creator>Rafa</dc:creator><description>&lt;p&gt;I&amp;#39;m using SDK 13.0.
Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92735?ContentTypeID=1</link><pubDate>Wed, 19 Jul 2017 08:53:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63b0fd9e-ef3e-44e2-a4e7-0424ad353e7a</guid><dc:creator>Rafa</dc:creator><description>&lt;p&gt;According to  &lt;a href="https://devzone.nordicsemi.com/question/22112/nrf51822-gpio-as-open-collector-driver/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt; that&amp;#39;s not true. When I changed the from GPIO_PIN_CNF_DRIVE_S0D1 to GPIO_PIN_CNF_DRIVE_S0S1 the bus starts working fine.
I already tried with different slaves, accelerometer, then with an arduino (with level shifter) and the problem persists.
So far, changing this configuration was the only solution that I found.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92744?ContentTypeID=1</link><pubDate>Wed, 19 Jul 2017 05:26:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32159c3f-2fe8-4c9d-ac62-ab4df5f0111c</guid><dc:creator>Michal</dc:creator><description>&lt;p&gt;Which SDK you are using? The SDK 12.3 came up with fixes in TWI driver. Best regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92736?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2017 23:10:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:526b7a65-4c2a-4521-b50e-377e5b97dc2e</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;The drive configuration of the pins is irrelevant once the TWI module takes control of them, it only matters when the chip is in a sleep mode where the pins need to be driven to a certain level. So you can change it as much as you like and it won&amp;#39;t make a difference.&lt;/p&gt;
&lt;p&gt;If SDA is being held low it&amp;#39;s because one of the two devices is holding it low. Unfortunately it&amp;#39;s rather hard to tell which that is unless you can measure the current into each device. You need to get some kind of analyzer trace of the signals and work out which device last had control of the bus, and why it&amp;#39;s not releasing it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI stops working - SDA bus always LOW</title><link>https://devzone.nordicsemi.com/thread/92748?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2017 18:42:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8f49047-fe30-4d78-b331-caba4ec05de7</guid><dc:creator>JTL</dc:creator><description>&lt;p&gt;Have you tried high drive&lt;code&gt;GPIO_PIN_CNF_DRIVE_H0H1&lt;/code&gt;rather than&lt;code&gt;GPIO_PIN_CNF_DRIVE_S0S1&lt;/code&gt;? Also, do you have the softdevice enabled? I had similar problems with my datalogger code, until I gave all SPI/TWI/ADC operations &lt;code&gt;APP_IRQ_PRIORITY_LOW&lt;/code&gt; and enabled the softdevice. I&amp;#39;m not actually using the softdevice for anything, but SPI/TWI/ADC ops are flaky unless it&amp;#39;s enabled.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>