<?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>Why is CONFIG_MAIN_THREAD_PRIORITY=7 in mqtt_simpe?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55067/why-is-config_main_thread_priority-7-in-mqtt_simpe</link><description>CONFIG_MAIN_THREAD_PRIORITY=7 
 I read prj.conf of mqtt_simple. Why is the value of 7 given? 
 https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/master/samples/nrf9160/mqtt_simple/prj.conf 
 This is definition of CONFIG_MAIN_THREAD_PRIORITY.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 05 Dec 2019 10:28:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55067/why-is-config_main_thread_priority-7-in-mqtt_simpe" /><item><title>RE: Why is CONFIG_MAIN_THREAD_PRIORITY=7 in mqtt_simpe?</title><link>https://devzone.nordicsemi.com/thread/223840?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 10:28:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:282d3610-b678-42d4-9715-2686ed9eead4</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;That depends on what you are planing with your application.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You do not &lt;em&gt;need&lt;/em&gt; to change it, but you could if you want some threads to be prioritized over the other.&lt;/p&gt;
&lt;p&gt;To understand how this works I would recommend checking out the documentation links posted in my last post.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why is CONFIG_MAIN_THREAD_PRIORITY=7 in mqtt_simpe?</title><link>https://devzone.nordicsemi.com/thread/223814?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 09:31:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ae621bf-0d61-4adf-aec8-25048dd3084b</guid><dc:creator>Yusuke</dc:creator><description>&lt;p&gt;I see. So I shouldn&amp;#39;t basically change the value, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why is CONFIG_MAIN_THREAD_PRIORITY=7 in mqtt_simpe?</title><link>https://devzone.nordicsemi.com/thread/223785?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 08:15:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fc5c123-5278-496e-af95-ded05f76659e</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Yusuke,&lt;/p&gt;
&lt;p&gt;Yes,&amp;nbsp;since the main thread is a&amp;nbsp;&lt;em&gt;preemptible thread&amp;nbsp;&lt;/em&gt;it can have non-negative priority values. (e.g. 0,1,2,3..)&lt;/p&gt;
&lt;p&gt;(&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/threads/index.html#thread-priorities" rel="noopener noreferrer" target="_blank"&gt;&amp;quot;&lt;/a&gt;&lt;span&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/threads/index.html#thread-priorities" rel="noopener noreferrer" target="_blank"&gt;The kernel supports a virtually unlimited number of thread priority levels&amp;quot;&lt;/a&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Just set the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kconfig/CONFIG_MAIN_THREAD_PRIORITY.html#cmdoption-arg-config-main-thread-priority" rel="noopener noreferrer" target="_blank"&gt;value &lt;/a&gt;inside the &lt;strong&gt;prj.conf:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_MAIN_THREAD_PRIORITY=7&lt;/pre&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;This will affect how the scheduler allows the threads to share the CPU.&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;More details on this are described in the&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/scheduling/index.html#preemptive-time-slicing" rel="noopener noreferrer" target="_blank"&gt; Scheduling documentation.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Martin L.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why is CONFIG_MAIN_THREAD_PRIORITY=7 in mqtt_simpe?</title><link>https://devzone.nordicsemi.com/thread/223754?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 05:30:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72d7a0f2-af4d-4699-bf22-c956451896f5</guid><dc:creator>Yusuke</dc:creator><description>&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;I see. Can I&amp;nbsp;configure&amp;nbsp;&lt;span&gt;CONFIG_MAIN_THREAD_PRIORITY=1,2,3,4,5 or 6?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why is CONFIG_MAIN_THREAD_PRIORITY=7 in mqtt_simpe?</title><link>https://devzone.nordicsemi.com/thread/223600?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2019 13:01:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99ef6f09-7932-469c-a9a3-1bb5261b0225</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Yusuke,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please check out &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/threads/index.html#thread-priorities" rel="noopener noreferrer" target="_blank"&gt;the documentation of Thread priority.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Lower values mean higher priority.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Typical values in NCS are&lt;/em&gt;:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;-2 for MCUboot&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;0 for SPM&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;7 for regular applications&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>