<?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>Dump Flashlog to RTT</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47233/dump-flashlog-to-rtt</link><description>Hello! 
 A few questions about the flashlog: 
 1. What&amp;#39;s the difference between the flashlog and the crashlog? 
 2. What is the recommended way to obtain flashlog/crashlog data from a device once it has failed in the field? We looked into the CLI but</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 31 May 2019 01:56:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47233/dump-flashlog-to-rtt" /><item><title>RE: Dump Flashlog to RTT</title><link>https://devzone.nordicsemi.com/thread/190144?ContentTypeID=1</link><pubDate>Fri, 31 May 2019 01:56:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:991da020-5500-4b66-9ea9-bf1f9c5d56ec</guid><dc:creator>wko</dc:creator><description>&lt;p&gt;Hi J&amp;oslash;rgen!&lt;/p&gt;
&lt;p&gt;Thanks for the quick response; apologies it took us a while to figure out what was happening.&lt;/p&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;1. Thank you but it looks like there are a few other undocumented differences, specifically around a crashlog injected log message (see below).&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;2. The CLI added additional complication since it&amp;#39;s prompts didn&amp;#39;t play well with log messages in the RTT Viewer.&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;3. My understanding is that when deferred logging is enabled, NRF_LOG_FLUSH is a blocking call that waits until the logger backends have flushed all current messages to e.g. RTT or flash.&amp;nbsp; This is necessary when e.g. a buffer on the stack needs to be flushed before it leaves a function&amp;#39;s scope.&amp;nbsp; We&amp;#39;re seeing issues where consecutive invocations of NRF_LOG_FLUSH ends up with data not sent to RTT Viewer or Segger&amp;#39;s debugging console.&amp;nbsp; Is this expected?&amp;nbsp; Should we be introducing delays to allow time for processing to complete?&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;4.&amp;nbsp;NRF_LOG_ALLOW_OVERFLOW is set to 1 and NRF_LOG_BUFSIZE is set to 1024.&amp;nbsp; We actually got this working but it was a bit complicated.&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;Specifically, it turns out that when crashlog is enabled, a log message &amp;quot;-----------CRASHLOG------------&amp;quot; is injected by&amp;nbsp;nrf_log_backend_flash.c when processing NRF_LOG_FINAL_FLUSH.&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;5. If you call NRF_LOG_FINAL_FLUSH multiple times, you end up with multiple injected log entries in the crashlog queue. Is this intentional?&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;6. It would be nice to document that&amp;nbsp;nrf_pwr_mgmt_shutdown itself calls&amp;nbsp;&lt;span&gt;NRF_LOG_FINAL_FLUSH so there&amp;#39;s no need for the user to do so.&lt;/span&gt;&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;7. In the nrf_log_panic function defined in nrf_log_frontend.c, the&amp;nbsp;nrf_log_backend_panic_set function is called once for each logger backend.&amp;nbsp; It looks like both the flashlog and the crashlog inject that&amp;nbsp;&lt;span&gt;&amp;quot;-----------CRASHLOG------------&amp;quot;&amp;nbsp;&lt;/span&gt;log message.&amp;nbsp; If you have both crashlog and flashlog configured, you will get two injected log messages.&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;8. In nrf_fprintf_format.c, the&amp;nbsp;nrf_fprintf_fmt does NOT add a terminating NULL character to the buffer.&amp;nbsp; In the above case where crashlog and flashlog were both enabled, the second injected log message included garbled text.&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;Thank you again for any help,&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;Andrew&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dump Flashlog to RTT</title><link>https://devzone.nordicsemi.com/thread/186990?ContentTypeID=1</link><pubDate>Tue, 14 May 2019 13:14:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd96f20a-cc77-4929-a5de-159df83545db</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;This is explained in the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/lib_nrf_log.html?cp=5_0_3_26_5_0#nrf_log_backend_flash"&gt;library documentation&lt;/a&gt;:
&lt;p&gt;The backend consists of the following logical parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;flashlog - used to store log entries during application lifetime,&lt;/li&gt;
&lt;li&gt;crashlog - used to dump messages logged before an error condition (&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__nrf__log__ctrl.html#ga885bb7174399e7e0a7e197ff8bf0f7b0"&gt;NRF_LOG_FINAL_FLUSH&lt;/a&gt;) and between&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__nrf__log__ctrl.html#ga885bb7174399e7e0a7e197ff8bf0f7b0"&gt;NRF_LOG_FINAL_FLUSH&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;and reset.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The simplest solution would be to use the CLI. I suppose you could only enable this interface when needed to save power? Alternatively you can read the content of flash using a debugger/programmer and the &lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrf5x_cltools/UG/cltools/nrf5x_nrfjprogexe_reference.html?cp=6_1_3_0"&gt;nrfjprog command line tool&lt;/a&gt; (argument --readcode will read whole flash, --memrd will read specified part of flash).&lt;/li&gt;
&lt;li&gt;I&amp;#39;m not sure I understand the question. NRF_LOG_FLUSH() is used to process the entire logger queue in deferred mode. Typically this is only called in idle state to process logs.&lt;/li&gt;
&lt;li&gt;What is the configuration of&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__nrf__log__config.html#gaf74fbd7ab681853e83f9b18029208e8e"&gt;NRF_LOG_ALLOW_OVERFLOW&lt;/a&gt;&amp;nbsp;in your application? Have you tried increasing the size of&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__nrf__log__config.html#ga22afeab30e44d3279b09d59b4e690891"&gt;NRF_LOG_BUFSIZE?&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>