<?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>in gpiote handler,call xEventGroupSetBitsFromISR will cause hardfault</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74280/in-gpiote-handler-call-xeventgroupsetbitsfromisr-will-cause-hardfault</link><description>my project is freertos+nrf52832 based the templete in SDK; A sensor pin is connect to P0.17, and I configure it low to high level trigger interrupt.In the handler I will call xEventGroupSetBitsFromISR to notify task, but when call this function, it will</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 30 Apr 2021 10:25:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74280/in-gpiote-handler-call-xeventgroupsetbitsfromisr-will-cause-hardfault" /><item><title>RE: in gpiote handler,call xEventGroupSetBitsFromISR will cause hardfault</title><link>https://devzone.nordicsemi.com/thread/307638?ContentTypeID=1</link><pubDate>Fri, 30 Apr 2021 10:25:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b05d32b3-7d1f-4a60-9911-df6fe21c062f</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;FreeRTOSConfig.h file has this&amp;nbsp;&lt;em&gt;&lt;strong&gt;configTOTAL_HEAP_SIZE&amp;nbsp;&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt;&lt;/strong&gt;that you need to increase so that you can increase the task stack size when you are create the task using xTaskCreate&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: in gpiote handler,call xEventGroupSetBitsFromISR will cause hardfault</title><link>https://devzone.nordicsemi.com/thread/307626?ContentTypeID=1</link><pubDate>Fri, 30 Apr 2021 09:44:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69daab05-1c93-4e78-bc37-dd1a5c4e1f34</guid><dc:creator>great-master</dc:creator><description>&lt;p&gt;how does modify the stack to bigger? in startup.s file?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: in gpiote handler,call xEventGroupSetBitsFromISR will cause hardfault</title><link>https://devzone.nordicsemi.com/thread/307398?ContentTypeID=1</link><pubDate>Thu, 29 Apr 2021 08:53:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ff45f3a-5147-4a57-9d79-2646f40e8d56</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;For some reason there is a memory corruption when you use&amp;nbsp;&lt;span&gt;xEventGroupSetBitsFromISR&lt;/span&gt;&lt;span&gt;&amp;nbsp;. This is most likely a stack overflow from one of your task. It seems that&amp;nbsp;xEventGroupSetBitsFromISR&amp;nbsp; uses more stack which might be overflowing into the neighboring task memery and corrupting it. I guess you can use the non ISR version as it does not look like you have a lot of nesting happening here.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: in gpiote handler,call xEventGroupSetBitsFromISR will cause hardfault</title><link>https://devzone.nordicsemi.com/thread/307034?ContentTypeID=1</link><pubDate>Tue, 27 Apr 2021 12:52:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f843c3a5-e2db-4a29-8eb8-91f8afd7f69f</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Sorry,&amp;nbsp; I did not manage to finish looking at this today.&lt;/p&gt;
&lt;p&gt;I will get more insights and reply to you tomorrow.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: in gpiote handler,call xEventGroupSetBitsFromISR will cause hardfault</title><link>https://devzone.nordicsemi.com/thread/306916?ContentTypeID=1</link><pubDate>Tue, 27 Apr 2021 07:19:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd5e0b4a-237c-4b39-8ae5-400b1622e039</guid><dc:creator>great-master</dc:creator><description>&lt;p&gt;thank you very much , wait your&amp;nbsp;answer!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: in gpiote handler,call xEventGroupSetBitsFromISR will cause hardfault</title><link>https://devzone.nordicsemi.com/thread/306784?ContentTypeID=1</link><pubDate>Mon, 26 Apr 2021 11:59:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e93efe4-a5b4-47e8-ba28-6b9137ca1abf</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;This SDK should not have that bug i was mentioning before. So it is not related to the suspect i have in mind.&lt;/p&gt;
&lt;p&gt;I will test your project soon and come back to you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: in gpiote handler,call xEventGroupSetBitsFromISR will cause hardfault</title><link>https://devzone.nordicsemi.com/thread/306694?ContentTypeID=1</link><pubDate>Mon, 26 Apr 2021 07:32:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de63fd70-b52b-4937-a63c-9119abe59694</guid><dc:creator>great-master</dc:creator><description>&lt;p&gt;nRF5_SDK_17.0.2_d674dde&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: in gpiote handler,call xEventGroupSetBitsFromISR will cause hardfault</title><link>https://devzone.nordicsemi.com/thread/306678?ContentTypeID=1</link><pubDate>Mon, 26 Apr 2021 06:18:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87a567e5-ad58-4e31-afb8-715a0f240864</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I think I have seen this error before in the earlier SDK where there was a bug related to the tick handling. Which SDK version are you using? I can give it a try to reproduce this hardfault with your project once you let me know the SDK version.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: in gpiote handler,call xEventGroupSetBitsFromISR will cause hardfault</title><link>https://devzone.nordicsemi.com/thread/306645?ContentTypeID=1</link><pubDate>Sun, 25 Apr 2021 02:23:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fca29111-864e-4d53-ba77-ffeffefdec70</guid><dc:creator>great-master</dc:creator><description>&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/1157.hardfault.png" /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Controller.7z"&gt;devzone.nordicsemi.com/.../Controller.7z&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks for you help, I have attched the project, the project is running in PCA10040 &lt;span class="fontstyle0"&gt;Development Kit, When give P0.17 a raise level, it will trigger gpiote ISR, the it will set event bits and cause hardfault.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="fontstyle0"&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void alps_gpio_interrupt_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    BaseType_t higher_priority_task_woken, result;
    higher_priority_task_woken = pdFALSE;

    if(sample_task_event_handle == NULL)
    {
        NRF_LOG_WARNING(&amp;quot;Task event is not create now\r\n&amp;quot;);
        return;
    }

    if((pin == IMU_RDY_INT_PIN) &amp;amp;&amp;amp; (action == NRF_GPIOTE_POLARITY_LOTOHI))
    {
#if 0
        result = xEventGroupSetBitsFromISR(
                                sample_task_event_handle, 
                                IMU_DATA_DRDY_EVENT, 
                                &amp;amp;higher_priority_task_woken);
        if(result != pdFAIL)
        {
            /* If higher_priority_task_woken is now set to pdTRUE then a context
            switch should be requested. The macro used is port specific and will
            be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() - refer to
            the documentation page for the port being used. */
            portYIELD_FROM_ISR( higher_priority_task_woken );
        }
#else
        xEventGroupSetBits(sample_task_event_handle,IMU_DATA_DRDY_EVENT);
#endif
    }
}


static void sample_task_entry(void * pvParameter)
{
    UNUSED_PARAMETER(pvParameter);
    EventBits_t event;

    while (true)
    {
        event = xEventGroupWaitBits(
            sample_task_event_handle,
            IMU_DATA_DRDY_EVENT,
            pdTRUE,  /* bit should be cleared before returning. */
            pdFALSE, /* Don&amp;#39;t wait for both bits, either bit will do. */
            portMAX_DELAY);
        if(event == IMU_DATA_DRDY_EVENT)
        {
            led_toggle(0);
        }
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: in gpiote handler,call xEventGroupSetBitsFromISR will cause hardfault</title><link>https://devzone.nordicsemi.com/thread/306462?ContentTypeID=1</link><pubDate>Fri, 23 Apr 2021 06:01:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e7ac260-571e-47a9-a553-8ef083171c92</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;That is strange,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;gpiote_handler is called from the ISR. Can you show me the screenshot of the calltrace of functions when the hardfault happened?&lt;/p&gt;
&lt;p&gt;Also, have you changed any priorities values of the kernel itself?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>