<?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>nrfx_gpiote_irq_handler() stucks when using TWIM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/86982/nrfx_gpiote_irq_handler-stucks-when-using-twim</link><description>Hi Community, 
 i recently migrated from sdk16 to sdk17 and I am using FreeRTOS. 
 My goal is to catch pin interrupts which already worked before migrating. Now I have the problem that if I execute 
 
 
 
 
 
 
 
 
 
 
 
 soon the interrupt handler is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 Apr 2022 07:43:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/86982/nrfx_gpiote_irq_handler-stucks-when-using-twim" /><item><title>RE: nrfx_gpiote_irq_handler() stucks when using TWIM</title><link>https://devzone.nordicsemi.com/thread/365106?ContentTypeID=1</link><pubDate>Wed, 27 Apr 2022 07:43:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62cd6dfb-7abf-4a5d-8d22-aa84f9378fdb</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;something seems to have changed, hard to see what changed while comparing code side by side.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_gpiote_irq_handler() stucks when using TWIM</title><link>https://devzone.nordicsemi.com/thread/364956?ContentTypeID=1</link><pubDate>Tue, 26 Apr 2022 12:43:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30bd14fe-b070-484e-a977-88a80e6abbdf</guid><dc:creator>pioupus</dc:creator><description>&lt;p&gt;Exactly, this is problem. I did this in my application because PIN_CRASH should wake up the CPU when sleeping. The fun fact is, that the problem only appeared after updating from sdk16 to sdk17. With SDK16 everything worked fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_gpiote_irq_handler() stucks when using TWIM</title><link>https://devzone.nordicsemi.com/thread/364952?ContentTypeID=1</link><pubDate>Tue, 26 Apr 2022 12:35:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed3b1cd9-0ce4-47de-8e14-d5cc35be210e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I think the problem is that you are configuring the pins using gpio API as sense input and again using the GPIOTE to configure the sense parameter. I do not see a need to do the both.&lt;/p&gt;
&lt;p&gt;Comment the sense configuration from either one.&lt;/p&gt;
&lt;p&gt;After commenting the below two lines in gpio_init, i do not see this behavior anymore.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	//nrf_gpio_cfg_sense_input(PIN_IN, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW);
	//nrf_gpio_cfg_sense_input(PIN_CRASH, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This piece of code has nothing to do with FreeRTOS as I see it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_gpiote_irq_handler() stucks when using TWIM</title><link>https://devzone.nordicsemi.com/thread/364906?ContentTypeID=1</link><pubDate>Tue, 26 Apr 2022 10:43:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a37ab88b-b443-45e6-8e21-7439ed47060f</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I managed to reproduce this today, seems like it is not stuck but seems like there is a big delay sometimes when you press button 2. Not sure what it is but i need to investigate. Will be back to you when i have more info.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_gpiote_irq_handler() stucks when using TWIM</title><link>https://devzone.nordicsemi.com/thread/364677?ContentTypeID=1</link><pubDate>Mon, 25 Apr 2022 11:04:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ea995fb-e587-47bb-8b5d-3a6aae134816</guid><dc:creator>pioupus</dc:creator><description>&lt;p&gt;Ok, I managed it to write a small example project for PCA10040 which (sometimes) reproduces the error: Press button 1 and the led toggles. If you press button 2 it often stucks in &lt;pre class="ui-code" data-mode="c_cpp"&gt;//nrfx_gpiote.c
    if (status &amp;amp; (uint32_t)NRF_GPIOTE_INT_PORT_MASK) {
        port_event_handle(input); //stucks in the underlying loop within port_event_handle
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and the led won&amp;#39;t toggle anymore.&lt;/p&gt;
&lt;p&gt;The link is: &lt;a href="https://github.com/pioupus/nrfx_gpiote_irq_handler_stucks_when_using_TWIM.git"&gt;https://github.com/pioupus/nrfx_gpiote_irq_handler_stucks_when_using_TWIM.git&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It doesnt crash always. I think, if it is not possible to produce a crash, you have to restart the debugger and powercycle.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_gpiote_irq_handler() stucks when using TWIM</title><link>https://devzone.nordicsemi.com/thread/363851?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 10:25:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:653abeb4-a645-4bcf-939b-27e7afd2c301</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Sure, if you can setup an example project, I can try debugging it at my end as well. Good luck with your investigation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_gpiote_irq_handler() stucks when using TWIM</title><link>https://devzone.nordicsemi.com/thread/363833?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 09:44:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48cde40c-2c2e-47e3-b58e-2ed8c61c0900</guid><dc:creator>pioupus</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You are perfectly right that it is an ugly solution. The problem was that this was quick check if that is the endless loop which is responsible for blocking the system. GCC did not complain so I didnt see that there is a naming conflict. As I found out the system works if i break the loop after 100 passes and the loop&amp;#39;s break condition is the reason why the system blocks.&lt;/p&gt;
&lt;p&gt;I later found out that this happens if a pin is configured as SENSE but the GPIOTE module is not introduced to that pin. This way I guess GPIOTE assumes this pin is PIN_NOT_USED and the corresponding latch bit is not reset. I will investigate more about this. Hopfully I will have the time to setup an example project for the PCA10040. I think there might be trap for developers using the GPIOTE driver this way.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_gpiote_irq_handler() stucks when using TWIM</title><link>https://devzone.nordicsemi.com/thread/363830?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 09:32:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bef8b06-fda4-40dc-ab14-f83725effa97</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The code is a bit confusing&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void port_event_handle(uint32_t *latch) {
    int i = 0; 
    do {
        i++;
        for (uint32_t i = 0; i &amp;lt; NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS; i++) {&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;There seems to be two definitions of &amp;quot;i&amp;quot; and I am not sure why you need the &amp;quot;int i = 0;&amp;quot; definition in your code.&amp;nbsp;&lt;br /&gt;I have not seen this before, and it does not make sense that the for loop keep on advancing even though you clearly mentioned&amp;nbsp;GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS to 4. Can you reproduce this on nRF52832 DK? Can you give me a minimalistic project to reproduce this?&lt;/p&gt;
[quote user=""]I can break the loop as shown above but this is not a beautiful solution. [/quote]
&lt;p&gt;No, that solution looks very ugly. Can you remove the another definition of &amp;quot;i&amp;quot; and make sure that there are no other definitions of&amp;nbsp;GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS anywhere in your code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_gpiote_irq_handler() stucks when using TWIM</title><link>https://devzone.nordicsemi.com/thread/363548?ContentTypeID=1</link><pubDate>Tue, 19 Apr 2022 11:43:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5eca1708-4794-4e11-8a43-461d60c84408</guid><dc:creator>pioupus</dc:creator><description>&lt;p&gt;I observed something which helps to understand the problem:&lt;/p&gt;
&lt;p&gt;The scl signal is via external hardware indirectly connected with a pin which is SENSE-configured but not setup to be used via GPIOTE. As I understand the situation: The GPIOTE interrupt is fired since the SENSE-configured pin is activated but as it is not known to the GPIOTE driver this pin is ignored and the driver stays in the loop without clearing the interruptstatus of the SENSE pin.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>