<?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>Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/107073/suspending-a-thread-also-suspends-another-randomly</link><description>Hello, 
 I&amp;#39;ve been working on a project using nRF52832 + NCS 2.1.1 including BLE and some sensors : MAX86150, MAX30205, MP34DT05, LIS3DH 
 I&amp;#39;m sending data of these sensors through BLE on demand i.e. requesting by sending a char code on a write characteristic</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Feb 2025 13:59:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/107073/suspending-a-thread-also-suspends-another-randomly" /><item><title>RE: Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/thread/523530?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2025 13:59:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:697aff94-ee15-4479-b717-30eb356aa0fd</guid><dc:creator>Hossein Kasaei</dc:creator><description>&lt;p&gt;I couldn&amp;#39;t find the main issue. I decided not to suspend these threads, alternatively I used a flag and delay for them to do nothing when sending data is not requested.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/thread/462535?ContentTypeID=1</link><pubDate>Wed, 03 Jan 2024 12:47:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:906c041a-4376-4006-9ee1-f61eda01db43</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Happy New Year Hossein,&lt;/p&gt;
[quote user="Hossein Kasaei"]By the way I think the problem might be the fact that I&amp;#39;m suspending thread0 from the outside of itself.[/quote]
&lt;p&gt;I do not think that this alone can be the issue here. It is allowed and legal to call k_thread_suspend from outside the thread and that is also the reason why it takes the thread_id as the argument.&lt;/p&gt;
[quote user="Hossein Kasaei"]maybe suspending it when it was in the middle of these operations is not a good practice, and maybe that&amp;#39;s why this issue happens randomly[/quote]
&lt;p&gt;This should not matter as well in the RTOS concept in itself. You should be able to suspend and resume thread when ever you see fit.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/thread/462534?ContentTypeID=1</link><pubDate>Tue, 02 Jan 2024 12:22:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a42e00e-121f-4784-bbcd-242ef6595565</guid><dc:creator>Hossein Kasaei</dc:creator><description>&lt;p&gt;Hi susheel,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Happy new year!&lt;/p&gt;
&lt;p&gt;After a long time, I tried to figure out this issue. I used thread analyzer as you suggested but couldn&amp;#39;t find it useful for this issue, or maybe I used it in a wrong way. I enabled it in the configuration file then placed the thread_analyzer_print() in the thread_main(), so it would log every second. I couldn&amp;#39;t find anything weird in it maybe it&amp;#39;s better to take a look at it just before the issue happens and the main loop log will end:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="powershell"&gt;[00:00:46.198,730] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1
--- 3 messages dropped ---
[00:00:46.198,852] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002370          : STACK: unused 272 usage 688 / 960 (71 %); CPU: 0 %
[00:00:46.198,852] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 90
[00:00:46.199,096] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002478          : STACK: unused 1000 usage 536 / 1536 (34 %); CPU: 0 %
[00:00:46.199,096] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 65
[00:00:46.199,401] &amp;lt;inf&amp;gt; thread_analyzer:  0x20001c60          : STACK: unused 1428 usage 556 / 1984 (28 %); CPU: 0 %
[00:00:46.199,432] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 3898
[00:00:46.199,768] &amp;lt;inf&amp;gt; thread_analyzer:  0x20001b78          : STACK: unused 1600 usage 384 / 1984 (19 %); CPU: 0 %
[00:00:46.199,768] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 3854
[00:00:46.200,164] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002b10          : STACK: unused 1720 usage 264 / 1984 (13 %); CPU: 0 %
[00:00:46.200,164] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 13
[00:00:46.200,347] &amp;lt;inf&amp;gt; thread_analyzer:  0x200027f0          : STACK: unused 616 usage 344 / 960 (35 %); CPU: 0 %
[00:00:46.200,347] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 250
[00:00:46.200,531] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002268          : STACK: unused 504 usage 736 / 1240 (59 %); CPU: 0 %
[00:00:46.200,531] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 92
[00:00:46.200,622] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002180          : STACK: unused 48 usage 656 / 704 (93 %); CPU: 17 %
[00:00:46.200,622] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 270147
[00:00:46.200,744] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002940          : STACK: unused 228 usage 92 / 320 (28 %); CPU: 81 %
[00:00:46.200,775] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1231154
[00:00:46.201,019] &amp;lt;inf&amp;gt; thread_analyzer:  ISR0                : STACK: unused 1528 usage 584 / 2112 (27 %)
[00:00:46.201,049] &amp;lt;dbg&amp;gt; main_c_log: thread_main: main loop running...

[00:00:47.202,606] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1
--- 2 messages dropped ---
[00:00:47.202,728] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002370          : STACK: unused 272 usage 688 / 960 (71 %); CPU: 0 %
[00:00:47.202,728] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 90
[00:00:47.203,002] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002478          : STACK: unused 1000 usage 536 / 1536 (34 %); CPU: 0 %
[00:00:47.203,002] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 65
[00:00:47.203,277] &amp;lt;inf&amp;gt; thread_analyzer:  0x20001c60          : STACK: unused 1336 usage 648 / 1984 (32 %); CPU: 0 %
[00:00:47.203,308] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 3991
[00:00:47.203,613] &amp;lt;inf&amp;gt; thread_analyzer:  0x20001b78          : STACK: unused 1520 usage 464 / 1984 (23 %); CPU: 0 %
[00:00:47.203,643] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 4370
[00:00:47.203,979] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002b10          : STACK: unused 1720 usage 264 / 1984 (13 %); CPU: 0 %
[00:00:47.204,010] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 13
[00:00:47.204,193] &amp;lt;inf&amp;gt; thread_analyzer:  0x200027f0          : STACK: unused 616 usage 344 / 960 (35 %); CPU: 0 %
[00:00:47.204,193] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 250
[00:00:47.204,345] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002268          : STACK: unused 504 usage 736 / 1240 (59 %); CPU: 0 %
[00:00:47.204,376] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 92
[00:00:47.204,437] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002180          : STACK: unused 48 usage 656 / 704 (93 %); CPU: 17 %
[00:00:47.204,467] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 276681
[00:00:47.204,589] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002940          : STACK: unused 228 usage 92 / 320 (28 %); CPU: 81 %
[00:00:47.204,589] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1256429
[00:00:47.204,864] &amp;lt;inf&amp;gt; thread_analyzer:  ISR0                : STACK: unused 1528 usage 584 / 2112 (27 %)
[00:00:47.204,864] &amp;lt;dbg&amp;gt; main_c_log: thread_main: main loop running...

[00:00:48.206,420] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002370          : STACK: unused 272 usage 688 / 960 (71 %); CPU: 0 %
--- 3 messages dropped ---
[00:00:48.206,420] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 90
[00:00:48.206,665] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002478          : STACK: unused 1000 usage 536 / 1536 (34 %); CPU: 0 %
[00:00:48.206,665] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 65
[00:00:48.206,970] &amp;lt;inf&amp;gt; thread_analyzer:  0x20001c60          : STACK: unused 1336 usage 648 / 1984 (32 %); CPU: 0 %
[00:00:48.206,970] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 4077
[00:00:48.207,275] &amp;lt;inf&amp;gt; thread_analyzer:  0x20001b78          : STACK: unused 1520 usage 464 / 1984 (23 %); CPU: 0 %
[00:00:48.207,305] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 4891
[00:00:48.207,672] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002b10          : STACK: unused 1720 usage 264 / 1984 (13 %); CPU: 0 %
[00:00:48.207,672] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 13
[00:00:48.207,855] &amp;lt;inf&amp;gt; thread_analyzer:  0x200027f0          : STACK: unused 616 usage 344 / 960 (35 %); CPU: 0 %
[00:00:48.207,855] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 250
[00:00:48.208,007] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002268          : STACK: unused 504 usage 736 / 1240 (59 %); CPU: 0 %
[00:00:48.208,038] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 92
[00:00:48.208,129] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002180          : STACK: unused 48 usage 656 / 704 (93 %); CPU: 17 %
[00:00:48.208,129] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 283216
[00:00:48.208,251] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002940          : STACK: unused 228 usage 92 / 320 (28 %); CPU: 81 %
[00:00:48.208,251] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1281732
[00:00:48.208,526] &amp;lt;inf&amp;gt; thread_analyzer:  ISR0                : STACK: unused 1528 usage 584 / 2112 (27 %)
[00:00:48.208,557] &amp;lt;dbg&amp;gt; main_c_log: thread_main: main loop running...

[00:00:49.210,083] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002370          : STACK: unused 272 usage 688 / 960 (71 %); CPU: 0 %
--- 3 messages dropped ---
[00:00:49.210,113] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 90
[00:00:49.210,327] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002478          : STACK: unused 1000 usage 536 / 1536 (34 %); CPU: 0 %
[00:00:49.210,357] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 65
[00:00:49.210,632] &amp;lt;inf&amp;gt; thread_analyzer:  0x20001c60          : STACK: unused 1336 usage 648 / 1984 (32 %); CPU: 0 %
[00:00:49.210,662] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 4163
[00:00:49.210,968] &amp;lt;inf&amp;gt; thread_analyzer:  0x20001b78          : STACK: unused 1520 usage 464 / 1984 (23 %); CPU: 0 %
[00:00:49.210,998] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 5414
[00:00:49.211,334] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002b10          : STACK: unused 1720 usage 264 / 1984 (13 %); CPU: 0 %
[00:00:49.211,364] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 13
[00:00:49.211,517] &amp;lt;inf&amp;gt; thread_analyzer:  0x200027f0          : STACK: unused 616 usage 344 / 960 (35 %); CPU: 0 %
[00:00:49.211,547] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 250
[00:00:49.211,700] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002268          : STACK: unused 504 usage 736 / 1240 (59 %); CPU: 0 %
[00:00:49.211,700] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 92
[00:00:49.211,791] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002180          : STACK: unused 48 usage 656 / 704 (93 %); CPU: 18 %
[00:00:49.211,822] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 289502
[00:00:49.211,914] &amp;lt;inf&amp;gt; thread_analyzer:  0x20002940          : STACK: unused 228 usage 92 / 320 (28 %); CPU: 81 %
[00:00:49.211,944] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1307285
[00:00:49.212,219] &amp;lt;inf&amp;gt; thread_analyzer:  ISR0                : STACK: unused 1528 usage 584 / 2112 (27 %)
[00:00:49.212,219] &amp;lt;dbg&amp;gt; main_c_log: thread_main: main loop running...

[00:00:50.052,642] &amp;lt;dbg&amp;gt; ble_service: comm_write_cb: received byte : 0 

[00:00:50.212,310] &amp;lt;dbg&amp;gt; main_c_log: thread_main: cancel any calculation

[00:00:50.213,470] &amp;lt;dbg&amp;gt; main_c_log: thread_main: suspending thread0

[00:00:55.102,752] &amp;lt;dbg&amp;gt; ble_service: comm_write_cb: received byte : 2 

[00:01:00.052,886] &amp;lt;dbg&amp;gt; ble_service: comm_write_cb: received byte : 0 

[00:01:05.053,009] &amp;lt;dbg&amp;gt; ble_service: comm_write_cb: received byte : 1 

[00:01:10.103,118] &amp;lt;dbg&amp;gt; ble_service: comm_write_cb: received byte : 0 

[00:01:15.153,625] &amp;lt;dbg&amp;gt; ble_service: comm_write_cb: received byte : 2 

[00:01:20.153,350] &amp;lt;dbg&amp;gt; ble_service: comm_write_cb: received byte : 0 

[00:01:25.103,485] &amp;lt;dbg&amp;gt; ble_service: comm_write_cb: received byte : 1 

[00:01:30.103,607] &amp;lt;dbg&amp;gt; ble_service: comm_write_cb: received byte : 0 

[00:01:35.153,717] &amp;lt;dbg&amp;gt; ble_service: comm_write_cb: received byte : 2 

[00:01:40.153,839] &amp;lt;dbg&amp;gt; ble_service: comm_write_cb: received byte : 0 &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;By the way I think the problem might be the fact that I&amp;#39;m suspending thread0 from the outside of itself. In this thread BLE sending and data fetching from sensors happens and maybe suspending it when it was in the middle of these operations is not a good practice, and maybe that&amp;#39;s why this issue happens randomly. So I decided to suspend thread0 in itself and the problem seems to be solved! I&amp;#39;m never facing this issue again. What is your opinion about this? cause I&amp;#39;m a beginner in RTOS and the operation system concept.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/thread/462533?ContentTypeID=1</link><pubDate>Mon, 04 Dec 2023 08:12:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5353aae1-947e-492f-b4c2-27676770a2db</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I think we might need to rule out if this is related to the stack overflow or not. The reason I am still sticking to this debug path is because i2c_burst_read_dt does not seem to be related to the threads suspending and unrelated random issue most likely happen with memory corruptions.&lt;/p&gt;
&lt;p&gt;Please run the &lt;a href="https://docs.zephyrproject.org/latest/services/debugging/thread-analyzer.html"&gt;Thread Analyzer&lt;/a&gt;&amp;nbsp;on your app to see if there are any other threads that are running dangerously close to using up allocated stack for them.&lt;/p&gt;
&lt;p&gt;Otherwise, I do not not know or have any theory on how this can happen.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/thread/462532?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2023 13:38:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:442a3738-7e61-45e8-bc74-9f7295800ae1</guid><dc:creator>Hossein Kasaei</dc:creator><description>[quote user="Aryan"]What is the context in which&amp;nbsp;&lt;span&gt;i2c_burst_read_dt is called? thread0 or some interrupt context?&lt;/span&gt;[/quote]
&lt;p&gt;Yes it is running in the thread0 context.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user="Aryan"]try to experiment with the stack sizes of your application created threads[/quote]
&lt;p&gt;I doubled the thread0 stack size from 2048 to 4096, didn&amp;#39;t fix it.&lt;br /&gt;Also doubled the thread_main stack size to 4096, still nothing.&lt;br /&gt;I used CONFIG_MAIN_STACK_SIZE = 4096, didn&amp;#39;t fix the problem.&lt;br /&gt;&lt;br /&gt;Something I noticed is that when i2c read take some time, like using i2c_burst_read_dt or using i2c_reg_read_dt in a for loop, then suspending will occur sooner, but when I read just one byte using i2c_reg_read_dt&amp;nbsp;it take some time to face the problem. I have to say that I&amp;#39;m not getting any error log.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/thread/462531?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2023 11:33:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d91aa6d-34e5-4d30-8e07-fbbf864ae83b</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;This might be caused by buffer overflow or stack overflow.&lt;/p&gt;
&lt;p&gt;What is the context in which&amp;nbsp;&lt;span&gt;i2c_burst_read_dt is called? thread0 or some interrupt context? I would try to experiment with the stack sizes of your application created threads just to see if this is some overflow issue.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;No, Unfortunately I do not have that sensor, so I won&amp;#39;t be able to reproduce the issue.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/thread/462530?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2023 10:26:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ab9ed27-f57e-4bfb-9bbf-3a74379fd397</guid><dc:creator>Hossein Kasaei</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I tried to shrank&amp;nbsp;down the bug and I ended up to the max86150 library. It&amp;#39;s so weird but the i2c_burst_read_dt is causing the problem I don&amp;#39;t know how it is related to the threads do you have any idea?&lt;/p&gt;
&lt;p&gt;To clarify, I myself wrote the library for max86150, I have a function called max86150_fetch_data which I&amp;#39;m calling whenever data is needed for example in the thread0, for ppg calculation this function is called :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;if (meas_value_current == 0x01) { // PPG + Force
	max86150_fetch_data(&amp;amp;max86150_dev, &amp;amp;MAX86150_config, &amp;amp;MAX86150_data);

	uint16_t ir_data = (MAX86150_data.channel_data[0]) &amp;gt;&amp;gt; 2;
	// uint16_t ir_data = 0;
	uint16_t red_data = (MAX86150_data.channel_data[1]) &amp;gt;&amp;gt; 2;
	// uint16_t red_data = 0;

	float filtered_force = 0, sum_force = 0;
	float new_force = read_Force();
	force_array[force_idx++] = new_force;
	force_idx %= FORCE_WINDOW_SIZE;

	for (int j=0; j&amp;lt;FORCE_WINDOW_SIZE; j++) {
		sum_force += force_array[j];
	}
	filtered_force = (float)sum_force / FORCE_WINDOW_SIZE;
	

	// filtered_force = new_force;

	epf_buf[epf_count++] = red_data;
	epf_buf[epf_count++] = red_data &amp;gt;&amp;gt; 8;
	epf_buf[epf_count++] = ir_data;
	epf_buf[epf_count++] = ir_data &amp;gt;&amp;gt; 8;
	epf_buf[epf_count++] = 0;
	epf_buf[epf_count++] = 0;
	epf_buf[epf_count++] = (char) filtered_force;
	epf_buf[epf_count++] = (filtered_force - epf_buf[epf_count-1]) * 100;;

	if (epf_count &amp;gt;= EPF_BUF_SIZE) {
		send_notify(epf_buf, sizeof(epf_buf));
		epf_count = 0;
	}
	k_msleep(5);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Inside max86150_fetch_data I&amp;#39;m using i2c_burst_read_dt :&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;int max86150_fetch_data(const struct i2c_dt_spec *dev_i2c, struct max86150_config *config, 
            struct max86150_data *data) {
    
    int num_bytes = 3 * data-&amp;gt;num_channels;            
    uint8_t buffer[num_bytes];
    uint32_t fifo_data;
    int fifo_chan;
    int i;

    
    if (i2c_burst_read_dt(dev_i2c, MAX86150_REG_FIFO_DATA, buffer, num_bytes)) {
        LOG_ERR(&amp;quot;Data register burst read failed&amp;quot;);
        return -1;
    }

    fifo_chan = 0;
    for (i = 0; i &amp;lt; num_bytes; i += 3) {
        fifo_data = (buffer[i] &amp;lt;&amp;lt; 16) | (buffer[i+1] &amp;lt;&amp;lt; 8) | (buffer[i+2]);
        // if (config-&amp;gt;slot[i/3] != 9) fifo_data &amp;amp;= MAX86150_PPG_FIFO_DATA_MASK; // if data is ecg don&amp;#39;t mask it

        data-&amp;gt;channel_data[fifo_chan++] = fifo_data;
    }

    return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;when I comment i2c_burst_read_dt, the problem will disappear. Any idea?&lt;/p&gt;
&lt;p&gt;If you still want to reproduce, you have to have max86150 module if it is available to you let me know then I can provide you the proper code working for nRF52 DK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/thread/462529?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2023 06:27:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:214d87dd-94d3-43f5-8918-17e7abe037a0</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Hosssein, &lt;br /&gt;&lt;br /&gt;Can you please attach your minimalistic project to reproduce this. I can try to debug how suspending one thread causes the other to suspend. Have not seen such behavior before.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/thread/462528?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 19:13:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c40cba7-bd10-4de5-8257-f22be109fb3a</guid><dc:creator>Hossein Kasaei</dc:creator><description>[quote user="Hossein Kasaei"]Waking up thread0 is done in a timer callback, now I see maybe that&amp;#39;s the problem huh?[/quote]
&lt;p&gt;I investigated this and figured out this is not the problem. I placed a flag in the timer callback instead of calling k_thread_suspend in it, and used this function and check the flag in the main thread and suspend the thread there but the problem still persist.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/thread/462527?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 14:49:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b5acf0d-f864-4eac-8b70-f67f26c19619</guid><dc:creator>Hossein Kasaei</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;Thanks for your response. I&amp;#39;m sorry I send you the wrong project file I&amp;#39;ll send the right one.&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
[quote user="Aryan"]How do you know that suspending one thread is suspending main thread aswell? I mean how did you conclude that the main was suspended ?[/quote]
&lt;p&gt;I&amp;#39;m checking the log on the RTT console, the&amp;nbsp;&lt;span&gt;printk&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;main loop running...&lt;/span&gt;&lt;span&gt;\n&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;) line is not show up anymore also changing the request code and shutting&amp;nbsp;down the device doesn&amp;#39;t work.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;Not sure if the main thread is suspended but I know that it won&amp;#39;t run anymore maybe it is blocked somehow?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
[quote user="Aryan"]How are you waking up thread0? I do not see any related code to resume thread0 after it is suspended[/quote]
&lt;p&gt;&lt;span&gt;&lt;br /&gt;Waking up thread0 is done in a timer callback, now I see maybe that&amp;#39;s the problem huh?&lt;br /&gt;Actually I turn on this timer in the main thread as you can see below and after 1 second the timer will resume the thread.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void thread0_timer_cb(struct k_timer *timer) {
	printk(&amp;quot;thread0 timer cb\n&amp;quot;);
	k_thread_resume(thread0_id);
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;as an example when ppg is requested the timer will be turned on so thread0 can be resumed:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;else if (meas_value == 0x01) {
	printk(&amp;quot;cal PPG\n&amp;quot;);
	MAX86150_config.slot[0] = MAX86150_SLOT_IR_LED1;
	MAX86150_config.slot[1] = MAX86150_SLOT_RED_LED2;
	MAX86150_config.slot[2] = 0;
	MAX86150_config.slot[3] = 0;
	MAX86150_config.IR_LED_PA = 0x1E;
	MAX86150_config.RED_LED_PA = 0x1E;
	max86150_init(&amp;amp;max86150_dev, &amp;amp;MAX86150_config, &amp;amp;MAX86150_data);
	// max86150_wakeup(&amp;amp;max86150_dev);
	k_timer_start(&amp;amp;thread0_timer, K_MSEC(1000), K_MSEC(0));
	meas_value_current = 0x01; 
	wake_to_sleep_time = 0;
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
[quote user="Aryan"]Are you sure that thread0_id value is not corrupted over time when the issue happens?[/quote]
&lt;p&gt;&lt;span&gt;&lt;br /&gt;It might be the case but I don&amp;#39;t know where, maybe in the timer callback?&lt;br /&gt;&lt;br /&gt;If you want to reproduce it&amp;#39;s not that easy I may have to change the code cause I&amp;#39;m not using the nRF52 DK, we have a custom made board.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suspending a thread also suspends another randomly</title><link>https://devzone.nordicsemi.com/thread/462526?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 11:57:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64004c85-e950-4385-9ee0-e21885a20f52</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Hosssein,&lt;/p&gt;
&lt;p&gt;The attached code and the code snippet seems to be a bit different. In your attached code I still cannot see the logic of where you are suspending thread0 (even though you showed this in your code snippet in this thread).&lt;/p&gt;
&lt;p&gt;There are few&amp;nbsp;clarification that I seek&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;How do you know that suspending one thread is suspending main thread aswell? I mean how did you conclude that the main was suspended ?&lt;/li&gt;
&lt;li&gt;How are you waking up thread0? I do not see any related code to resume thread0 after it is suspended&lt;/li&gt;
&lt;li&gt;Are you sure that thread0_id value is not corrupted over time when the issue happens?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It looks like you have stripped away most of the code in the attached zip, but it does not show any more details that can aid me to understand or reproduce this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>