<?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>Log on interrupt while another log is being processed causes hang</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76279/log-on-interrupt-while-another-log-is-being-processed-causes-hang</link><description>See the below stack trace using nRF5 SDK 17.0.2, where execution had stopped while entering a critical region during an interrupt event when another log was being processed in the main run loop. Is there any way to prevent this?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 14 Jun 2021 18:29:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76279/log-on-interrupt-while-another-log-is-being-processed-causes-hang" /><item><title>RE: Log on interrupt while another log is being processed causes hang</title><link>https://devzone.nordicsemi.com/thread/315232?ContentTypeID=1</link><pubDate>Mon, 14 Jun 2021 18:29:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5cc4844-2217-4fde-a6ab-1d77f4fd53b8</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I can report it, but then I need some way to recreate it here. Do you have by any chance a way to provide a project that can run on an nRF52-DK?&lt;/p&gt;
&lt;p&gt;In the meantime using deferred might be worth looking into.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log on interrupt while another log is being processed causes hang</title><link>https://devzone.nordicsemi.com/thread/315213?ContentTypeID=1</link><pubDate>Mon, 14 Jun 2021 15:49:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7d5bc9b-ee4c-42c7-b6e3-47b6cccdf2c7</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure if this will resolve it because a log allocation could still occur on an interrupt when the logs are being sent on RTT, right? However, I don&amp;#39;t want to defer logs. This is in a debug build and I want to ensure all logs are sent without risking buffer overflow.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log on interrupt while another log is being processed causes hang</title><link>https://devzone.nordicsemi.com/thread/315125?ContentTypeID=1</link><pubDate>Mon, 14 Jun 2021 12:19:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09db0118-c8fa-4759-8fbc-6ad5836deca4</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Can you try to use&amp;nbsp;&lt;span&gt;NRF_LOG_DEFERRED 1, and add&amp;nbsp;NRF_LOG_PROCESS() to the main loop, e.g.:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;static void idle_state_handle(void)&lt;br /&gt;{&lt;br /&gt; if (NRF_LOG_PROCESS() == false)&lt;br /&gt; {&lt;br /&gt; nrf_pwr_mgmt_run();&lt;br /&gt; }&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: Log on interrupt while another log is being processed causes hang</title><link>https://devzone.nordicsemi.com/thread/315115?ContentTypeID=1</link><pubDate>Mon, 14 Jun 2021 12:01:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d010bba1-1afd-4cb3-9e14-68bee6235146</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;RTT. No, it just happens to be doing a log when performing a flash operation in my code, but the flash write is not in progress at that point, and I am not logging to flash. It is logging a hex dump of 1kb data, so it takes a bit longer and increases the probability that an interrupt will occur while the log data is transferred over RTT. NRF_LOG_DEFERRED is 0. I am not manually calling NRF_LOG_FLUSH(). RTT is blocking, so main loop is waiting for RTT send when the interrupt occurs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log on interrupt while another log is being processed causes hang</title><link>https://devzone.nordicsemi.com/thread/315112?ContentTypeID=1</link><pubDate>Mon, 14 Jun 2021 11:58:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2789daaa-5cde-4f85-abc5-036503f5d8bd</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Haven&amp;#39;t really since this before, are you logging to UART or RTT? I notice it also says flash there, are you logging/writing to flash? Is there any difference if you use&amp;nbsp;NRF_LOG_DEFERRED 0? Are you doing any&amp;nbsp;NRF_LOG_FLUSH() that affect this?&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>