<?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>How to do the log mechanism whenever wdt or hard fault happens in NRF52832?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/26297/how-to-do-the-log-mechanism-whenever-wdt-or-hard-fault-happens-in-nrf52832</link><description>Hi 
 My application with SDK11 S132 softdevice is having some unknown issues that will make wdt or hard fault handler happen. And I am trying to use the following code to access the flash memory in wdt 
 sd_flash_page_erase( page_num );
nrf_delay_ms</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Mar 2019 06:14:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/26297/how-to-do-the-log-mechanism-whenever-wdt-or-hard-fault-happens-in-nrf52832" /><item><title>RE: How to do the log mechanism whenever wdt or hard fault happens in NRF52832?</title><link>https://devzone.nordicsemi.com/thread/175507?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2019 06:14:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25527b8d-2736-40f9-8d43-4bf1344e5a8f</guid><dc:creator>Meera Shah</dc:creator><description>&lt;p&gt;Hey I am having the same issue, but I couldn&amp;#39;t understand about WDT. Can you please share your code&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to do the log mechanism whenever wdt or hard fault happens in NRF52832?</title><link>https://devzone.nordicsemi.com/thread/103510?ContentTypeID=1</link><pubDate>Mon, 30 Oct 2017 03:11:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6dd7110-792c-4b96-93ef-947c5e415696</guid><dc:creator>Cheng</dc:creator><description>&lt;p&gt;Got it. Thanks for your reply. After went through the datasheet in WDT chapter,
the watchdog reset will be postponed with two 32.768 kHz clock cycles after the TIMEOUT event has been generated.&lt;/p&gt;
&lt;p&gt;I wrote too many bytes more than it could process.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to do the log mechanism whenever wdt or hard fault happens in NRF52832?</title><link>https://devzone.nordicsemi.com/thread/103509?ContentTypeID=1</link><pubDate>Fri, 27 Oct 2017 10:01:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc5c2fec-3958-4552-8ae0-6d1aa5329e59</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;what do you mean &amp;#39;failed&amp;#39; - how did it fail? Either it&amp;#39;s running your code or it&amp;#39;s in a fault handler, there are no other options. Yes you can absolutely access the NVMC inside a WDT handler or any other handler come to that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to do the log mechanism whenever wdt or hard fault happens in NRF52832?</title><link>https://devzone.nordicsemi.com/thread/103508?ContentTypeID=1</link><pubDate>Fri, 27 Oct 2017 08:17:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b84a2dca-460c-4881-b0c4-209c0379455d</guid><dc:creator>Cheng</dc:creator><description>&lt;p&gt;It failed at &lt;code&gt;NRF_NVMC-&amp;gt;CONFIG = (NVMC_CONFIG_WEN_Een &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos);&lt;/code&gt; at the beginning of flash_page_erase. I also put the breakpoint in the hard fault handler but system did not get there. It seems like that I cannot access NVMC register in the WDT_handler. Any idea?  Thanks!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to do the log mechanism whenever wdt or hard fault happens in NRF52832?</title><link>https://devzone.nordicsemi.com/thread/103507?ContentTypeID=1</link><pubDate>Fri, 27 Oct 2017 07:30:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f70047d-34e8-43cf-8bf4-1125a9b09892</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;How does it fail? Hard faults? Have you debugged and set breakpoints in your functions to pinpoint where things fail?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to do the log mechanism whenever wdt or hard fault happens in NRF52832?</title><link>https://devzone.nordicsemi.com/thread/103506?ContentTypeID=1</link><pubDate>Thu, 26 Oct 2017 10:40:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:416df3bc-f977-467d-aea6-23369852192f</guid><dc:creator>Cheng</dc:creator><description>&lt;p&gt;I tried to access the NVMC  register with the following codes in WDT_handler, but it failed. The same code works fine in main thread. Did I miss anything?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void flash_page_erase(uint32_t * page_address){
// Turn on flash erase enable and wait until the NVMC is ready:
NRF_NVMC-&amp;gt;CONFIG = (NVMC_CONFIG_WEN_Een &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos);

while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy)
{
    // Do nothing.
}

// Erase page:
NRF_NVMC-&amp;gt;ERASEPAGE = (uint32_t)page_address;

while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy)
{
    // Do nothing.
}

// Turn off flash erase enable and wait until the NVMC is ready:
NRF_NVMC-&amp;gt;CONFIG = (NVMC_CONFIG_WEN_Ren &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos);

while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy)
{
    // Do nothing.
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void flash_word_write(uint32_t * address, uint32_t value)
{
// Turn on flash write enable and wait until the NVMC is ready:
NRF_NVMC-&amp;gt;CONFIG = (NVMC_CONFIG_WEN_Wen &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos);

while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy)
{
    // Do nothing.
}

*address = value;

while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy)
{
    // Do nothing.
}

// Turn off flash write enable and wait until the NVMC is ready:
NRF_NVMC-&amp;gt;CONFIG = (NVMC_CONFIG_WEN_Ren &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos);

while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy)
{
    // Do nothing.
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to do the log mechanism whenever wdt or hard fault happens in NRF52832?</title><link>https://devzone.nordicsemi.com/thread/103505?ContentTypeID=1</link><pubDate>Thu, 26 Oct 2017 04:03:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6740d53-3758-49bd-bb5e-54eb29616b6f</guid><dc:creator>Cheng</dc:creator><description>&lt;p&gt;Hi RK,
Do you have any example for it? I am quite rookie to arm based architecture or any example provided in SDK11?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to do the log mechanism whenever wdt or hard fault happens in NRF52832?</title><link>https://devzone.nordicsemi.com/thread/103504?ContentTypeID=1</link><pubDate>Thu, 26 Oct 2017 03:53:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8cc81fa5-98b2-4464-a662-5f19682db404</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;You can&amp;#39;t use the softdevice sd_ functions. You&amp;#39;re already in a handler, the chip can&amp;#39;t make a SVC call. At this point you should only use direct calls into the NVIC to clear a page and write the data you want.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>