<?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>The problem that keys occupy the process</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99551/the-problem-that-keys-occupy-the-process</link><description>SDK:17.1.0 application: ble_app_uart(+ble_app_buttonless dfu service) bootloader:secure bootloader pca10040e_s112_ble Background: There is only one key(pin:31) on the PCBA board, through which you can enter the DFU and wake up from power off mode to enter</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 18 Sep 2024 04:11:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99551/the-problem-that-keys-occupy-the-process" /><item><title>RE: The problem that keys occupy the process</title><link>https://devzone.nordicsemi.com/thread/502837?ContentTypeID=1</link><pubDate>Wed, 18 Sep 2024 04:11:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88108d40-f568-4e64-b291-38d7c09baceb</guid><dc:creator>XiongYin</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;I think you may not receive the update of this ticket anymore since it&amp;#39;s &amp;quot;Verified Answer&amp;quot;.&lt;/p&gt;
&lt;p&gt;So I created another ticket:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/support/333199"&gt;Nordic DevZone (nordicsemi.com)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The problem that keys occupy the process</title><link>https://devzone.nordicsemi.com/thread/502079?ContentTypeID=1</link><pubDate>Wed, 11 Sep 2024 10:38:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d79d27a3-cbcb-44cd-847a-4eed72175113</guid><dc:creator>XiongYin</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;Kenyon and I found that:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The PWM module &amp;quot;app_pwm&amp;quot; enabled &amp;quot;Port Event&amp;quot; in &amp;quot;nrfx_gpiote_init&amp;quot;. (This is ok.)&lt;/li&gt;
&lt;li&gt;Our&amp;nbsp;sense button (P0.01) will trigger the &amp;quot;Port Event&amp;quot; and its ISR &amp;quot;port_event_handle&amp;quot;. (This is ok.)&lt;/li&gt;
&lt;li&gt;Then the &amp;quot;nrf_gpio_latches_read_and_clear&amp;quot; will clear the register &amp;quot;LATCH&amp;quot;&amp;nbsp;which makes&amp;nbsp;our key scanning routine can not get any change of bit&amp;nbsp;&lt;span&gt;P0.01 of&lt;/span&gt;&amp;nbsp;register &amp;quot;IN&amp;quot;. (This is something wrong we think.)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So our questions are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Should &amp;quot;&lt;span&gt;nrf_gpio_latches_read_and_clear&lt;/span&gt;&amp;quot; check the owner of each bit before clearing?&lt;/li&gt;
&lt;li&gt;Does the clearing of the bit of &amp;quot;LATCH&amp;quot; indeed affect the register &amp;quot;IN&amp;quot; as we tested?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The problem that keys occupy the process</title><link>https://devzone.nordicsemi.com/thread/425300?ContentTypeID=1</link><pubDate>Fri, 12 May 2023 11:16:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ad3cfc6-afe5-4829-9a8e-450d19833907</guid><dc:creator>Sigurd</dc:creator><description>[quote user="kenyon"]&lt;span&gt;I got to the root of the problem.&lt;/span&gt;&lt;span&gt; As you described, sense and port event conflict in gpiote.&lt;/span&gt;&lt;span&gt; I configured the NRF_GPIO_PIN_SENSE_LOW trigger mode in the key to do the wake-up foot.&lt;/span&gt;&lt;span&gt; Then in app_pwm there is the function of configuring gpiote.&lt;/span&gt;&lt;span&gt; I did not redefine the trigger mode of the key to NRF_GPIO_PIN_SENSE_NONE when the key woke up.&lt;/span&gt;&lt;span&gt; Therefore, the subsequent pwm work and keys occupy gpiote at the same time, resulting in the entire program working abnormal.&lt;/span&gt;&lt;span&gt; Although I changed the key trigger mode to NRF_GPIO_PIN_SENSE_NONE after waking up, the program returned to normal&lt;/span&gt;[/quote]
&lt;p&gt;Great!&lt;/p&gt;
[quote user="kenyon"]&lt;span&gt;But I wonder if there is an easier way to deal with this gpiote occupancy conflict.&lt;/span&gt;&lt;span&gt; Because I have no problem configuring gpiote function in key and pwm in SDK11 products.&lt;/span&gt;[/quote]
&lt;p&gt;No, I&amp;#39;m not aware of any other ways. There have been several changes to the gpiote driver&amp;nbsp;since SDK 11.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The problem that keys occupy the process</title><link>https://devzone.nordicsemi.com/thread/425212?ContentTypeID=1</link><pubDate>Fri, 12 May 2023 02:27:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a92a025-c86d-4ab2-a1d7-bdcb07788d18</guid><dc:creator>kenyon</dc:creator><description>&lt;p&gt;Hi Sigurd.&lt;br /&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="0" data-group="0-0"&gt;I didn&amp;#39;t do sense and gpiote with the same pin.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="1" data-group="0-1"&gt;&amp;nbsp;key(pin31) just use for sense.app pwm use no pin.&lt;/span&gt;&lt;br /&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="0" data-group="0-0"&gt;I got to the root of the problem.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="1" data-group="0-1"&gt; As you described, sense and port event conflict in gpiote.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="2" data-group="0-2"&gt; I configured the NRF_GPIO_PIN_SENSE_LOW trigger mode in the key to do the wake-up foot.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="3" data-group="0-3"&gt; Then in app_pwm there is the function of configuring gpiote.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="4" data-group="0-4"&gt; I did not redefine the trigger mode of the key to NRF_GPIO_PIN_SENSE_NONE when the key woke up.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="5" data-group="0-5"&gt; Therefore, the subsequent pwm work and keys occupy gpiote at the same time, resulting in the entire program working abnormal.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="6" data-group="0-6"&gt; Although I changed the key trigger mode to NRF_GPIO_PIN_SENSE_NONE after waking up, the program returned to normal.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="7" data-group="0-7"&gt; But I wonder if there is an easier way to deal with this gpiote occupancy conflict.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="8" data-group="0-8"&gt; Because I have no problem configuring gpiote function in key and pwm in SDK11 products.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Thanks for your reply!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The problem that keys occupy the process</title><link>https://devzone.nordicsemi.com/thread/424928?ContentTypeID=1</link><pubDate>Wed, 10 May 2023 14:51:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:685dc6a6-57e2-4e64-9b4f-eb073f3ef8e4</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could be&amp;nbsp;similar&amp;nbsp;to the issue as in this post here,&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/86982/nrfx_gpiote_irq_handler-stucks-when-using-twim"&gt;nrfx_gpiote_irq_handler() stucks when using TWIM&lt;/a&gt;&amp;nbsp;&amp;nbsp;, I believe the issue there was doing both nrf_gpio_cfg_sense_input() and&amp;nbsp;nrf_drv_gpiote_in_init() on the same pin. i.e. using&amp;nbsp;&lt;span&gt;gpio API to&amp;nbsp;set sense input, and again using the GPIOTE API to configure the sense parameter. So if you try using the PIN for multiple&amp;nbsp;things, and&amp;nbsp;with different APIs, this could happen it seems.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The problem that keys occupy the process</title><link>https://devzone.nordicsemi.com/thread/424689?ContentTypeID=1</link><pubDate>Wed, 10 May 2023 02:11:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27d2614b-1bfe-4384-8c95-66b4925e10f1</guid><dc:creator>kenyon</dc:creator><description>&lt;p&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="0" data-group="0-0"&gt;Hi Sigurd.&lt;br /&gt;Have not.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="1" data-group="0-1"&gt; I just found the crux of the conflict, but didn&amp;#39;t know how to solve it.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="2" data-group="0-2"&gt; Because I looked at the code and found that pin31 was not reused anywhere else, and pin31 did not use interrupts for keystrokes.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="3" data-group="0-3"&gt; But once I&amp;#39;ve initialized both the keystroke and app_pwm, as soon as I press the keystroke, it goes to gpiote&amp;#39;s handler and causes both Bluetooth and ble processes to fail, but when I release the keystroke, it works again.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="4" data-group="0-4"&gt; So I don&amp;#39;t know how to solve this problem?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The problem that keys occupy the process</title><link>https://devzone.nordicsemi.com/thread/424633?ContentTypeID=1</link><pubDate>Tue, 09 May 2023 15:35:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5395d31-9db6-40d1-9e44-2b1c5aa7a8bb</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="kenyon"]&lt;span&gt;I found that the gpiote used by app_pwm conflicts with the key(pin31), which is really strange.&lt;/span&gt;&lt;span&gt; All I have to do is mask app_pwm_init and the key will work.&lt;/span&gt;[/quote]
&lt;p&gt;So the issue is solved?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The problem that keys occupy the process</title><link>https://devzone.nordicsemi.com/thread/424571?ContentTypeID=1</link><pubDate>Tue, 09 May 2023 13:19:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40a17a01-61f5-40ce-80de-3d986f319d93</guid><dc:creator>kenyon</dc:creator><description>&lt;p&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="0" data-group="0-0"&gt;I found that the gpiote used by app_pwm conflicts with the key(pin31), which is really strange.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="1" data-group="0-1"&gt; All I have to do is mask app_pwm_init and the key will work.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>