<?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>no HardFault on nRF51</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57147/no-hardfault-on-nrf51</link><description>My problem is a little bit weird: I don&amp;#39;t get a HardFault, although I&amp;#39;d want so. 
 SDK-12.3.0 (d7731ad), FreeRTOS (from the SDK) and SoftDevice S130 (2.0.1) also from the SDK. 
 On all other Cortex M machines I used to work with (Kinetis M0, Kinetis M4</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 04 Feb 2020 08:11:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57147/no-hardfault-on-nrf51" /><item><title>RE: no HardFault on nRF51</title><link>https://devzone.nordicsemi.com/thread/232459?ContentTypeID=1</link><pubDate>Tue, 04 Feb 2020 08:11:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bca3bf0e-d779-4bb1-ab22-b6bce22774de</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please kindly create a new support case for another issue. This will be easy for users to find a solution to the issue. Thanks.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: no HardFault on nRF51</title><link>https://devzone.nordicsemi.com/thread/232092?ContentTypeID=1</link><pubDate>Fri, 31 Jan 2020 13:09:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2d63ee0-1f4b-4975-804d-d06bbd52d867</guid><dc:creator>Tamas Selmeci</dc:creator><description>&lt;p&gt;Another issue: there&amp;#39;s a function like this to generate random numbers:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void bsp_rng_read_custom_length_do(uint8_t *output, uint32_t len)
{
#ifdef SOFTDEVICE_PRESENT
    uint8_t avail = 0;

    while (avail &amp;lt; len) {
        if (sd_rand_application_bytes_available_get(&amp;amp;avail) != NRF_SUCCESS) {
            memset(output, 0, len);
            return;
        }
        if (avail &amp;gt;= len)
            break;
        vTaskDelay(pdMS_TO_TICKS(1));
    }
    if (sd_rand_application_vector_get(output, len) != NRF_SUCCES)
        memset(output, 0, len);
#else   /* SOFTDEVICE_PRESENT */
    /* IMPLEMENT */
#endif  /* SOFTDEVICE_PRESENT */
}
&lt;/pre&gt;If this is executed many times in loop in a task, HardFault occurs. Sometimes the LEDs switch on (as expected, as&amp;nbsp;HardFault_process(...) does so), but sometimes don&amp;#39;t. Watchdog resets. Can you reproduce it?&lt;/p&gt;
&lt;p&gt;Isn&amp;#39;t my 51822 QFACA1 incompatible with the SDK/SoftDevice?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: no HardFault on nRF51</title><link>https://devzone.nordicsemi.com/thread/232079?ContentTypeID=1</link><pubDate>Fri, 31 Jan 2020 12:23:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e134e48d-881a-4d15-a78a-c073076a0ebd</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;not sure why you did not get a hardfault, but trying what you did I can see that it can break into the hardfault handler&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/465x315/__key/communityserver-discussions-components-files/4/pastedimage1580473379239v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: no HardFault on nRF51</title><link>https://devzone.nordicsemi.com/thread/232055?ContentTypeID=1</link><pubDate>Fri, 31 Jan 2020 10:40:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23ffa719-4ef1-4eb2-b3e3-fb7cc8480835</guid><dc:creator>Tamas Selmeci</dc:creator><description>&lt;p&gt;You&amp;#39;re right, I obviously was wrong, no execution in the parent context is allowed to occur once vTaskStartScheduler is called.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define HARDFAULT do { \
    uint32_t *ptr = (uint32_t *)0xABADC0DE; \
    *ptr = 0x12345678; \
} while (0)
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;By the way, anywhere in any FreeRTOS task the call of HARDFAULT causes the machine to hang, reset by watchdog, but the HardFault_Handler doesn&amp;#39;t seem to be called, because that handler should light two LEDs. And the same handler works perfectly if issued before vTaskStartScheduler.&lt;/p&gt;
&lt;p&gt;As the address of HardFault_Handler is burnt into the flash, it can&amp;#39;t be changed in runtime, so at the moment my best idea is that somehow FreeRTOS disables HardFault_IRQ, but I haven&amp;#39;t seen any traces of it... or messes with NVIC...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: no HardFault on nRF51</title><link>https://devzone.nordicsemi.com/thread/232047?ContentTypeID=1</link><pubDate>Fri, 31 Jan 2020 10:13:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9aa9ae49-18e6-4575-9ba6-069c8bcac4fc</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;The vTaskStartScheduler should not be able to mask the HardFault_Handler.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If I understand correctly, the exact same code after&amp;nbsp;&lt;span&gt;vTaskStartScheduler&amp;nbsp; o n nRF52 generates hardfault?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Not sure if this is even possible.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;On the second thought, I am assuming that when you say that you put the code that generates hardfault after&amp;nbsp;vTaskStartScheduler&amp;nbsp;, I am assuming that you do that in some task. Because the line after&amp;nbsp;vTaskStartScheduler&amp;nbsp; is never executed in the main() function. The moment&amp;nbsp;vTaskStartScheduler&amp;nbsp; is called, the RTOS scheduler takes over and the control never reaches to the next line of of&amp;nbsp;vTaskStartScheduler&amp;nbsp;inside main. Maybe this is what you are seeing?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: no HardFault on nRF51</title><link>https://devzone.nordicsemi.com/thread/232016?ContentTypeID=1</link><pubDate>Fri, 31 Jan 2020 08:35:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:577344c8-4d5f-4f0f-92a7-cced234c7e11</guid><dc:creator>Tamas Selmeci</dc:creator><description>&lt;p&gt;The chip is nRF51822 QFACA1 (1810DH). The SDK-12.3.0 (d7731ad) release notes says that SoftDevice-2.0.1 is compatible with nRF51 revision 3 only. I&amp;#39;m not completely sure that my nRF51 chip is rev3... could anyone confirm it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: no HardFault on nRF51</title><link>https://devzone.nordicsemi.com/thread/231854?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 11:39:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c82a525-c679-4ec9-81ad-caeb62d593d7</guid><dc:creator>Tamas Selmeci</dc:creator><description>&lt;p&gt;I&amp;#39;ve dug into this a little deeper... it appears that with the above code I can successfully generate a HardFault anywhere until the point where&amp;nbsp;vTaskStartScheduler is called. From there the HardFault_Handler doesn&amp;#39;t get called. Or no HardFault is raised, although it doubt it...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>