<?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>Questions about uart fifo and rtt debug</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110304/questions-about-uart-fifo-and-rtt-debug</link><description>Hi, 
 I&amp;#39;m devoloping a code that neeed send parameters using ble_uart. I used the ble_nus service as reference and works, but using rtt and not serial pin that I configured. 
 I tried initialize the code with uart_init and log_init, but inside the log_init</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 17 Apr 2024 14:55:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110304/questions-about-uart-fifo-and-rtt-debug" /><item><title>RE: Questions about uart fifo and rtt debug</title><link>https://devzone.nordicsemi.com/thread/479281?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2024 14:55:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5ca12f5-0730-4893-bcfb-3804605d6108</guid><dc:creator>Laerte Junior</dc:creator><description>&lt;p&gt;Problem solved I modified my nus_data_handler funcion and comment the uart_init&lt;/p&gt;
&lt;p&gt;here my nus_data_handler funcion modified:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@snippet [Handling the data received over BLE] */
static void nus_data_handler(ble_nus_evt_t * p_evt)
{
    uint8_t parametros_recebidos[MAX_LENGTH];
    if (p_evt-&amp;gt;type == BLE_NUS_EVT_RX_DATA)
    {
        uint32_t err_code;

        /*NRF_LOG_DEBUG*/NRF_LOG_INFO(&amp;quot;Received data from BLE NUS. Writing data on UART.&amp;quot;);
        NRF_LOG_HEXDUMP_DEBUG(p_evt-&amp;gt;params.rx_data.p_data, p_evt-&amp;gt;params.rx_data.length);

        for (uint32_t i = 0; i &amp;lt; p_evt-&amp;gt;params.rx_data.length; i++)
        {
            parametros_recebidos[i] = p_evt-&amp;gt;params.rx_data.p_data[i];
            NRF_LOG_INFO(&amp;quot;Valor recebido na ble_uart: %x &amp;quot;, p_evt-&amp;gt;params.rx_data.p_data[i]);   
            //do
            //{
            //    err_code = app_uart_put(p_evt-&amp;gt;params.rx_data.p_data[i]); //p_data recebe o valor na uart
            //    //NRF_LOG_INFO(&amp;quot;Valor recebido na ble_uart: %x &amp;quot;, p_evt-&amp;gt;params.rx_data.p_data[i]);                 
            //    if ((err_code != NRF_SUCCESS) &amp;amp;&amp;amp; (err_code != NRF_ERROR_BUSY))
            //    {
            //        NRF_LOG_ERROR(&amp;quot;Failed receiving NUS message. Error 0x%x. &amp;quot;, err_code);
            //        APP_ERROR_CHECK(err_code);
            //    }
            //} while (err_code == NRF_ERROR_BUSY);
        }
        //if (p_evt-&amp;gt;params.rx_data.p_data[p_evt-&amp;gt;params.rx_data.length - 1] == &amp;#39;\r&amp;#39;)
        //{
        //    while (app_uart_put(&amp;#39;\n&amp;#39;) == NRF_ERROR_BUSY);
        //}
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about uart fifo and rtt debug</title><link>https://devzone.nordicsemi.com/thread/479269?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2024 14:23:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1603bd0-4cce-4a1a-b40e-265c1e084cee</guid><dc:creator>Laerte Junior</dc:creator><description>&lt;p&gt;I change my sdk_config file as follow:&lt;/p&gt;
&lt;p&gt;#define NRF_LOG_BACKEND_RTT_ENABLED 0&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;#define NRF_LOG_BACKEND_UART_ENABLED 1&lt;/p&gt;
&lt;p&gt;inside the nrf_log_backend_uart_init function in the nrf_log_backend_uart.c, the uart_init is tried inicicialized again and the error_code is returned as 8.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void uart_init(bool async_mode)
{
    nrf_drv_uart_config_t config = NRF_DRV_UART_DEFAULT_CONFIG;
    config.pseltxd  = NRF_LOG_BACKEND_UART_TX_PIN;
    config.pselrxd  = NRF_UART_PSEL_DISCONNECTED;
    config.pselcts  = NRF_UART_PSEL_DISCONNECTED;
    config.pselrts  = NRF_UART_PSEL_DISCONNECTED;
    config.baudrate = (nrf_uart_baudrate_t)NRF_LOG_BACKEND_UART_BAUDRATE;
    ret_code_t err_code = nrf_drv_uart_init(&amp;amp;m_uart, &amp;amp;config, async_mode ? uart_evt_handler : NULL);
    APP_ERROR_CHECK(err_code);

    m_async_mode = async_mode;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>