<?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>Random bad instruction faults at 0x16274 with softdevice s132 version 7.0.1. SDK 16.0.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84283/random-bad-instruction-faults-at-0x16274-with-softdevice-s132-version-7-0-1-sdk-16-0-0</link><description>Hello, 
 We are attempting to track down a rare bug in our code that causes the device to occasionally hard fault. 
 We have been able to catch it three times, twice where it attempted to execute an instruction at 0x80000000 and once at 0x60000000. The</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Feb 2022 10:54:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84283/random-bad-instruction-faults-at-0x16274-with-softdevice-s132-version-7-0-1-sdk-16-0-0" /><item><title>RE: Random bad instruction faults at 0x16274 with softdevice s132 version 7.0.1. SDK 16.0.0</title><link>https://devzone.nordicsemi.com/thread/351057?ContentTypeID=1</link><pubDate>Thu, 03 Feb 2022 10:54:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9aab2489-f0a5-4b42-b1d1-04352bfcb305</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I think you can stay on the current SDK and Softdevice version if you do one of the following changes to the application code:&lt;/p&gt;
&lt;p&gt;1. Replace the &lt;span&gt;sd_app_evt_wait() call in your app with the errata workaround. If you do this, the application will continue to enter System ON as before. The main difference is that sd_app_evt_wait() only returns on application interrupts, whereas with the workaround you will also get wakeups on Softdevice interrupts (RADIO, TIMER0, RTC0, etc). &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Another difference is that sd_app_evt_wait() implements the workaround for &lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev3/ERR/nRF52832/Rev3/latest/anomaly_832_75.html?cp=4_2_1_0_1_15"&gt;[75] MWU: Increased current consumption&lt;/a&gt;&lt;/span&gt;, so you would have to do the same to avoid a power penalty. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The combined workaround for errata 220 and 75 may look something like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* Disable MWU during sleep as a workaround for errata #75: 
 * https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev3/ERR/nRF52832/Rev3/latest/anomaly_832_75.html
 */

#define MWU_ENABLE()                                                                            \
do                                                                                              \
{                                                                                               \
    NRF_MWU-&amp;gt;REGIONENSET = ((MWU_REGIONENSET_RGN0WA_Set &amp;lt;&amp;lt; MWU_REGIONENSET_RGN0WA_Pos) |        \
    (MWU_REGIONENSET_PRGN0WA_Set &amp;lt;&amp;lt; MWU_REGIONENSET_PRGN0WA_Pos));                              \
}                                                                                               \
while (0)

#define MWU_DISABLE()                                                                           \
do                                                                                              \
{                                                                                               \
    NRF_MWU-&amp;gt;REGIONENCLR = ((MWU_REGIONENSET_RGN0WA_Set &amp;lt;&amp;lt; MWU_REGIONENSET_RGN0WA_Pos) |        \
    (MWU_REGIONENCLR_PRGN0WA_Clear &amp;lt;&amp;lt; MWU_REGIONENCLR_PRGN0WA_Pos));                            \
}                                                                                               \
while (0)

/* SEVONPEND must be enabled when calling this function */
__STATIC_INLINE evt_wait(void)
{
    __disable_irq();
    MWU_DISABLE();
    __WFE();
    __NOP();__NOP();__NOP();__NOP();
    __enable_irq();
    /* Note: mwu is enabled internally in the Softdevice during
     * forwarding of application interrutps 
     */
    MWU_ENABLE();
}

&lt;/pre&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. Disable stacking of FPU registers and only do float operations from a single task running in the main context. There is app note here from ARM that explains how you can configure this: &lt;a href="https://developer.arm.com/documentation/dai0298/a/"&gt;https://developer.arm.com/documentation/dai0298/a/&lt;/a&gt;. But be aware that some compilers may in some cases utilize floating point registers as general purpose registers as discussed in this thread:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/29590"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/29590&lt;/a&gt;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random bad instruction faults at 0x16274 with softdevice s132 version 7.0.1. SDK 16.0.0</title><link>https://devzone.nordicsemi.com/thread/350755?ContentTypeID=1</link><pubDate>Tue, 01 Feb 2022 21:05:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8a6ef7d-0f55-4234-aa42-f2fc9c6ab367</guid><dc:creator>SteamingGizmo</dc:creator><description>&lt;p&gt;That errata definitively fits.&lt;br /&gt;It is exactly like you say where we have not been able to catch it with the debugger connected.&lt;br /&gt;Further, we are utilizing the TWI peripheral with DMA so our specific implementation fits.&lt;br /&gt;&lt;br /&gt;We used a service which saves a coredump to flash on a hardfault, then transmits it over BLE. &lt;br /&gt;That is how we were able to catch the bug in action.&lt;br /&gt;&lt;br /&gt;Please correct me if I am wrong.&lt;br /&gt;We will have to update the SDK to at least version 17.0.2, so we can use softdevice v8. Mainly because we don&amp;#39;t have access to the loop within the softdevice to add the fix, and we need to utilize the fpu peripheral in our production code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random bad instruction faults at 0x16274 with softdevice s132 version 7.0.1. SDK 16.0.0</title><link>https://devzone.nordicsemi.com/thread/350753?ContentTypeID=1</link><pubDate>Tue, 01 Feb 2022 20:18:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70eaea43-eb40-43b6-a914-23ebd60311d3</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello James,&lt;/p&gt;
&lt;p&gt;This looks very similar to errata 220: &lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev3/ERR/nRF52832/Rev3/latest/anomaly_832_220.html?cp=4_2_1_0_1_59"&gt;CPU: RAM is not ready when written&lt;/a&gt;, or have you considered it already? If it is, then the stacked register values you posted above will be for the idle loop inside the Softdevice (invoked when you call sd_app_evt_wait(), except for the corrupted PC that is a result of this HW issue. The reason for the other registers being valid is that they are always pushed onto the stack after the PC register. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is a very rare bug which only occur in implementations that manages to meet the exact timings outlined in the errata documented I linked to above. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It should not be possible to trigger the issue while the chip is in debug interface mode either. I assume you connected the debugger after the crash when you read the stack? &lt;br /&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;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>