This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Rerouting printf() to UART

Hi,

Currently our system is using printf() to print some debug messages to the Segger debug terminal.
Now we would like to reroute these messages to a UART port.

We are already using 1 UART for communication with chip on the board. We would like to use the other UART for the debug messages.

In our sdk_config.h we changed NRF_LOG_BACKEND_RTT_ENABLED from 1 to 0, and NRF_LOG_BACKEND_UART_ENABLED from 0 to 1.
Furthermore, we set NRF_LOG_BACKEND_UART_TX_PIN. For now, we left NRF_LOG_BACKEND_UART_BAUDRATE at 30801920

Unfortunately, after these changes the UART that we were previously already using successfully is no longer working.
This is coming into a conditional breakpoint:

    app_uart_comm_params_t const uart1_settings =
    {
        .rx_pin_no    = UART1_TX_PIN,
        .tx_pin_no    = UART1_RX_PIN,
        .rts_pin_no   = RTS_PIN_NUMBER,
        .cts_pin_no   = CTS_PIN_NUMBER,
        .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
        .use_parity   = false,
        .baud_rate    = UART_BAUDRATE_BAUDRATE_Baud115200
    };
    APP_UART_FIFO_INIT(&uart1_settings,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart1_event_handle,
                       APP_IRQ_PRIORITY_LOWEST,
                       err_code);
    APP_ERROR_CHECK(err_code);       // check if UART is setup without errors

What are we missing?

Parents Reply Children
No Data
Related