<?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>Consistent kernel panics when using timer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95124/consistent-kernel-panics-when-using-timer</link><description>I have two i2c modules on the same bus and I plan to have a common timer for both of these. one of these is a sensor and I only want to read the sensor values at a predefined interval. The next module is a LED flash/fade manager. But when I try to implement</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 02 Jan 2023 14:14:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95124/consistent-kernel-panics-when-using-timer" /><item><title>RE: Consistent kernel panics when using timer</title><link>https://devzone.nordicsemi.com/thread/402837?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2023 14:14:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:972dd6b2-577b-4bb0-b854-a064d7509c60</guid><dc:creator>Midhunjac</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I solved the issue couple of days before employing the workqueue for PTH_update(). Thank you for responding though. So sorry that I forgot to close the case.I will mark your answer as solution and close the case right away. Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Consistent kernel panics when using timer</title><link>https://devzone.nordicsemi.com/thread/402835?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2023 14:11:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4dcd7589-cd08-48b7-bd08-a0c1c3fd9d94</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Sorry for the late reply.&lt;/p&gt;
&lt;p&gt;If you comment out PTH_update() do you still get the error? I&amp;#39;m not totally sure if it&amp;#39;s LedManager_TimerCallback() or PTH_update() that causes the issue, but the error message indicates that you&amp;#39;re getting an error because you&amp;#39;re trying to grab a semaphore while in a interrupt context. Try putting whatever task that is causing the issue into a &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/kernel/services/threads/workqueue.html"&gt;workqueue&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Consistent kernel panics when using timer</title><link>https://devzone.nordicsemi.com/thread/402091?ContentTypeID=1</link><pubDate>Fri, 23 Dec 2022 13:32:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f92d36c6-73db-4ffb-ae50-873e75d68b1d</guid><dc:creator>Midhunjac</dc:creator><description>&lt;p&gt;I think I found out the issue is. But Cannot figure out why this is happening. To reproduce the issue, execute the following steps in order.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Create a timer and corresponding expiry callback function. At the timer expiry, fetch data from sensors.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;K_TIMER_DEFINE(m_global_timer,timer_expiry_cb,timer_stop_cb);
k_timer_expiry_t timer_expiry_cb()
{
    expiry_counter++;
    LedManager_TimerCallback();
    if(expiry_counter%5 == 0)
    {
        PTH_update();
    }
}

/*&amp;lt;The following function PTH_update() is in another file originally. Moved here for convenience&amp;gt;*/
void PTH_update()
{   
		sensor_sample_fetch(dev);
		sensor_channel_get(dev, SENSOR_CHAN_AMBIENT_TEMP, &amp;amp;temp);
		sensor_channel_get(dev, SENSOR_CHAN_PRESS, &amp;amp;press);
		sensor_channel_get(dev, SENSOR_CHAN_HUMIDITY, &amp;amp;humidity);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The crash happens only when I try to fetch the sensor values. Otherwise, it works fine. So, I believe it has something to do with timer expiry and reading sensor values API.&lt;br /&gt;Thanks for taking a look at this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Consistent kernel panics when using timer</title><link>https://devzone.nordicsemi.com/thread/402088?ContentTypeID=1</link><pubDate>Fri, 23 Dec 2022 13:25:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c2d7a8d-38d7-4ae4-9b92-0706ffda7572</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;Can you share a minimal example that reproduces the issue on the development kit?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>