<?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 recover from timeout</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12548/twi-recover-from-timeout</link><description>I am using the TWI module in master mode, with sdk 10. I purposely create an error situation, in which the TWI gets stuck and keeps returning NRF_ERROR_BUSY every time I try to initiate a transfer. How may the device recover from this block? I have tried</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 30 Mar 2016 09:34:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12548/twi-recover-from-timeout" /><item><title>RE: TWI recover from timeout</title><link>https://devzone.nordicsemi.com/thread/47634?ContentTypeID=1</link><pubDate>Wed, 30 Mar 2016 09:34:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ec47d12-edb8-4576-97a0-035925061dbd</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;What is the build code of the chip you are using (for example QFACA1)? Could you upload a logic analyzer or oscilloscope capture of the lines right before the twi stops working (when the lines are pulled to ground)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI recover from timeout</title><link>https://devzone.nordicsemi.com/thread/47633?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2016 13:48:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:136d138a-ed05-40f2-8bee-a58a0d045130</guid><dc:creator>AmiguelS</dc:creator><description>&lt;p&gt;The problem only arises when The SDA/SCL lines are briefly forced to GND, not when left floating. I have ported everything to SDK 11 and performed the same test and the results are the same. When the lines are pulled to ground the module seems to stop working entirely.
I have moved on from this test as its a very particular and weird event to occur.&lt;/p&gt;
&lt;p&gt;I have been able to confirm the TWI drivers from SDK 11 include a mechanism to report un acknowledge transfers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI recover from timeout</title><link>https://devzone.nordicsemi.com/thread/47632?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 13:41:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a5989c4-0335-4d51-b015-49dea2db4c63</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;What is the device in the other end? If you pull the SDA/SCL lines to GND the twi hardware peripheral will not work. Do you get the same problem if you leave the lines floating all the time?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI recover from timeout</title><link>https://devzone.nordicsemi.com/thread/47631?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 10:31:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bcffcda-95dd-4911-9567-28ab4be79a9e</guid><dc:creator>AmiguelS</dc:creator><description>&lt;p&gt;Once the error is introduced (pull SDA/SCL to GND) and detected, the TWI module is re-initialized (including the above mentioned flag clear) and the following happens:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nrf_drv_twi_tx()&lt;/code&gt;/&lt;code&gt;nrf_drv_twi_rx()&lt;/code&gt; returns &lt;code&gt;NRF_SUCCESS&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;However, SDA/SCL lines have no transitions, they are completely still&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nrf_drv_twi_int_handler()&lt;/code&gt; is never called again&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Porting to SDK11 is not an option as I need the functionalities offered specifically by SDK10 (S110)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI recover from timeout</title><link>https://devzone.nordicsemi.com/thread/47630?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 09:42:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82af1f7b-d783-4001-aa52-a58b4c7886c0</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Could be a number of things. Have you monitored the physcal lines with logic analyzer/oscilloscope to see if e.g. the stop condition is issued? Can you check if the &lt;code&gt;nrf_drv_twi_int_handler(..)&lt;/code&gt; is called at all? Could you try with SDK 11 to see if this works (you may be able to just port the files)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI recover from timeout</title><link>https://devzone.nordicsemi.com/thread/47629?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 09:15:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d9e05f5-73b2-4eab-b80a-bb3644e28324</guid><dc:creator>AmiguelS</dc:creator><description>&lt;p&gt;By using the mentioned line, &lt;code&gt;nrf_drv_twi_tx()&lt;/code&gt; and &lt;code&gt;nrf_drv_twi_rx&lt;/code&gt; no longer return &lt;code&gt;BUSY&lt;/code&gt;, returning &lt;code&gt;NRF_SUCCESS&lt;/code&gt; instead. However, communication still fails, as the callback function is never called. The module till seems to be &amp;quot;stuck&amp;quot; in some operation, even though the flag has been cleared. Is there any other operation needed to completely reset the module?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI recover from timeout</title><link>https://devzone.nordicsemi.com/thread/47628?ContentTypeID=1</link><pubDate>Tue, 15 Mar 2016 17:04:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab49e0f6-14b7-4cb0-9f8f-957140d28644</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Yes, I was mixing with the local variable &lt;code&gt;is_busy&lt;/code&gt; in &lt;code&gt;twi_transfer(..)&lt;/code&gt;, answer updated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI recover from timeout</title><link>https://devzone.nordicsemi.com/thread/47635?ContentTypeID=1</link><pubDate>Tue, 15 Mar 2016 15:36:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19f772cd-98c0-4047-9515-8dc2eaa1867a</guid><dc:creator>AmiguelS</dc:creator><description>&lt;p&gt;The struct &lt;code&gt;twi_control_block_t&lt;/code&gt; in SDK 10 differs from the one in SDK11. Your answer implies the use of the SDK11 struct, as there is no such field as &lt;code&gt;busy&lt;/code&gt; in SDK10 &lt;code&gt;twi_control_block_t&lt;/code&gt;. The available fields are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;state&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;substate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;transfer_in_progress&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;transfer&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Could the solution be related to setting  &lt;code&gt;transfer_in_progress&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI recover from timeout</title><link>https://devzone.nordicsemi.com/thread/47627?ContentTypeID=1</link><pubDate>Tue, 15 Mar 2016 10:33:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19adc4b5-24ab-4124-8bb9-6f489924d729</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Problem is that a busy flag in an internal structure is not set to false when initializing the driver. This has been fixed in SDK 11. Either update to SDK 11 or add this line to nrf_drv_twi_init(..):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;m_cb[p_instance-&amp;gt;instance_id].transfer_in_progress = false;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>