<?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>nRF9160 Dynamic Threads</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75058/nrf9160-dynamic-threads</link><description>Hi, I trying to integrate a thread inside a function to run in parallel with the main program. 
 I have tried the THEAD_DEFINE function and it works but it is static and has to run at the start of the program run time. 
 
 
 
 I am also trying with thread_create</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 12 May 2021 12:30:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75058/nrf9160-dynamic-threads" /><item><title>RE: nRF9160 Dynamic Threads</title><link>https://devzone.nordicsemi.com/thread/309500?ContentTypeID=1</link><pubDate>Wed, 12 May 2021 12:30:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43a90f85-aec4-4772-92aa-392d7ca5f9b5</guid><dc:creator>AMG</dc:creator><description>&lt;p&gt;Hi Didrik,&lt;br /&gt;&lt;br /&gt;I don&amp;#39;t know how I missed that thanks for the help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 Dynamic Threads</title><link>https://devzone.nordicsemi.com/thread/309492?ContentTypeID=1</link><pubDate>Wed, 12 May 2021 12:18:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d31b9425-c2df-4b14-81a4-9d166375fedb</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;You should have K_THREAD_STACK_SIZEOF(my_stack_area), not STACKSIZE.&lt;/p&gt;
&lt;p&gt;If that doesn&amp;#39;t help, could you try to enable logging (CONFIG_LOG=y), or use a debugger to try to see what is actually causing the crash?&lt;/p&gt;
&lt;p&gt;When enabling logging, you might also need to set CONFIG_RESET_ON_FATAL_ERROR=n and/or CONFIG_LOG_IMMEDIATE=y.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 Dynamic Threads</title><link>https://devzone.nordicsemi.com/thread/309480?ContentTypeID=1</link><pubDate>Wed, 12 May 2021 11:51:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:830818b7-c88b-443e-a9a3-5529dcaee76b</guid><dc:creator>AMG</dc:creator><description>&lt;p&gt;Hi Didrik,&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Yes, followed the documentation and got a dump as I mentioned. If I try to run a gps thread this is how I have it.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define STACKSIZE 4096
#define PRIORITY 7



K_THREAD_STACK_DEFINE(my_stack_area, STACKSIZE);
struct k_thread my_thread_data;
extern int gps(void *, void *, void *);

k_thread_create(&amp;amp;my_thread_data, my_stack_area, K_THREAD_STACK_SIZEOF(STACKSIZE), gps, NULL, NULL, NULL, PRIORITY, 0, K_NO_WAIT);&lt;/pre&gt;&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: nRF9160 Dynamic Threads</title><link>https://devzone.nordicsemi.com/thread/309474?ContentTypeID=1</link><pubDate>Wed, 12 May 2021 11:45:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b52dee7f-32c7-4e6d-b014-f197e81f10c4</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Have you followed the documentation on how to set up the stack area and thread?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/threads/index.html#spawning-a-thread"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/threads/index.html#spawning-a-thread&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>