<?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>app_trace_init not returning useful value if debugging disabled</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10553/app_trace_init-not-returning-useful-value-if-debugging-disabled</link><description>Hi everyone, 
 I am using the nRF51 SDK 10.0.
The documentation for the Debug Logger API suggests sample code like: 
 uint32_t retval; // Initialize module
retval = app_trace_init();
if (retval == NRF_SUCCESS) {
	// Module successfully initialized</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Nov 2015 13:32:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10553/app_trace_init-not-returning-useful-value-if-debugging-disabled" /><item><title>RE: app_trace_init not returning useful value if debugging disabled</title><link>https://devzone.nordicsemi.com/thread/39269?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2015 13:32:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3fcbbc9-999a-41d7-ba7b-7c7a3a20a44e</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi, the documentation doesn&amp;#39;t seem to correspond to actual implementation in the SDK. In the SDK (ble_app_hrs) app_trace is defined as app_trace_init(...) when ENABLE_DEBUG_LOG_SUPPORT is not defined, hence doing nothing. Also, it doesn&amp;#39;t return any error code in case of assert.  Will report this internally.&lt;/p&gt;
&lt;p&gt;Normally app_trace_init() shouldn&amp;#39;t fail unless it has been modified in some way which is why it&amp;#39;s a void function. However, if it does fail I think it&amp;#39;s better to catch the error by passing it to the APP_ERROR_CHECK() macro :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void app_trace_init(void)
{
    uint32_t err_code = NRF_SUCCESS;
    const app_uart_comm_params_t comm_params =  
    {
        RX_PIN_NUMBER, 
        TX_PIN_NUMBER, 
        RTS_PIN_NUMBER, 
        CTS_PIN_NUMBER, 
        APP_UART_FLOW_CONTROL_DISABLED, 
        false, 
        UART_BAUDRATE_BAUDRATE_Baud38400
    }; 
        
    APP_UART_FIFO_INIT(&amp;amp;comm_params, 
                       UART_RX_BUF_SIZE, 
                       UART_TX_BUF_SIZE, 
                       uart_error_handle, 
                       APP_IRQ_PRIORITY_LOW,
                       err_code);
   //UNUSED_VARIABLE(err_code);
   APP_ERROR_CHECK(err_code);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then in case of assert, the app_error.c-&amp;gt;app_error_handler() will be called with the error code passed as an argument. The list of error codes are found in nrf_error.h, and can be used to determine the reason for the assert.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>