<?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>Unexpected warning</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68331/unexpected-warning</link><description>I am receiving an unexpected warning from nrf_atfifo_item_get that reports &amp;quot;Get failed - no item in the FIFO.&amp;quot; This occurs when I start advertising using 
 void advertising_start(bool erase_bonds) 
 This calls bsp_led_indication which calls app_timer_start</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 17 Nov 2020 12:18:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68331/unexpected-warning" /><item><title>RE: Unexpected warning</title><link>https://devzone.nordicsemi.com/thread/280338?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2020 12:18:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19ed058c-8759-40b4-9a49-c3cca04fba8c</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Ok, I&amp;#39;m convinced&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What time period are you using? Could you share your code? You could of course modify the code any way you would like, but it&amp;#39;s not recommended, as a consequence can make errors not handled properly.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected warning</title><link>https://devzone.nordicsemi.com/thread/280330?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2020 11:45:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67cfb2e9-ffd0-4c68-9a34-02c545c75c24</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;The following is a workaround that resets the head of the FIFO queue to its original value after the check so that it correctly returns the next item and avoids the call that would return an empty queue message.&lt;/p&gt;
&lt;p&gt;/**&lt;br /&gt;&amp;nbsp;* @brief Function for processing user requests.&lt;br /&gt;&amp;nbsp;*&lt;br /&gt;&amp;nbsp;* Function is called only in the context of RTC interrupt.&lt;br /&gt;&amp;nbsp;*/&lt;br /&gt;static void timer_req_process(drv_rtc_t const * const&amp;nbsp; p_instance)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_atfifo_item_get_t fifo_ctx;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer_req_t *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_req;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;bool&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;req = nrf_atfifo_item_check(m_req_fifo, &amp;amp;fifo_ctx);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (req)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_req_fifo-&amp;gt;head.tag = fifo_ctx.last_head.tag;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_req_fifo-&amp;gt;head.pos.wr = fifo_ctx.last_head.pos.wr;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_req_fifo-&amp;gt;head.pos.rd = fifo_ctx.last_head.pos.rd;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;p_req = nrf_atfifo_item_get(m_req_fifo, &amp;amp;fifo_ctx);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (p_req-&amp;gt;type)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected warning</title><link>https://devzone.nordicsemi.com/thread/280323?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2020 11:20:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d295362-58bd-4bea-bcc7-1d1d32638d83</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;I have not tested but this problem with nrf_atfifo_item_check could affect other routines such as in nrf_fstorage_sd.c in the following:&lt;/p&gt;
&lt;p&gt;/* Load a new operation from the queue. */&lt;br /&gt;static bool queue_load_next(void)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (nrf_atfifo_item_check(m_fifo, &amp;amp;m_iget_ctx)) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_p_cur_op = nrf_atfifo_item_get(m_fifo, &amp;amp;m_iget_ctx);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (true);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;} else {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return (false);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected warning</title><link>https://devzone.nordicsemi.com/thread/280296?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2020 10:04:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef163064-266a-4d16-adc0-7bd2ede183a6</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;Got it. This version of app_timer2 uses nrf_atfifo_item_check to control the loop, but by using nrf_atfifo_rspace_req it removes the item so preventing getting an item from the fifo.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;static void timer_req_process(drv_rtc_t const * const&amp;nbsp; p_instance)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_atfifo_item_get_t fifo_ctx;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer_req_t *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_req;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;bool&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;req = nrf_atfifo_item_check(m_req_fifo, &amp;amp;fifo_ctx);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (req)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;p_req = nrf_atfifo_item_get(m_req_fifo, &amp;amp;fifo_ctx);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (p_req-&amp;gt;type)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Other versions of timer_req_process do not check and use the call to nrf_atfifo_item_get and its return to control the loop, but this generates a warning on any check.&lt;/p&gt;
&lt;p&gt;/**&lt;br /&gt;&amp;nbsp;* @brief Function for processing user requests.&lt;br /&gt;&amp;nbsp;*&lt;br /&gt;&amp;nbsp;* Function is called only in the context of RTC interrupt.&lt;br /&gt;&amp;nbsp;*/&lt;br /&gt;static void timer_req_process(drv_rtc_t const * const&amp;nbsp; p_instance)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_atfifo_item_get_t fifo_ctx;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer_req_t *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_req = nrf_atfifo_item_get(m_req_fifo, &amp;amp;fifo_ctx);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (p_req)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (p_req-&amp;gt;type)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It appears nrf_atfifo_item_check needs to be corrected so that it does not remove the item from the fifo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected warning</title><link>https://devzone.nordicsemi.com/thread/280288?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2020 09:54:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6938d6f6-61db-460e-9d5c-89bb63f7dcf0</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;Apologies It appears there is something else going on.&lt;/p&gt;
&lt;p&gt;nrf_atfifo_item_check calls nrf_atfifo_rspace_req the first time and reports there is something in the fifo, but in the second call it reports there is nothing in the fifo.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected warning</title><link>https://devzone.nordicsemi.com/thread/280275?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2020 09:26:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f7d299e-453c-463d-b05f-3d4966062b72</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;I cannot follow this code:&lt;/p&gt;
&lt;p&gt;app_timer_start places a request on the atfifo stack to start a timer. It then requests the timer to do an interrupt that then enacts the request that has been placed on the atfifo stack. So far so good, even if I do not follow the reasoning.&lt;/p&gt;
&lt;p&gt;However in the code for timer_req_process I see the line req = nrf_atfifo_item_check(m_req_fifo, &amp;amp;fifo_ctx);, which calls the routine with the address of a variable on the stack that is so far not initialised.&lt;/p&gt;
&lt;p&gt;/**&lt;br /&gt;&amp;nbsp;* @brief Function for processing user requests.&lt;br /&gt;&amp;nbsp;*&lt;br /&gt;&amp;nbsp;* Function is called only in the context of RTC interrupt.&lt;br /&gt;&amp;nbsp;*/&lt;br /&gt;static void timer_req_process(drv_rtc_t const * const&amp;nbsp; p_instance)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_atfifo_item_get_t fifo_ctx;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer_req_t *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_req;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bool&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;req = nrf_atfifo_item_check(m_req_fifo, &amp;amp;fifo_ctx);&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;And then in nrf_atfifo_item_check the address of an element in fifo_ctx is passed to another routine. As fifo_ctx is uninitialised it will pass rubbish to the nrf_atfifo_rspace_req routine as the address of last_head.&lt;/p&gt;
&lt;p&gt;void * nrf_atfifo_item_get(nrf_atfifo_t * const p_fifo, nrf_atfifo_item_get_t * p_context)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (nrf_atfifo_rspace_req(p_fifo, &amp;amp;(p_context-&amp;gt;last_head)))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected warning</title><link>https://devzone.nordicsemi.com/thread/279960?ContentTypeID=1</link><pubDate>Fri, 13 Nov 2020 15:59:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa29e7c1-099f-4048-bbd6-d147b39a954c</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;I have started from an example but the code is substantially modified. Here is the call stack&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;nrf_atfifo_item_get&lt;br /&gt;timer_req_process&lt;br /&gt;rtc_irq&lt;br /&gt;RTC1_IRQHandler&lt;br /&gt;&amp;lt;Exception frame&amp;gt;&lt;br /&gt;drv_rtc_irq_trigger&lt;br /&gt;timer_request_proc_trigger&lt;br /&gt;timer_req_schedule&lt;br /&gt;app_timer_start&lt;br /&gt;application_timers_start&lt;br /&gt;ble_device_init&lt;br /&gt;main&lt;br /&gt;[_call_main + 0xd]&lt;/p&gt;
&lt;p&gt;I have a similar issue in bsp_button. When a button is pressed it calls a timer, which never calls the timeout routine. It appears nothing is put in the timer queue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected warning</title><link>https://devzone.nordicsemi.com/thread/279936?ContentTypeID=1</link><pubDate>Fri, 13 Nov 2020 14:13:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c61aa86d-73e3-4b6b-a327-dbb6f3eebf00</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not really sure if the error is due to the function call to&amp;nbsp;&lt;span&gt;app_timer_start(). Set a breakpoint where the log is printed, and share the call stack from debug view.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The error is returned if you try to retrieve a char from the FIFO when it&amp;#39;s empty.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Are you using an example from the SDK, which one?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jared&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>