<?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>Error-check with printf() and NRF_LOG() not working</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/20468/error-check-with-printf-and-nrf_log-not-working</link><description>Hello, 
 I am currently developing a new bt-le-program and besides my own log-messages, I wanted to enable also the log-output that is happing in the files from the Nordic SDK. Due to some previous experiments with different examples, I figured that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 30 Mar 2017 12:46:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/20468/error-check-with-printf-and-nrf_log-not-working" /><item><title>RE: Error-check with printf() and NRF_LOG() not working</title><link>https://devzone.nordicsemi.com/thread/79818?ContentTypeID=1</link><pubDate>Thu, 30 Mar 2017 12:46:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2567210a-cfa9-40de-80b3-5381a0e68311</guid><dc:creator>Ray Breslin</dc:creator><description>&lt;p&gt;Yes of course - I will do that!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error-check with printf() and NRF_LOG() not working</title><link>https://devzone.nordicsemi.com/thread/79817?ContentTypeID=1</link><pubDate>Thu, 30 Mar 2017 07:59:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1aa80951-2188-42bb-b175-2052038c44fd</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Could you create a new question regarding the NRF_LOG_DEFERRED problem?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error-check with printf() and NRF_LOG() not working</title><link>https://devzone.nordicsemi.com/thread/79815?ContentTypeID=1</link><pubDate>Wed, 29 Mar 2017 16:54:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b7e4df7-74f0-47cf-803f-1ccb444f5777</guid><dc:creator>Ray Breslin</dc:creator><description>&lt;p&gt;While I can actually live with the current usability of NRF_LOG(), I would be very much interested in figuring out why the NRF_LOG_DEFERRED-option is causing such problems. So far I couldnt find anything specific here on the forum or on the info-center, but I am assuming that I might be missing something f.ex. in the sdk_config.h or during initialization...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error-check with printf() and NRF_LOG() not working</title><link>https://devzone.nordicsemi.com/thread/79814?ContentTypeID=1</link><pubDate>Wed, 29 Mar 2017 16:48:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b184c39a-d7bb-4c00-85f1-04ee50da1924</guid><dc:creator>Ray Breslin</dc:creator><description>&lt;p&gt;d) After some tests I figured out that I would see an advertising-timeout causing a state-switch to BLE_ADV_EVT_IDLE, which then would result in a sleep_mode_enter()-call where it doesnt return (by default).&lt;/p&gt;
&lt;p&gt;e) What happened here was precisely as I already guessed, since the 2 logging-functionalities where &amp;quot;overlapping&amp;quot; each other. Since I just use the NRF_LOG()-functionality now, I can see all the log-messages from myself and from within the SDK in just the order they are supposed to be in. Compared to my log-output above, I am getting the &amp;quot;SDH:INFO:sd_ble_enable: RAM START at 0x20002128&amp;quot;-message directly after &amp;quot;BLE Stack Initialized&amp;quot;-message and that is how it should be.&lt;/p&gt;
&lt;p&gt;f) Basically it was already answered with e), so there is no overlapping-anymore. Regarding the timestamps I previously used a self-created print_timestamp()-function that was returning a char-pointer!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error-check with printf() and NRF_LOG() not working</title><link>https://devzone.nordicsemi.com/thread/79816?ContentTypeID=1</link><pubDate>Wed, 29 Mar 2017 16:41:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9784cdf4-6259-4ad8-8a4c-01af7d7b41b3</guid><dc:creator>Ray Breslin</dc:creator><description>&lt;p&gt;Thank you for your answer Kristin and my apologies for not responding earlier!&lt;/p&gt;
&lt;p&gt;Here are some updates from my side:&lt;/p&gt;
&lt;p&gt;a) I decided to just go with the NRF_LOG-API using a wrapper-function for NRF_LOG_RAW_INFO(), that seems to work quite nicely. One reason for that is a somehow &amp;quot;undefined&amp;quot; behaviour of printf() - including the retarget-functionality - while using a GCC-toolchain as various other topics in the development forum pointed out.&lt;/p&gt;
&lt;p&gt;b) I went also for the same options you mentioned, since having NRF_LOG_DEFERRED enabled (easy switch in my wrapper-function from a)) caused some kind of not-responding-error after some time. I even played around with the buffer-sizes, but it always failed pretty much at the same location where it would just continue when being disabled!&lt;/p&gt;
&lt;p&gt;c) Thanks for the info - couldnt find any code-line though that specifically uses assert_nrf_callback().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error-check with printf() and NRF_LOG() not working</title><link>https://devzone.nordicsemi.com/thread/79813?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 12:13:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:452367fb-3829-4e1f-b49c-55fb088e4612</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;&lt;strong&gt;a)&lt;/strong&gt; On the nRF52, there is only one UART. It means that you can either use NRF_LOG over UART or &amp;quot;your own&amp;quot; UART. If you want to use NRF_LOG in parallel with &amp;quot;your&amp;quot; UART, you should use NRF_LOG over RTT instead.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;b)&lt;/strong&gt; The default settings for NRF_LOG are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;UART_DEFAULT_CONFIG_HWFC: Disabled&lt;/li&gt;
&lt;li&gt;NRF_LOG_DEFERRED: Disabled&lt;/li&gt;
&lt;li&gt;NRF_LOG_BACKEND_SERIAL_UART_FLOW_CONTROL: Disabled&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If using UART in combination with the softdevice, I would recommend you to enable HWFC in order to avoid loosing data over UART.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;c)&lt;/strong&gt; Yes, the softdevice will use assert_nrf_callback().&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;d)&lt;/strong&gt; There should not be any troubles related to 180 s advertising timeout. In on_timeout(), which error code does ble_advertising_start() return?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;e)&lt;/strong&gt; I didn&amp;#39;t think that logging works before it has been initialized, that sounds strange.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;f)&lt;/strong&gt; What does your initialization code looks like? When using &amp;quot;bare&amp;quot; printf, there will normally not be any timestamps. But I guess, since NRF_LOG also is enabled that there is something that somehow overlaps.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>