Questions about uart fifo and rtt debug

Hi,

I'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 function, the error 8 is returned during NRF_LOG_DEFAULT_BACKENDS_INIT() function.

my code is:

int main(void)
{
    bool erase_bonds;
    uint32_t deviceID[2]; //ID unico de cada processador

    ret_code_t err_code;
    //external_clock_init(); // Inicialização do clock externo
    // Initialize.
    #ifdef BLE_UART_CAL
    uart_init();                //todo ble_uart
    #endif
    log_init();                 //Inicializa Log serial utilizado pela pilha nrf - ok
    gpiote_init();
    //continue
    }

and the uart_init function:

/**@snippet [UART Initialization] */
static void uart_init(void)
{
    uint32_t                     err_code;
    app_uart_comm_params_t const comm_params =
    {
        .rx_pin_no    = NRF_UART_PSEL_DISCONNECTED,
        .tx_pin_no    = NRF_LOG_BACKEND_UART_TX_PIN,
        .rts_pin_no   = NRF_UART_PSEL_DISCONNECTED,
        .cts_pin_no   = NRF_UART_PSEL_DISCONNECTED,
        .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
        .use_parity   = false,
#if defined (UART_PRESENT)
        .baud_rate    = NRF_UART_BAUDRATE_115200
#else
        .baud_rate    = NRF_UARTE_BAUDRATE_115200
#endif
    };

    APP_UART_FIFO_INIT(&comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_event_handle,
                       APP_IRQ_PRIORITY_LOWEST,
                       err_code);
    APP_ERROR_CHECK(err_code);
}

and the log_init function, the log backends init enabled:

void nrf_log_default_backends_init(void)
{
    int32_t backend_id = -1;
    (void)backend_id;
#if defined(NRF_LOG_BACKEND_RTT_ENABLED) && NRF_LOG_BACKEND_RTT_ENABLED
    nrf_log_backend_rtt_init();
    backend_id = nrf_log_backend_add(&rtt_log_backend, NRF_LOG_SEVERITY_DEBUG);
    ASSERT(backend_id >= 0);
    nrf_log_backend_enable(&rtt_log_backend);
#endif

Using this code, my debug is visualized in debug terminal inside the segger ide:

and according to ble_uart example, the values that I sent my ble application to my device, appears in serial terminal connected on pin that I configured.

When I tried using just pin to serial, the error 8 is returned. The init uart_serial using fifo mode and rtt is not. What is the best solution to transfer my debug terminal to serial pin.

Can you help me?

Regards

Laerte

Related