<?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>Interrupt not getting triggered everytime in Zephyr project</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83592/interrupt-not-getting-triggered-everytime-in-zephyr-project</link><description>Hello, 
 I have a zephyr project built using NCS v1.8.0 with target board selected as nRF9160DK_nrf9160_ns. I am interfacing LSM6DSO sensor with nRF9160 dk, with interrupt configuration done using NRF GPIOTE. Issue with the project is sometimes the interrupt</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Jan 2022 03:30:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83592/interrupt-not-getting-triggered-everytime-in-zephyr-project" /><item><title>RE: Interrupt not getting triggered everytime in Zephyr project</title><link>https://devzone.nordicsemi.com/thread/347902?ContentTypeID=1</link><pubDate>Mon, 17 Jan 2022 03:30:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3ac3e7f-708e-4018-af9b-63e91e43a886</guid><dc:creator>Brian (Geek)</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote userid="111520" url="~/f/nordic-q-a/83592/interrupt-not-getting-triggered-everytime-in-zephyr-project/347542#347542"]Have you tried comparing power consumption when calling&amp;nbsp;&lt;span&gt;k_sem_take(&amp;amp;my_sem,K_FOREVER) to when calling k_cpu_idle?&lt;/span&gt;[/quote]
&lt;p&gt;I don&amp;#39;t think i have tried&amp;nbsp;to check power consumption using semaphore signalling method alone. I have checked current consumption using both k_cpu_idling and semaphore signalling together.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt not getting triggered everytime in Zephyr project</title><link>https://devzone.nordicsemi.com/thread/347542?ContentTypeID=1</link><pubDate>Thu, 13 Jan 2022 09:48:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4867ce65-fa86-46b9-ad73-d359369071a0</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Yes, using a semaphore to wait for your ISR should give priority to the&amp;nbsp;&lt;em&gt;idle thread&lt;/em&gt;, which should have the same result as calling k_cpu_idle.&lt;/p&gt;
&lt;p&gt;Have you tried comparing power consumption when calling&amp;nbsp;&lt;span&gt;k_sem_take(&amp;amp;my_sem,K_FOREVER) to when calling k_cpu_idle?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can read more about how this works in Zephyr here:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/power_management/index.html"&gt;http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/power_management/index.html&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://docs.zephyrproject.org/latest/reference/kernel/scheduling/index.html"&gt;https://docs.zephyrproject.org/latest/reference/kernel/scheduling/index.html&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://docs.zephyrproject.org/latest/reference/kernel/synchronization/semaphores.html"&gt;https://docs.zephyrproject.org/latest/reference/kernel/synchronization/semaphores.html&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://docs.zephyrproject.org/latest/reference/kernel/other/cpu_idle.html"&gt;https://docs.zephyrproject.org/latest/reference/kernel/other/cpu_idle.html&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Einar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt not getting triggered everytime in Zephyr project</title><link>https://devzone.nordicsemi.com/thread/347517?ContentTypeID=1</link><pubDate>Thu, 13 Jan 2022 08:17:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:475c1a63-b0d4-45ac-afc8-127a545ec85b</guid><dc:creator>Brian (Geek)</dc:creator><description>&lt;p&gt;so you suggesting me to just use semaphore for the signalling between ISR and while loop in main function. And as you suggested, if i don&amp;#39;t idle forcefully will it go to idle state if semaphore is not available ?&lt;/p&gt;
&lt;p&gt;Because if i don&amp;#39;t call k_cpu_idle than my power consumption is much higher as compared to when calling k_cpu_idle from main loop.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt not getting triggered everytime in Zephyr project</title><link>https://devzone.nordicsemi.com/thread/347454?ContentTypeID=1</link><pubDate>Wed, 12 Jan 2022 16:52:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5bc8bfa-3490-475f-abce-3550ebe3f59d</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;It seems redundant to use both the semaphore, flag and irq_lock at once in your code, and I suspect this complexity is also what could lead to your program reaching a race condition at some point.&lt;/p&gt;
&lt;p&gt;Instead of manually idling, you can write&amp;nbsp;k_sem_take(&amp;amp;my_sem,K_FOREVER), and your program will idle until it receives the semaphore from your interrupt.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>