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

How to achieve maximum throughput of UART (virtual COM-Port)

Hi all,

I am currently working on a project which uses the ble_app_uart_c example. I have a nRF52840DK as central. The central receives NUS pakets with a average data rate of ~120 kBit/s. Each NUS paket has the same length. 

The received data should be printed on the UART( for accessing it at the COM-Port of a pc). I am using the following parameters for the UART: 

#define UART_RX_BUF_SIZE        32768
#define UART_TX_BUF_SIZE        32768

.baud_rate    = UART_BAUDRATE_BAUDRATE_Baud1M

APP_IRQ_PRIORITY_HIGHEST

My problem is that I still loose some bytes after 1 to 10 minutes. I am using the default for-loop of the ble_app_uart_c example to print the data on the UART.

I already identified that the UART on the central side looses the data. The NUS pakets which I receive are okey.

For my application I am not allowed to loose random bytes. Can you please provide me some help?

Here are my questions:

1. Which parameters provide the highest throughput?

2. How can I prevent a overflow of the uart tx buffer?

3. Is there another way to call app_uart_put(), because I have a defined data_len?

4. How do I achieve a reliable transmission via UART at this 120kBit/s?

Thank you very much in advance.

Kind regards,

Maria

Parents
  • Hello Maria,

    I'd recommend to work with the UART driver directly as that will allow you to use larger DMA buffers. The app_uart implementation is only sending 1 byte at a time and is thus not as efficient in terms of performance.

    Kind regards,

    Vidar

  • Hi Vidar Berg,

    thank you for your quick reply.

    I will check the UART driver out. Are there any examples available, regarding how to set this up properly?

    I think another approach would be to use flow control, then I could use the default UART implementation of the ble_app_uart_c example. Is flow control over the UART - USB bridge of the nRF52840DK possible? 

    Normally RTS and CTS are additional pins on the RS-232.

    If my application on my pc allows RTS/CTS flow control, then I could enable flow control by simply setting: APP_UART_FLOW_CONTROL_ENABLED in uart_init()? Is that correct?

    Kind regards,

    Maria

Reply
  • Hi Vidar Berg,

    thank you for your quick reply.

    I will check the UART driver out. Are there any examples available, regarding how to set this up properly?

    I think another approach would be to use flow control, then I could use the default UART implementation of the ble_app_uart_c example. Is flow control over the UART - USB bridge of the nRF52840DK possible? 

    Normally RTS and CTS are additional pins on the RS-232.

    If my application on my pc allows RTS/CTS flow control, then I could enable flow control by simply setting: APP_UART_FLOW_CONTROL_ENABLED in uart_init()? Is that correct?

    Kind regards,

    Maria

Children
Related