<?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>Hardfault logging</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100739/hardfault-logging</link><description>Hi, 
 Sdk 17.1.0 
 Trying to log all the necessary information in the event of a hardfault when the product is deployed in the fields and to retrieve it later. 
 
 Is it okay to use nrf sdk flash apis in the hardfault handler to store the data to the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 13 Jun 2023 21:01:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100739/hardfault-logging" /><item><title>RE: Hardfault logging</title><link>https://devzone.nordicsemi.com/thread/430851?ContentTypeID=1</link><pubDate>Tue, 13 Jun 2023 21:01:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69dd8784-ce9b-4f87-844d-ad6624b3df4e</guid><dc:creator>Luke_123</dc:creator><description>&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault logging</title><link>https://devzone.nordicsemi.com/thread/430749?ContentTypeID=1</link><pubDate>Tue, 13 Jun 2023 12:23:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5aa9e298-f94b-4ce8-b5b1-442b70c2f7d6</guid><dc:creator>Kenneth</dc:creator><description>[quote user="Luke_123"]Did you mean &amp;#39;NVIC_SystemReset&amp;#39; by system reset ?[/quote]
&lt;p&gt;Yes.&lt;/p&gt;
[quote user="Luke_123"]Is there any reason you advised to store the RAM buffer to flash &amp;#39;after&amp;#39; a reset ? Cannot we store the RAM buffer to flash inside the fault handler before resetting, Is there a risk doing so ?[/quote]
&lt;p&gt;Part of the reason is simply that you don&amp;#39;t really know what caused the assert to trigger, so you can&amp;#39;t really depend on software modules will be able to write successfully to flash in such case, unless you implement bare-bone&amp;nbsp;hardware usage of the NVMC to write to flash within the fault handler.&lt;/p&gt;
&lt;p&gt;Kenneth&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault logging</title><link>https://devzone.nordicsemi.com/thread/430719?ContentTypeID=1</link><pubDate>Tue, 13 Jun 2023 11:34:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32f2b090-8973-430c-b903-d230c0b377b4</guid><dc:creator>Luke_123</dc:creator><description>&lt;p&gt;Thank you so much Kenneth for your reply.&lt;/p&gt;
&lt;p&gt;Did you mean &amp;#39;NVIC_SystemReset&amp;#39; by system reset ?&lt;/p&gt;
&lt;p&gt;Is there any reason you advised to store the RAM buffer to flash &amp;#39;after&amp;#39; a reset ? Cannot we store the RAM buffer to flash inside the fault handler before resetting, Is there a risk doing so ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault logging</title><link>https://devzone.nordicsemi.com/thread/430701?ContentTypeID=1</link><pubDate>Tue, 13 Jun 2023 11:05:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7355e206-a6ff-4127-8cb8-6ad597311972</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You can find some pointers here:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/58774/error-handling-for-soft-device-and-application"&gt;Error Handling for Soft Device and Application&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So the general idea is that you store the error information to a&amp;nbsp;RAM&amp;nbsp;buffer when there is an assert, then execute&amp;nbsp;system reset, and then after reset you can either store&amp;nbsp;the RAM buffer to flash (e.g. using FDS or NVMC directly if you have a designated flash page available) or send it through some BLE link to the peer. External flash is not needed.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>