<?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>Add own backend interface to the logger failed</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51566/add-own-backend-interface-to-the-logger-failed</link><description>I try to send the NRF_LOG_INFO() messages over a own backend interface. I tried to add a new backend with nrf_log_backend_add() and enable it with nrf_log_backend_enable(). But as soon as I do this, I only get the first log print over RTT and afterwards</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 03 Sep 2019 09:18:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51566/add-own-backend-interface-to-the-logger-failed" /><item><title>RE: Add own backend interface to the logger failed</title><link>https://devzone.nordicsemi.com/thread/207612?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 09:18:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a382767-b5f9-4b67-8157-779af64a682c</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;It is probably possible to use the UART for logging and application, but that is not something that our SDK supports. The issue is that you try to initialize the UART twice. I suggest you use the RTT backend for your logging, and use the &lt;a href="https://www.segger.com/products/debug-probes/j-link/tools/rtt-viewer/" rel="noopener noreferrer" target="_blank"&gt;JLink RTT Viewer&lt;/a&gt; to monitor this log, to save you some trouble.&lt;/p&gt;
&lt;p&gt;8 means&amp;nbsp;NRF_ERROR_INVALID_STATE, which is returned because the uart is already initialized. I don&amp;#39;t know whether you use the same uart instance and the same pins for your custom UART, or whether you are aware that only one uart instance can be used at the time, not both.&lt;/p&gt;
&lt;p&gt;If you try to use the same instance, but with two uartHandlers, I suggest you use only one handler, which also calls the second.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But again, if this is only for log monitoring during development, I recommend that you save yourself some trouble and use the RTT backend.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add own backend interface to the logger failed</title><link>https://devzone.nordicsemi.com/thread/207452?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 14:34:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00424d22-e3d4-4bad-bf87-668eea3c0124</guid><dc:creator>awneil</dc:creator><description>[quote userid="82935" url="~/f/nordic-q-a/51566/add-own-backend-interface-to-the-logger-failed/207437"]I have only a Make project and no SES or Keil project to debug step by step[/quote]
&lt;p&gt;It is, of course, perfectly possible to debug on the command line - if that&amp;#39;s your thing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add own backend interface to the logger failed</title><link>https://devzone.nordicsemi.com/thread/207437?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 14:05:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b8d316d-ff01-4dcf-a1d4-a391a6847bba</guid><dc:creator>ManuelF</dc:creator><description>&lt;p&gt;&lt;span class="c-message__body" dir="auto"&gt;I try to implement a UART backend for the logger, but with custom functions. This because I add some data to indentify these messages as log messages. The UART is additionaly used for sending commands.&lt;br /&gt;I figured out, that there is a problem with my uartInit(). I took the example ble_app_hrs and added my uart communication. As soon as I call my uartInit() the example, I get error code 0x08 on APP_UART_FIFO_INIT() call. But how do I init the uart to get the uartHandler? &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="c-message__body" dir="auto"&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// UART
#define UART_TX_BUF_SIZE                  512
#define UART_RX_BUF_SIZE                  1024

typedef uint16_t uarttMessageLength_t;
typedef void (* uartMessageHandler_t) (const uint8_t * data, uarttMessageLength_t length);

/*
 * @brief Sends the specified data to the uart port.
 */
bool uartSendMessage(const void * data, uarttMessageLength_t length)
{
   //send uart data
   return true;
}

/*
 * @brief The uart messages flow.
 */
void onUartMessage(const uint8_t * data, uint16_t length)
{
   NRF_LOG_HEXDUMP_DEBUG(data, length);
}

/*
 * @brief The UART communication callback.
 */
void onUartEvent(app_uart_evt_t * p_event)
{
   switch (p_event-&amp;gt;evt_type)
   {
      case APP_UART_DATA:
         break;

      case APP_UART_DATA_READY:
         break;

      case APP_UART_COMMUNICATION_ERROR:
         APP_ERROR_HANDLER(p_event-&amp;gt;data.error_communication);
         break;

      case APP_UART_FIFO_ERROR:
         APP_ERROR_HANDLER(p_event-&amp;gt;data.error_code);
         break;

      default:
         break;
    }
}

void uartInit(uartMessageHandler_t uartMessageHandler)
{

   const app_uart_comm_params_t comm_params =
   {
      .rx_pin_no    = 5,
      .tx_pin_no    = 6,
      .rts_pin_no   = 31,
      .cts_pin_no   = 7,
      .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
      .use_parity   = false,
      .baud_rate    = UART_BAUDRATE_BAUDRATE_Baud115200
   };

   uint32_t result;
   APP_UART_FIFO_INIT(&amp;amp; comm_params,
                      UART_RX_BUF_SIZE,
                      UART_TX_BUF_SIZE,
                      onUartEvent,
                      APP_IRQ_PRIORITY_LOWEST,
                      result);
   APP_ERROR_CHECK(result);
}



/**@brief Function for application main entry.
 */
int main(void)
{
    bool erase_bonds;

    // Initialize.
    uartInit(&amp;amp; onUartMessage);
    log_init();
    timers_init();
    buttons_leds_init(&amp;amp;erase_bonds);
    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    advertising_init();
    services_init();
    sensor_simulator_init();
    conn_params_init();
    peer_manager_init();

    // Start execution.
    NRF_LOG_INFO(&amp;quot;Heart Rate Sensor example started.&amp;quot;);
    application_timers_start();
    advertising_start(erase_bonds);

    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="c-message__body" dir="auto"&gt;&lt;a href="https://devzone.nordicsemi.com/members/awneil"&gt;awneil&lt;/a&gt;: Unfortunately I have only a Make project and no SES or Keil project to debug step by step.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add own backend interface to the logger failed</title><link>https://devzone.nordicsemi.com/thread/207060?ContentTypeID=1</link><pubDate>Fri, 30 Aug 2019 08:45:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:535c2054-dbf8-4e80-8c0c-ee13e3f75bed</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Are you trying to implement a UART backend for the logger?&lt;/p&gt;
&lt;p&gt;If so, I suggest you take a look at one of the examples that has the option for UART backend in the NRF_LOG module, such as the ble_app_hrs example.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Other than that I don&amp;#39;t know what the issue is, I see a lot of empty functions in your snippets. Is the plan to populate them?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add own backend interface to the logger failed</title><link>https://devzone.nordicsemi.com/thread/206931?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2019 15:09:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:090f0d89-3f24-4e5a-a6ec-8b1279ed8cf4</guid><dc:creator>awneil</dc:creator><description>[quote userid="82935" url="~/f/nordic-q-a/51566/add-own-backend-interface-to-the-logger-failed"]I seems the software is &amp;quot;stuck&amp;quot; somewhere[/quote]
&lt;p&gt;So have you used the &lt;strong&gt;debugger&lt;/strong&gt; to find where it&amp;#39;s stuck?&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/5618._5F00_Insert-Code-_2D00_-Nordic-2.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>