<?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 can&amp;#39;t I stop this timer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75095/why-can-t-i-stop-this-timer</link><description>I defined a timer and start the timer when application open gps, it can prevent the timeout of star search failure; When the gps search star successful, I will turn off the timer. However, when the program was running, I found that after the GPS positioning</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 May 2021 03:05:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75095/why-can-t-i-stop-this-timer" /><item><title>RE: Why can't I stop this timer</title><link>https://devzone.nordicsemi.com/thread/311623?ContentTypeID=1</link><pubDate>Wed, 26 May 2021 03:05:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49c86038-9c73-48f8-8ab2-fadab6d4c355</guid><dc:creator>duxinglang</dc:creator><description>&lt;p&gt;Hi,thanks for you reply! I&amp;nbsp;will look at the documents.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have tried to perform these tasks in a workqueue, but the fact is that must be finished before a task processing will be the next mission, in many cases, our application needs to start at the same time, for example when connected to the network to send data, also will be required to open the GPS, in order to avoid this kind of waiting, so I didn&amp;#39;t set up three job queue. &amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why can't I stop this timer</title><link>https://devzone.nordicsemi.com/thread/311528?ContentTypeID=1</link><pubDate>Tue, 25 May 2021 14:21:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd9d6441-1d0c-4e13-9eec-ec1f94247e20</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi, and sorry for the late answer.&lt;/p&gt;
&lt;p&gt;Why do you need three workqueues? In most cases, one should be enough (just make sure you avoid deadlocks by having one task wait for another).&lt;/p&gt;
&lt;p&gt;As for how to send messages between threads, I recommend you read through Zephyr&amp;#39;s documentation about the different kernel services: &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/index.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/index.html#&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There you will find different solutions ranging from simple semaphores, to more complex solutions such as message queues, mailboxess and pipes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why can't I stop this timer</title><link>https://devzone.nordicsemi.com/thread/310889?ContentTypeID=1</link><pubDate>Fri, 21 May 2021 02:15:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:215c64ed-85e4-4907-8efa-c2c688255aad</guid><dc:creator>duxinglang</dc:creator><description>&lt;p&gt;&lt;span class="transSent highlight"&gt;&lt;span&gt;Thanks for your help, I found that it seems to be the problem caused by multiple threads, actually in a single thread, the timer works correctly.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="transSent"&gt;&lt;span&gt;&amp;nbsp;So, this raises the question of how do I pass messages between different threads?&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="transSent"&gt;&lt;span&gt;&amp;nbsp;I have three work queues started in my current application, and I find that in addition to interruptions, I often have problems transferring messages between them. &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why can't I stop this timer</title><link>https://devzone.nordicsemi.com/thread/309845?ContentTypeID=1</link><pubDate>Fri, 14 May 2021 14:58:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:624370a3-848e-4dc5-b6b5-4ae8427d0a5c</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This code works for me, using NCS v1.5.0:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;kernel.h&amp;gt;

void timer_handler(struct k_timer *timer) {
	printk(&amp;quot;Timer handler\n&amp;quot;);
}

K_TIMER_DEFINE(my_timer, timer_handler, NULL);

void main(void)
{
	printk(&amp;quot;Timer stop test\n&amp;quot;);
	printk(&amp;quot;Starting timer\n&amp;quot;);
	k_timer_start(&amp;amp;my_timer, K_MSEC(300), K_NO_WAIT);
	printk(&amp;quot;Stopping timer\n&amp;quot;);
	k_timer_stop(&amp;amp;my_timer);
	printk(&amp;quot;Timer stopped\n&amp;quot;);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Are you sure k_timer_stop() is called, or that the timer hasn&amp;#39;t been restarted?&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>