<?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>app_fifo wrapping problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19725/app_fifo-wrapping-problem</link><description>The app_fifo support e.g. in SDK 12.1.0, appears to have a serious problem when the read_pos/write_pos values wrap. i.e. when the fifo has been used over a period of time, regardless of the configured fifo size, since the pos vars are continually incremented</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 22 Feb 2017 11:08:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19725/app_fifo-wrapping-problem" /><item><title>RE: app_fifo wrapping problem</title><link>https://devzone.nordicsemi.com/thread/76751?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 11:08:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:567a64c6-a748-4d71-a00d-f21165c35437</guid><dc:creator>Will</dc:creator><description>&lt;p&gt;Confirmed&lt;/p&gt;
&lt;p&gt;Many Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: app_fifo wrapping problem</title><link>https://devzone.nordicsemi.com/thread/76750?ContentTypeID=1</link><pubDate>Thu, 16 Feb 2017 10:40:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01eef35b-63d6-4301-9f2a-e1bfaac9de22</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;write_pos and read_pos are uint32_t (unsigned 32 bit integers) so&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;write_pos - read_pos
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;is essentially the same as&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;write_pos - read_pos + UINT32_MAX + 1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Where UINT32_MAX is 0xFFFFFFFF. Therefore the check&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FIFO_LENGTH() &amp;lt;= p_fifo-&amp;gt;buf_size_mask
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Will still be valid.&lt;/p&gt;
&lt;p&gt;For example see this &lt;a href="http://stackoverflow.com/questions/2760502/question-about-c-behaviour-for-unsigned-integer-underflow"&gt;post&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>