<?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>Delayable Work time deviation</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108471/delayable-work-time-deviation</link><description>Hello Platform: nrf5340dk 
 My problem is: when I&amp;#39;m calling k_work_reschedule(&amp;amp;Dwork,K_MSEC(100)) The work function is called after 109ms. I don&amp;#39;t understand why this 9 ms more delay appear. 
 I tried to find answer but I failed, could you help me? 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 20 Feb 2024 14:33:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108471/delayable-work-time-deviation" /><item><title>RE: Delayable Work time deviation</title><link>https://devzone.nordicsemi.com/thread/469832?ContentTypeID=1</link><pubDate>Tue, 20 Feb 2024 14:33:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d677b87a-49f0-40fe-948c-8ad02d891de4</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you share a cut-down/simplistic example showing the issue?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delayable Work time deviation</title><link>https://devzone.nordicsemi.com/thread/469785?ContentTypeID=1</link><pubDate>Tue, 20 Feb 2024 12:18:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:296d28c1-0e0c-449f-9494-8fe31f44f681</guid><dc:creator>creative.industry.ag</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/hkn"&gt;Håkon Alseth&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There is one custom thread called every 51 seconds and 3 channels ADC which have the same issue(ADC callbacks are called every 109ms)&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;ADC sequence configuration:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;const&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;adc_sequence_options&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;mSequenceoOptions&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; .interval_us &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; 100&amp;nbsp;&lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;1000&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; .callback &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;ADC_callback&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;};&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Edit:&lt;br /&gt;When I&amp;nbsp;increase wok delay time to 1 sec, then deviation increase to 90ms. So I have constant 9% time deviation.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delayable Work time deviation</title><link>https://devzone.nordicsemi.com/thread/469760?ContentTypeID=1</link><pubDate>Tue, 20 Feb 2024 11:18:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:811d9d15-c881-41fd-9c7d-d76b052e8aa8</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you certain there&amp;#39;s no other threads queued in your system?&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s a quick test firmware based on hello_world:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2012-2014 Wind River Systems, Inc.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;hal/nrf_gpio.h&amp;gt;

#define LED0 28

static struct k_work_delayable blink;

static void blink_handler(struct k_work *work)
{
	nrf_gpio_pin_toggle(LED0);
	k_work_reschedule(&amp;amp;blink, K_MSEC(100));
}

int main(void)
{
	nrf_gpio_cfg_output(LED0);
	k_work_init_delayable(&amp;amp;blink, blink_handler);
	nrf_gpio_pin_clear(LED0);
	k_msleep(500);
	nrf_gpio_pin_set(LED0);
	k_work_reschedule(&amp;amp;blink, K_MSEC(100));
	printf(&amp;quot;Hello World! %s\n&amp;quot;, CONFIG_BOARD);
	return 0;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And here&amp;#39;s the boot-up sequence:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1708427906953v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is consistently showing 100 ms at my end.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>