<?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>Meaning of TWI overrun flag in master mode</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7795/meaning-of-twi-overrun-flag-in-master-mode</link><description>What is the purpose of the TWI overrun flag given that the TWI peripheral only supports master mode? 
 I have the following code in an ISR for my TWI acting as master. 
 if(0 != I2C_TWIX-&amp;gt;EVENTS_ERROR)
{
 /* An error has occurred. Clear all the flags</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Jun 2015 09:07:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7795/meaning-of-twi-overrun-flag-in-master-mode" /><item><title>RE: Meaning of TWI overrun flag in master mode</title><link>https://devzone.nordicsemi.com/thread/27763?ContentTypeID=1</link><pubDate>Fri, 26 Jun 2015 09:07:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3495242-417d-477b-b921-3b9db73272ea</guid><dc:creator>Carl</dc:creator><description>&lt;p&gt;So from what you describe I think the manual is wrong in its description and the overrun flag is set if a byte would enter the receive buffer before the previous is read (which does not require a start condition). This makes sense, although it is particularly confusing because this flag would not be necessary at all if the clock was stretched automatically as stated in the manual. What I&amp;#39;m left wondering is whether the flag can also be set for some other reason (e.g. a transient low pulse on SDA or SCL when the master is not clocking), or whether this behaviour means I&amp;#39;ve got a bug where I&amp;#39;m occasionally not setting SUSPEND properly. I&amp;#39;ll have another look and see if I can spot something, and otherwise hope to hear from someone at Nordic about the flag. Thanks again for your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Meaning of TWI overrun flag in master mode</title><link>https://devzone.nordicsemi.com/thread/27762?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2015 12:22:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aff97b3f-bdca-4d29-971b-99d9b03c105a</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;It was a while ago but I did some abusive testing of the peripheral and yes got the overrun if I didn&amp;#39;t use the shortcut and didn&amp;#39;t service the RXD event. The overrun came when one byte had been read in, there was no shortcut to suspend the peripheral and (despite the manual saying otherwise) it just continued on with another start and clocked in more data from the peripheral, as soon as that happened there was an overrun as the byte hadn&amp;#39;t been read from RXD.&lt;/p&gt;
&lt;p&gt;If you&amp;#39;re using the shortcuts and suspending the peripheral and reading RXD before you restart the read, then I too cannot come up with a way you get an overrun. I certainly haven&amp;#39;t seen one since I put that code in.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Meaning of TWI overrun flag in master mode</title><link>https://devzone.nordicsemi.com/thread/27761?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2015 10:44:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73a5a335-bfd5-41c8-aed5-722b18111162</guid><dc:creator>Carl</dc:creator><description>&lt;p&gt;Hi RK, thanks for the idea. I think I saw your question before when I first designed the driver; it made things much clearer than the manual. I&amp;#39;m already using the SUSPEND shortcut. I set the shortcut before each byte except the last one of a transaction, where I set the STOP shortcut instead. In any case, according to the manual the &amp;quot;overrun&amp;quot; condition should be set when a start condition occurs. The situation you describe should not result in a new start condition. Your question doesn&amp;#39;t mention the overrun flag; are you seeing the overrun flag in the situation you describe?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Meaning of TWI overrun flag in master mode</title><link>https://devzone.nordicsemi.com/thread/27760?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2015 01:44:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16e1836e-5d31-4cdd-921c-b02e69bc86e1</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Are you using the shortcut BB-&amp;gt;SUSPEND shown in the manual (and I assume used in the reference code)?&lt;/p&gt;
&lt;p&gt;Your question reminded me of one I asked a while ago where I decided the manual wasn&amp;#39;t totally accurate about &amp;#39;stretching the clock until RXD is read&amp;#39;, that&amp;#39;s here, see if that matches what you&amp;#39;re seeing at all.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/question/17472/is-it-necessary-to-suspend-twi-for-each-byte-read/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you&amp;#39;re not suspending the read on a byte boundary, or you&amp;#39;re not doing it with a shortcut but in code, you may occasionally fail to stretch the clock after an ACK and the next byte will be clocked in causing an overrun.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>