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

app_uart fifo buffer: is it possible to see how much space empty in tx buffer and filled in rx buffer

Hi,

I am using app_uart library with Tx and Rx FiFo. I want to check how much space is available in the Tx FiFo at any time, and similarly how much space is filled in the Rx FiFo. Does anyone know if that is possible and how.  Apparently the app_uart library does not provide any API for this purpose.

Thanks

Parents Reply Children
  • Hi,

    I am looking for a solution that does not require changes in the app_uart library files, which is not the case in the proposals in the referenced thread.

    In my application I need to send fixed length packets. I think it would better to write the complete packet when there is sufficient free space in the UART FIFO, instead of first copying the packet to a local buffer, and then writing to the FIFO byte-by-byte, and each time checking whether the writing was successful. In the latter case, overhead would be much higher.

    It is pity that such basic functionality, to check free space in the FIFO,  is not provided by the app_uart library APIs.

    KR

  • Hi Jatala,

    In my application I need to send fixed length packets. I think it would better to write the complete packet when there is sufficient free space in the UART FIFO, instead of first copying the packet to a local buffer, and then writing to the FIFO byte-by-byte, and each time checking whether the writing was successful. In the latter case, overhead would be much higher.

    If you are looking for something more sophisticated than the app_uart library, and don't want to modify the app_uart library, then I would recommend taking look at the serial example and the experimental_libuarte example in SDK 15.3

  • As noted in the referenced thread, the app_uart library just "wraps" the fifo library - which does provide the feature your request.

    So you can use the underlying FIFO library unmodified, and create your own UART "wrapper" which does do what you want...

  • Following your lead, I adopted a bit different route. Instead of using app_uart library and FIFO library, I wrote a wrapper based on uart driver and ring buffer.

Related