<?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>About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85406/about-queue-library-sdk-17-1-0</link><description>Hi, Nordic 
 Recently, I&amp;#39;m experimenting with the queue library. 
 I found some strange problems: 
 1. When the data types of my data structure members are not unique, using queue will cause the whole system to crash without even error codes 
 
 The whole</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Mar 2022 10:11:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85406/about-queue-library-sdk-17-1-0" /><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/358590?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2022 10:11:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56053613-22dd-4040-a85d-177b799c4b69</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;OK. I&amp;#39;ll close this then, since the original issue has been resolved.&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/358517?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2022 01:59:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8eb6fa2-6c75-4b23-8d43-a4a71329e9b5</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;In the future, if I have any questions, I&amp;#39;ll send another ticket to ask your official staff. Thank you for your patience&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/358516?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2022 01:57:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8bd742e-8bc0-4854-b8ab-21166ed8614d</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;Hello, it&amp;#39;s strange that after I upgraded the version of SES this week, there was no crash under the same code conditions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/357690?ContentTypeID=1</link><pubDate>Fri, 11 Mar 2022 14:00:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3058ed2-e09e-494b-bc86-b2fb26dd92e5</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;I&amp;#39;ll reply tomorrow after confirmation. I don&amp;#39;t have my computer with me now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/357675?ContentTypeID=1</link><pubDate>Fri, 11 Mar 2022 13:30:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f885fd2c-147f-42aa-ba7c-beac3e5b269b</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;What will&amp;nbsp;sizeof(test_data) return in this case? Will it return 7? I&amp;#39;m asking because I&amp;#39;m not entirely sure that it equals the element count as the compiler might be increasing the size due to padding.&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: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/357005?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2022 00:46:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4037242-4460-4aed-bb53-777377f0c240</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;In addition, I still don&amp;#39;t understand why def uses its own data structure, and its member size can&amp;#39;t exceed 6. You can also try the following code snippet in the routine.&lt;pre class="ui-code" data-mode="c_cpp"&gt;typedef struct {
 uint8_t data[7];
} data_t;

NRF_QUEUE_DEF(data_t, m_data_queue, 255*sizeof(data_t), NRF_QUEUE_MODE_NO_OVERFLOW);

int main (void) {
    data_t test_data;
    
    test_data.data[0] = 0x01;
    test_data.data[1] = 0x01;
    test_data.data[2] = 0xAA
    test_data.data[3] = 0xBB;
    test_data.data[4] = 0xCC;
    test_data.data[5] = 0x03;
    test_data.data[6] = 0x04;
    
    ret = nrf_queue_write(&amp;amp;m_data_queue, &amp;amp;test_data.data, sizeof(test_data));
    APP_ERROR_CHECK(ret);
    
    data_t data_read;
    
    ret = nrf_queue_read(&amp;amp;m_data_queue, &amp;amp;data_read.data, sizeof(data_read));
    APP_ERROR_CHECK(ret);
}&lt;/pre&gt;When running to nrf_queue_write, the system will crash 100%. The phenomenon is like using a wild pointer to cause memory overflow. No error code will be reported&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/357002?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2022 00:40:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6b49cfd-9aa6-4243-a6e5-d9db3476c79b</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;It is only used to temporarily store fixed length data, and finally it will be written to flash. However, data storage and reading will be a little frequent, so first use the queue to cache these data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/357001?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2022 00:38:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5bfea707-2b72-457b-b143-89eca229b4ec</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;Well, maybe my usage scenario is so special that I don&amp;#39;t care about the standard of the queue and complain&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/356877?ContentTypeID=1</link><pubDate>Tue, 08 Mar 2022 12:37:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:040d98aa-6cd0-4e8d-a871-c7fef01df289</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Yes, that is correct. I believe the queue implementation in the SDK follows the normal definition of a queue. Is there a specific reason for why you&amp;#39;re using a queue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/356661?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2022 14:41:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4f95a78-e2ae-412c-a906-d7b3dfcd23ae</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;I have finished reading and writing, but now I have a new problem to confirm.&lt;/p&gt;
&lt;p&gt;Every time I finish reading, does it mean that I have taken out the data in the queue, and the data I have read no longer exists in the queue? In other words, for the purpose of query, I need to write back the read data again. Is this logic correct?&lt;/p&gt;
&lt;p&gt;By the way, the queue library is really difficult to use. Peek can only read the first byte of data. Pop and read will automatically clear the data out of the queue after reading the data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/356653?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2022 14:26:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35dc79c0-b173-42c7-b48d-1d13f028a6b0</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;It seems that the wrong parameter is passed to&amp;nbsp;nrf_queue_write() and&amp;nbsp;nrf_queue_read() in the first case. The third parameter should be the element count, not the size of the struct. Try replacing it with 1.&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: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/356426?ContentTypeID=1</link><pubDate>Sat, 05 Mar 2022 08:52:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02f038c0-274d-4722-8dfb-781266e51109</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;No, it hasn&amp;#39;t improved.&lt;/p&gt;
&lt;p&gt;Moreover, I found that as long as the data type parameters filled in &lt;span&gt;NRF_QUEUE_DEF&amp;nbsp;&lt;/span&gt;are user-defined structures, the number of members of that structure cannot be too many.&lt;/p&gt;
&lt;p&gt;Specifically, I tested in the second test segment. If the array in data_t is defined as data [7] or larger, there will be a problem.&lt;/p&gt;
&lt;p&gt;On the contrary, if the data type filled in NRF_QUEUE_DEF is uint8_ t. Then no matter how many members of the structure are, there is no problem.&lt;/p&gt;
&lt;p&gt;This phenomenon is very strange. It is reasonable to say that although the parameter passed into the actual operation function is a pointer, the space occupied by my structure members is a fixed size, so I don&amp;#39;t need to apply for additional memory. I can&amp;#39;t figure it out&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/356365?ContentTypeID=1</link><pubDate>Fri, 04 Mar 2022 14:55:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff4fb2b4-9c3e-48a9-b2dc-ebe755aad38e</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;Is the issue mitigated If you set data2 type to uint8_t instead of uint32_t?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/356132?ContentTypeID=1</link><pubDate>Thu, 03 Mar 2022 16:30:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc5a98ba-fada-4695-ad2f-79a0ebf320a9</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;Besides, my mother tongue is not English. Please forgive me for any strange expression.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Queue library (SDK 17.1.0)</title><link>https://devzone.nordicsemi.com/thread/356130?ContentTypeID=1</link><pubDate>Thu, 03 Mar 2022 16:27:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d60ab227-44fd-4d57-90ab-b3893746ea3a</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;In addition, I have seen in another ticket that it is recommended to use push instead of write in overwrite mode. This ticket will not tangle with this problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>