Printf over UART at high rate

Hi Nordic, 

I am using the SDK 17, s140 and the nrf52840 , with a modified multilink NUS central example. The intention is to print over UART as fast as possible all data received from the BLE. But I get sometimes errors on the UART transmission -> while using cat in my terminal, there are several packages that are not transmitted complete.

I initialize the uart like this:

#define UART_TX_BUF_SIZE        16384 
#define UART_RX_BUF_SIZE       16384
static void uart_init(void)
{
    ret_code_t err_code;

    const app_uart_comm_params_t comm_params =
          {
              RX_PIN_NUMBER,
              TX_PIN_NUMBER,
              RTS_PIN_NUMBER,
              CTS_PIN_NUMBER,
			  APP_UART_FLOW_CONTROL_ENABLED, 
              false,
			  NRF_UART_BAUDRATE_1000000
          };

        APP_UART_FIFO_INIT(&comm_params,
                             UART_RX_BUF_SIZE,
                             UART_TX_BUF_SIZE,
                             uart_error_handle,
							 APP_IRQ_PRIORITY_HIGH, 
                             err_code);

        APP_ERROR_CHECK(err_code);
}

To print, i use printf() with the RETARGET_ENABLED enabled. 

Theoretically, dma should be enabled by #define UART0_CONFIG_USE_EASY_DMA 1

I'm only printing from one place of the application. Is there something else i could do to receive properly the packages? 

Maybe to use a better function than printf(). 

Any help is welcome. Thank you very much! 

  • Not sure how that could happen. nrf_libuarte_async_tx() will start a transfer, and you won't be able to start a new one until the previous is done, that will only return NRF_ERROR_BUSY. You need to post the code you use to send the data to give some more context to what is happening.

    Are you sure that the issue is on the transmitter side and not on the receiver side? Have you checked with a logic analyzer that this is also what is output on the UART lines?

Related