<?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>Atomic FIFO bug report - calling nrf_atfifo_alloc_put twice in a row truncates data in atfifo buffer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49800/atomic-fifo-bug-report---calling-nrf_atfifo_alloc_put-twice-in-a-row-truncates-data-in-atfifo-buffer</link><description>I&amp;#180;m running on NRF52840 with SDK version 15.2.0 and trying to use atfifo, and I have observed a bug when writing to the atfifo buffer twice and then reading from the atfifo buffer. 
 The phenomenon: 
 1. I&amp;#180;m writing 4 bytes to atfifo but first 3 bytes</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 30 Jul 2019 08:46:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49800/atomic-fifo-bug-report---calling-nrf_atfifo_alloc_put-twice-in-a-row-truncates-data-in-atfifo-buffer" /><item><title>RE: Atomic FIFO bug report - calling nrf_atfifo_alloc_put twice in a row truncates data in atfifo buffer</title><link>https://devzone.nordicsemi.com/thread/201166?ContentTypeID=1</link><pubDate>Tue, 30 Jul 2019 08:46:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ccee924-8f26-4c47-b544-09997696646e</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;It&amp;#39;s possible. In any case, it has been reported so we just need to wait.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Atomic FIFO bug report - calling nrf_atfifo_alloc_put twice in a row truncates data in atfifo buffer</title><link>https://devzone.nordicsemi.com/thread/200922?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2019 09:26:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9da0d86-4e20-46b3-bbab-a362425a0b7f</guid><dc:creator>mk2</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;How is it going with this issue? Is it perhaps delayed because of summer vacation?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Atomic FIFO bug report - calling nrf_atfifo_alloc_put twice in a row truncates data in atfifo buffer</title><link>https://devzone.nordicsemi.com/thread/198873?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 07:51:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1047c98b-48a6-4bcd-bfe2-7bd76aa7daf9</guid><dc:creator>mk2</dc:creator><description>&lt;p&gt;Well that doesn&amp;acute;t surprise me.&lt;/p&gt;
&lt;p&gt;I &lt;strong&gt;intentionally&lt;/strong&gt; wrote those two examples because write-read-write and write-write-read should end up in same result if it is a FIFO.&lt;/p&gt;
&lt;p&gt;Moreover, if the first element I write to the FIFO is 0x000000A9 4 bytes, then I will and should expect getting same value back when reading 4 bytes from the FIFO.&lt;/p&gt;
&lt;p&gt;And I would like to know why this is happening too.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Atomic FIFO bug report - calling nrf_atfifo_alloc_put twice in a row truncates data in atfifo buffer</title><link>https://devzone.nordicsemi.com/thread/198786?ContentTypeID=1</link><pubDate>Tue, 16 Jul 2019 16:19:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6ffa43f-6f3f-4c2e-aa71-a97aca8cb4b1</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I changed the order of nrf_atfifo_alloc_put(m_data_atfifo, data, data_size, NULL) and nrf_atfifo_alloc_put(m_data_atfifo, data, data_size, NULL) at the end, and then got 30201A9 in both cases.&lt;/p&gt;
&lt;p&gt;I changed the code to this&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    nrf_atfifo_alloc_put(m_data_atfifo, &amp;amp;data_size, sizeof(data_size), NULL);
    nrf_atfifo_alloc_put(m_data_atfifo, data, data_size, NULL);

    uint32_t get_size = 0;
    nrf_atfifo_get_free(m_data_atfifo, &amp;amp;get_size, sizeof(get_size), NULL);
    NRF_LOG_INFO(&amp;quot;1. get_size: %x&amp;quot;, get_size);

    nrf_atfifo_clear(m_data_atfifo);


    nrf_atfifo_alloc_put(m_data_atfifo, &amp;amp;data_size, sizeof(data_size), NULL);
    nrf_atfifo_alloc_put(m_data_atfifo, data, data_size, NULL);
    nrf_atfifo_get_free(m_data_atfifo, &amp;amp;get_size, sizeof(get_size), NULL);
    NRF_LOG_INFO(&amp;quot;2. get_size: %x&amp;quot;, get_size);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you do it in this order get_size will be the same in both cases.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>